From e4d8e36f62a50083b4d562a42c4bf2b0bcce0b61 Mon Sep 17 00:00:00 2001 From: William Storey Date: Thu, 26 Dec 2024 10:05:23 -0800 Subject: [PATCH 1/3] Test on Ruby 3.4 --- .github/workflows/rubocop.yml | 2 +- .github/workflows/test.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml index 044aa42..0c7e637 100644 --- a/.github/workflows/rubocop.yml +++ b/.github/workflows/rubocop.yml @@ -13,6 +13,6 @@ jobs: - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 with: - ruby-version: 3.3 + ruby-version: 3.4 - run: bundle install - run: bundle exec rake -t rubocop diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5efc3b2..73272f8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,6 +20,7 @@ jobs: 3.1, 3.2, 3.3, + 3.4, jruby, ] exclude: From ed48afe5f9542fa454b97e3af65e795f256bc458 Mon Sep 17 00:00:00 2001 From: William Storey Date: Thu, 26 Dec 2024 10:06:24 -0800 Subject: [PATCH 2/3] Drop support for Ruby 2.7 --- .github/workflows/test.yml | 1 - .rubocop.yml | 2 +- CHANGELOG.md | 4 ++-- README.md | 2 +- maxmind-geoip2.gemspec | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 73272f8..2bfc132 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,7 +15,6 @@ jobs: os: [ubuntu-latest, windows-latest, macos-latest] version: [ - 2.7, '3.0', 3.1, 3.2, diff --git a/.rubocop.yml b/.rubocop.yml index a243ab1..973ecd0 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,7 +1,7 @@ require: rubocop-performance AllCops: - TargetRubyVersion: 2.7 + TargetRubyVersion: '3.0' NewCops: enable # Metrics are too arbitrary. diff --git a/CHANGELOG.md b/CHANGELOG.md index a0af719..292b044 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,8 @@ ## 1.3.0 -* Ruby 2.5 and 2.6 are no longer supported. If you're using one of these - versions, please use version 1.2.0 of this gem. +* Ruby 3.0+ is now required. If you're using Ruby 2.5, 2.6, or 2.7, please + use version 1.2.0 of this gem. ## 1.2.0 (2023-12-04) diff --git a/README.md b/README.md index 12dd895..4129155 100644 --- a/README.md +++ b/README.md @@ -332,7 +332,7 @@ client API, please see [our support page](https://www.maxmind.com/en/support). ## Requirements -This code requires Ruby version 2.7 or higher. +This code requires Ruby version 3.0 or higher. ## Contributing diff --git a/maxmind-geoip2.gemspec b/maxmind-geoip2.gemspec index bdba464..d36d881 100644 --- a/maxmind-geoip2.gemspec +++ b/maxmind-geoip2.gemspec @@ -24,7 +24,7 @@ Gem::Specification.new do |s| 'rubygems_mfa_required' => 'true', 'source_code_uri' => 'https://github.com/maxmind/GeoIP2-ruby', } - s.required_ruby_version = '>= 2.7.0' + s.required_ruby_version = '>= 3.0' s.add_runtime_dependency 'connection_pool', ['~> 2.2'] s.add_runtime_dependency 'http', '>= 4.3', '< 6.0' From 703ff3df01499d45af5203937cd3d3e6b34da8b2 Mon Sep 17 00:00:00 2001 From: William Storey Date: Thu, 26 Dec 2024 10:07:00 -0800 Subject: [PATCH 3/3] Fix rubocop lints --- lib/maxmind/geoip2/model/city.rb | 2 +- lib/maxmind/geoip2/record/traits.rb | 2 +- maxmind-geoip2.gemspec | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/maxmind/geoip2/model/city.rb b/lib/maxmind/geoip2/model/city.rb index b6e3210..563035b 100644 --- a/lib/maxmind/geoip2/model/city.rb +++ b/lib/maxmind/geoip2/model/city.rb @@ -46,7 +46,7 @@ class City < Country # @!visibility private def initialize(record, locales) - super(record, locales) + super @city = MaxMind::GeoIP2::Record::City.new(record['city'], locales) @location = MaxMind::GeoIP2::Record::Location.new(record['location']) @postal = MaxMind::GeoIP2::Record::Postal.new(record['postal']) diff --git a/lib/maxmind/geoip2/record/traits.rb b/lib/maxmind/geoip2/record/traits.rb index d9a8db4..84104e5 100644 --- a/lib/maxmind/geoip2/record/traits.rb +++ b/lib/maxmind/geoip2/record/traits.rb @@ -12,7 +12,7 @@ module Record class Traits < Abstract # @!visibility private def initialize(record) - super(record) + super if record && !record.key?('network') && record.key?('ip_address') && record.key?('prefix_length') ip = IPAddr.new(record['ip_address']).mask(record['prefix_length']) diff --git a/maxmind-geoip2.gemspec b/maxmind-geoip2.gemspec index d36d881..85526cd 100644 --- a/maxmind-geoip2.gemspec +++ b/maxmind-geoip2.gemspec @@ -26,9 +26,9 @@ Gem::Specification.new do |s| } s.required_ruby_version = '>= 3.0' - s.add_runtime_dependency 'connection_pool', ['~> 2.2'] - s.add_runtime_dependency 'http', '>= 4.3', '< 6.0' - s.add_runtime_dependency 'maxmind-db', ['~> 1.2'] + s.add_dependency 'connection_pool', ['~> 2.2'] + s.add_dependency 'http', '>= 4.3', '< 6.0' + s.add_dependency 'maxmind-db', ['~> 1.2'] s.add_development_dependency 'minitest' s.add_development_dependency 'rake'