Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
elektronaut committed Nov 13, 2023
1 parent 6097d94 commit 2787d9e
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 20 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
*.gem
.bundle
coverage/
Gemfile.lock
pkg/*
11 changes: 4 additions & 7 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
require: rubocop-rspec
require:
- rubocop-rake
- rubocop-rspec

AllCops:
NewCops: enable
TargetRubyVersion: 2.4
TargetRubyVersion: 3.0

Style/StringLiterals:
EnforcedStyle: double_quotes
Expand All @@ -17,8 +19,3 @@ Metrics/BlockLength:

Naming/MethodName:
Enabled: false

Naming/MethodParameterName:
AllowedNames:
- "x"
- "y"
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ source "http://rubygems.org"
gemspec

group :development, :test do
gem "rake"
gem "rspec"
gem "rubocop", require: false
gem "rubocop-rake", require: false
gem "rubocop-rspec", require: false
gem "simplecov"
end
81 changes: 81 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
PATH
remote: .
specs:
postnummer_norge (0.0.2)

GEM
remote: http://rubygems.org/
specs:
ast (2.4.2)
diff-lcs (1.5.0)
docile (1.4.0)
json (2.6.3)
language_server-protocol (3.17.0.3)
parallel (1.23.0)
parser (3.2.2.4)
ast (~> 2.4.1)
racc
racc (1.7.3)
rainbow (3.1.1)
rake (13.1.0)
regexp_parser (2.8.2)
rexml (3.2.6)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
rspec-mocks (~> 3.12.0)
rspec-core (3.12.2)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.6)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.1)
rubocop (1.57.2)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.2.2.4)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.28.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.30.0)
parser (>= 3.2.1.0)
rubocop-capybara (2.19.0)
rubocop (~> 1.41)
rubocop-factory_bot (2.24.0)
rubocop (~> 1.33)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
rubocop-rspec (2.25.0)
rubocop (~> 1.40)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
ruby-progressbar (1.13.0)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
unicode-display_width (2.5.0)

PLATFORMS
ruby

DEPENDENCIES
postnummer_norge!
rake
rspec
rubocop
rubocop-rake
rubocop-rspec
simplecov

BUNDLED WITH
2.4.22
6 changes: 3 additions & 3 deletions lib/postnummer_norge/postal_code.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ def exists?(code)

def find(code)
matches = postal_codes.select { |pc| pc.code == code.to_s }
!matches.empty? ? matches.first : nil
matches.empty? ? nil : matches.first
end

def find_by_name(name)
matches = postal_codes.select { |pc| pc.name.downcase == name.to_s.downcase }
!matches.empty? ? matches : nil
matches.empty? ? nil : matches
end

def postal_codes
@postal_codes ||= load_postal_codes
end

def load_postal_codes
File.open(data_file, "r", &:read).split("\n").compact.map do |line|
File.read(data_file).split("\n").compact.map do |line|
new(*line.split("\t"))
end
end
Expand Down
7 changes: 2 additions & 5 deletions postnummer_norge.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,13 @@ Gem::Specification.new do |s|
s.homepage = ""
s.summary = "Norwegian postal codes"

# s.rubyforge_project = "postnummer_norge"
s.required_ruby_version = ">= 3.0.0"

s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
s.require_paths = ["lib"]

# specify any dependencies here; for example:
s.add_development_dependency "rake"
s.add_development_dependency "rspec"
s.add_development_dependency "simplecov", "0.17.1"
# s.add_runtime_dependency "rest-client"
s.metadata["rubygems_mfa_required"] = "true"
end
8 changes: 4 additions & 4 deletions spec/postnummer_norge/postal_code_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
context "when code exists" do
let(:code) { "0662" }

it { is_expected.to eq(true) }
it { is_expected.to be(true) }
end

context "when code does not exist" do
let(:code) { "0002" }

it { is_expected.to eq(false) }
it { is_expected.to be(false) }
end
end

Expand All @@ -34,7 +34,7 @@
context "when code does not exist" do
let(:code) { "0002" }

it { is_expected.to eq(nil) }
it { is_expected.to be_nil }
end
end

Expand All @@ -56,7 +56,7 @@
context "when name does not exist" do
let(:name) { "XYZZYX" }

it { is_expected.to eq(nil) }
it { is_expected.to be_nil }
end
end
end

0 comments on commit 2787d9e

Please sign in to comment.