Skip to content

Commit 5f831e3

Browse files
author
Chris Blackburn
committed
Update min. ruby to 2.7.3
1 parent 292a336 commit 5f831e3

10 files changed

Lines changed: 98 additions & 84 deletions

File tree

.rubocop.yml

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
AllCops:
2-
TargetRubyVersion: 2.3
2+
TargetRubyVersion: 2.7
33

44
# Include gemspec and Rakefile
55
Include:
@@ -19,36 +19,29 @@ AllCops:
1919
- 'stubs/**/*'
2020
- 'spec/support/shared_contexts/*'
2121

22+
NewCops: enable
23+
24+
########################################
25+
# Style Cops
26+
2227
# Checks formatting of special comments
23-
CommentAnnotation:
28+
Style/CommentAnnotation:
2429
Keywords:
2530
- TODO
2631
- FIXME
2732
- OPTIMIZE
2833
- HACK
2934
- REVIEW
3035

31-
########################################
32-
# Style Cops
33-
3436
Style/ClassVars:
3537
Enabled: false
3638

3739
Style/Documentation:
3840
Enabled: false
3941

40-
Style/FileName:
41-
Enabled: false
42-
43-
Style/AlignParameters:
44-
EnforcedStyle: with_fixed_indentation
45-
4642
Style/RegexpLiteral:
4743
Enabled: false
4844

49-
Style/EmptyLinesAroundBlockBody:
50-
Enabled: false
51-
5245
Style/RaiseArgs:
5346
Enabled: false
5447

@@ -61,18 +54,18 @@ Style/PerlBackrefs:
6154
########################################
6255
# Lint Cops
6356

64-
Lint/Eval:
57+
Lint/SuppressedException:
6558
Enabled: false
6659

67-
Lint/HandleExceptions:
60+
########################################
61+
# Security Cops
62+
63+
Security/Eval:
6864
Enabled: false
6965

7066
########################################
7167
# Metrics Cops
7268

73-
Metrics/LineLength:
74-
Max: 110
75-
7669
Metrics/MethodLength:
7770
CountComments: false # count full line comments?
7871
Max: 30
@@ -83,6 +76,17 @@ Metrics/ClassLength:
8376
Metrics/AbcSize:
8477
Enabled: false
8578

86-
# rubocop:disable Metrics/AbcSize
87-
# rubocop:disable Metrics/MethodLength
88-
# rubocop:disable Metrics/BlockLength
79+
########################################
80+
# Metrics Cops
81+
82+
Naming/FileName:
83+
Enabled: false
84+
85+
########################################
86+
# Layout Cops
87+
88+
Layout/EmptyLinesAroundBlockBody:
89+
Enabled: false
90+
91+
Layout/LineLength:
92+
Max: 110

.ruby-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.7.3

Gemfile.lock

Lines changed: 49 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -12,71 +12,74 @@ PATH
1212
GEM
1313
remote: https://rubygems.org/
1414
specs:
15-
ast (2.4.0)
16-
coderay (1.1.2)
15+
ast (2.4.2)
16+
coderay (1.1.3)
1717
colored (1.2)
18-
diff-lcs (1.3)
19-
docile (1.3.0)
20-
json (2.3.1)
21-
kiba (2.0.0)
22-
method_source (0.8.2)
23-
optimist (3.0.0)
24-
parallel (1.12.1)
25-
parser (2.5.1.0)
26-
ast (~> 2.4.0)
27-
powerpack (0.1.1)
28-
pry (0.10.4)
18+
diff-lcs (1.4.4)
19+
docile (1.4.0)
20+
kiba (2.5.0)
21+
method_source (0.9.2)
22+
optimist (3.0.1)
23+
parallel (1.21.0)
24+
parser (3.0.2.0)
25+
ast (~> 2.4.1)
26+
pry (0.12.2)
2927
coderay (~> 1.1.0)
30-
method_source (~> 0.8.1)
31-
slop (~> 3.4)
32-
pry-nav (0.2.4)
33-
pry (>= 0.9.10, < 0.11.0)
28+
method_source (~> 0.9.0)
29+
pry-nav (0.3.0)
30+
pry (>= 0.9.10, < 0.13.0)
3431
rainbow (3.0.0)
35-
rake (13.0.1)
36-
rspec (3.7.0)
37-
rspec-core (~> 3.7.0)
38-
rspec-expectations (~> 3.7.0)
39-
rspec-mocks (~> 3.7.0)
40-
rspec-core (3.7.1)
41-
rspec-support (~> 3.7.0)
42-
rspec-expectations (3.7.0)
32+
rake (13.0.6)
33+
regexp_parser (2.1.1)
34+
rexml (3.2.5)
35+
rspec (3.10.0)
36+
rspec-core (~> 3.10.0)
37+
rspec-expectations (~> 3.10.0)
38+
rspec-mocks (~> 3.10.0)
39+
rspec-core (3.10.1)
40+
rspec-support (~> 3.10.0)
41+
rspec-expectations (3.10.1)
4342
diff-lcs (>= 1.2.0, < 2.0)
44-
rspec-support (~> 3.7.0)
45-
rspec-mocks (3.7.0)
43+
rspec-support (~> 3.10.0)
44+
rspec-mocks (3.10.2)
4645
diff-lcs (>= 1.2.0, < 2.0)
47-
rspec-support (~> 3.7.0)
48-
rspec-support (3.7.1)
49-
rubocop (0.55.0)
46+
rspec-support (~> 3.10.0)
47+
rspec-support (3.10.3)
48+
rubocop (1.22.3)
5049
parallel (~> 1.10)
51-
parser (>= 2.5)
52-
powerpack (~> 0.1)
50+
parser (>= 3.0.0.0)
5351
rainbow (>= 2.2.2, < 4.0)
52+
regexp_parser (>= 1.8, < 3.0)
53+
rexml
54+
rubocop-ast (>= 1.12.0, < 2.0)
5455
ruby-progressbar (~> 1.7)
55-
unicode-display_width (~> 1.0, >= 1.0.1)
56-
ruby-prof (0.17.0)
57-
ruby-progressbar (1.9.0)
58-
rubyzip (1.3.0)
59-
simplecov (0.16.1)
56+
unicode-display_width (>= 1.4.0, < 3.0)
57+
rubocop-ast (1.12.0)
58+
parser (>= 3.0.1.1)
59+
ruby-prof (0.18.0)
60+
ruby-progressbar (1.11.0)
61+
rubyzip (2.3.2)
62+
simplecov (0.21.2)
6063
docile (~> 1.1)
61-
json (>= 1.8, < 3)
62-
simplecov-html (~> 0.10.0)
63-
simplecov-html (0.10.2)
64-
slop (3.6.0)
65-
sqlite3 (1.3.13)
66-
unicode-display_width (1.3.2)
64+
simplecov-html (~> 0.11)
65+
simplecov_json_formatter (~> 0.1)
66+
simplecov-html (0.12.3)
67+
simplecov_json_formatter (0.1.3)
68+
sqlite3 (1.4.2)
69+
unicode-display_width (2.1.0)
6770

6871
PLATFORMS
6972
ruby
7073

7174
DEPENDENCIES
72-
bundler (~> 1.16)
75+
bundler
7376
free_zipcode_data!
7477
pry-nav (~> 0.2)
7578
rake (~> 13.0)
7679
rspec (~> 3.7)
77-
rubocop (~> 0.55)
80+
rubocop
7881
ruby-prof (~> 0.17)
7982
simplecov (~> 0.16)
8083

8184
BUNDLED WITH
82-
1.17.1
85+
2.1.4

bin/free_zipcode_data

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
23

34
require 'rubygems'
45
require 'bundler/setup'

free_zipcode_data.gemspec

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
# frozen_string_literal: true
2-
# coding: utf-8
32

4-
lib = File.expand_path('../lib', __FILE__)
3+
lib = File.expand_path('lib', __dir__)
54
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
65
require 'free_zipcode_data/version'
76

8-
# rubocop:disable Metrics/BlockLength
97
Gem::Specification.new do |spec|
108
spec.name = 'free_zipcode_data'
119
spec.version = FreeZipcodeData::VERSION
@@ -19,17 +17,17 @@ Gem::Specification.new do |spec|
1917
spec.homepage = 'https://github.com/midwire/free_zipcode_data'
2018
spec.license = 'MIT'
2119

22-
spec.required_ruby_version = '>= 2.3.0'
20+
spec.required_ruby_version = Gem::Requirement.new(">= #{Bundler.root.join('.ruby-version').read.strip}")
2321
spec.files = `git ls-files -z`.split("\x0")
2422
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
2523
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
2624
spec.require_paths = ['lib']
2725

28-
spec.add_development_dependency 'bundler', '~> 1.16'
26+
spec.add_development_dependency 'bundler'
2927
spec.add_development_dependency 'pry-nav', '~> 0.2'
3028
spec.add_development_dependency 'rake', '~> 13.0'
3129
spec.add_development_dependency 'rspec', '~> 3.7'
32-
spec.add_development_dependency 'rubocop', '~> 0.55'
30+
spec.add_development_dependency 'rubocop'
3331
spec.add_development_dependency 'ruby-prof', '~> 0.17'
3432
spec.add_development_dependency 'simplecov', '~> 0.16'
3533

@@ -40,4 +38,3 @@ Gem::Specification.new do |spec|
4038
spec.add_runtime_dependency 'rubyzip', '>= 1.2.2'
4139
spec.add_runtime_dependency 'sqlite3', '~> 1.3'
4240
end
43-
# rubocop:enable Metrics/BlockLength

lib/free_zipcode_data.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
require 'readline'
44

5+
require 'bundler/setup'
56
require 'free_zipcode_data/version'
67

78
module FreeZipcodeData
@@ -16,6 +17,7 @@ def self.current_environment
1617
#:nocov:
1718
def self.config_file(filename = '.free_zipcode_data.yml')
1819
return root.join('spec', 'fixtures', filename) if current_environment == 'test'
20+
1921
home = ENV.fetch('HOME')
2022
file = ENV.fetch('FZD_CONFIG_FILE', File.join(home, '.free_zipcode_data.yml'))
2123
FileUtils.touch(file)

lib/free_zipcode_data/county_table.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def build
2525

2626
def write(row)
2727
return nil unless row[:county]
28+
2829
state_id = get_state_id(row[:short_state], row[:state])
2930
return nil unless state_id
3031

lib/free_zipcode_data/data_source.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,16 @@ def initialize(country = nil)
1818

1919
def download
2020
return nil if !options.clobber && File.exist?(zipfile_path)
21+
2122
FileUtils.mkdir_p(options.work_dir)
2223
@logger.info("Downloading: #{zipfile} from GeoNames...")
23-
open(zipfile_path, 'wb') do |file|
24-
file << open("#{BASE_URL}/#{zipfile}").read
24+
File.open(zipfile_path, 'wb') do |file|
25+
file << URI.parse("#{BASE_URL}/#{zipfile}").open(&:read)
2526
end
2627
end
2728

2829
def datafile
29-
@datafile ||= begin
30-
datafile_with_headers
31-
end
30+
@datafile ||= datafile_with_headers
3231
end
3332

3433
private
@@ -51,6 +50,7 @@ def unzipped_datafile
5150
Zip::File.open(zipfile_path) do |zip|
5251
zip.each do |entry|
5352
next if entry.name =~ /readme/i
53+
5454
country_file = File.join(options.work_dir, entry.name)
5555
if File.exist?(country_file)
5656
if options[:clobber]

lib/tasks/version.rake

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,10 @@ namespace :version do
6565
end
6666

6767
def module_name
68-
if PROJECT_NAME =~ /-/
68+
case PROJECT_NAME
69+
when /-/
6970
PROJECT_NAME.split('-').map(&:capitalize).join('::')
70-
elsif PROJECT_NAME =~ /_/
71+
when /_/
7172
PROJECT_NAME.split('_').map(&:capitalize).join
7273
else
7374
PROJECT_NAME.capitalize
@@ -100,15 +101,17 @@ namespace :version do
100101
def update_readme_version_strings
101102
version_string = read_version.join('.')
102103
readme = open('README.md').read
103-
regex = /^\*\*Version: [0-9\.]+\*\*$/i
104+
regex = /^\*\*Version: [0-9.]+\*\*$/i
104105
return nil unless readme =~ regex
106+
105107
File.open('README.md', 'w') do |f|
106108
f.write(readme.gsub(regex, "**Version: #{version_string}**"))
107109
end
108110
end
109111

110112
def changelog
111113
return @changelog_path if @changelog_path
114+
112115
@changelog_path = File.join(PROJECT_ROOT, 'CHANGELOG')
113116
FileUtils.touch(@changelog_path)
114117
@changelog_path
@@ -158,9 +161,11 @@ namespace :version do
158161

159162
def check_branch_and_warn
160163
return true unless current_branch == 'master'
164+
161165
puts(branch_warning_message)
162166
while (line = $stdin.gets.chomp)
163167
return true if line =~ /[yY]/
168+
164169
puts 'Aborting version bump.'
165170
return false
166171
end

spec/spec_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
require 'pry'
66

7-
Dir[root.join('spec/support/**/*.rb')].each { |f| require f }
7+
Dir[Pathname.new(File.dirname(__FILE__)).parent.join('spec/support/**/*.rb')].sort.each { |f| require f }
88

99
RSpec.configure do |config|
1010
config.expect_with :rspec do |expectations|

0 commit comments

Comments
 (0)