diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 42c86a3..a0bf972 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,9 +11,9 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest] + os: [ubuntu-24.04] # https://www.ruby-lang.org/en/downloads/branches/ - ruby: ["3.1", "3.2", "3.3"] + ruby: ["3.1", "3.2", "3.3", "3.4"] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 diff --git a/.rubocop.yml b/.rubocop.yml index 8be35d2..badddc3 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,9 +1,10 @@ require: - - rubocop-rake - rubocop-rspec + - rubocop-performance AllCops: TargetRubyVersion: 3.0 NewCops: disable + SuggestExtensions: false Metrics/BlockLength: Max: 100 Layout/LineLength: @@ -19,4 +20,4 @@ Style/HashTransformKeys: Style/HashTransformValues: Enabled: true RSpec/MultipleExpectations: - Max: 10 \ No newline at end of file + Max: 10 diff --git a/CHANGES.txt b/CHANGES.txt index 6066aff..e326d7e 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,9 @@ +3.2.1 - Mon Jan 20 2025 +=============================================================== +- Documentation: With 3.0 we changed the classname of exceptions +- test suite: test against Ruby 3.4 +- various Ruby gem updates + 3.2.0 - Mon Jun 10 2024 =============================================================== - Ruby 2.x no longer supported diff --git a/Gemfile b/Gemfile index 176f05b..500c30d 100644 --- a/Gemfile +++ b/Gemfile @@ -3,12 +3,17 @@ source 'https://rubygems.org' gemspec group :development, :test do + gem 'activesupport', '~> 7.2' # 8.x requires Ruby 3.2 gem 'async' gem 'rake' gem 'rspec' gem 'rubocop' - gem 'rubocop-rake' + gem 'rubocop-capybara' + gem 'rubocop-factory_bot' + gem 'rubocop-performance' + gem 'rubocop-rails' # shouldn't be needed, https://github.com/rubocop/rubocop/issues/10893 gem 'rubocop-rspec' + gem 'rubocop-rspec_rails' gem 'vcr' gem 'webmock' end diff --git a/Gemfile.lock b/Gemfile.lock index 243b1ba..486d0e0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,15 +6,31 @@ PATH GEM remote: https://rubygems.org/ specs: - addressable (2.8.6) - public_suffix (>= 2.0.2, < 6.0) + activesupport (7.2.2.1) + base64 + benchmark (>= 0.3) + bigdecimal + concurrent-ruby (~> 1.0, >= 1.3.1) + connection_pool (>= 2.2.5) + drb + i18n (>= 1.6, < 2) + logger (>= 1.4.2) + minitest (>= 5.1) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) ast (2.4.2) - async (2.19.0) + async (2.21.1) console (~> 1.29) fiber-annotation io-event (~> 1.6, >= 1.6.5) - bigdecimal (3.1.8) - console (1.29.0) + base64 (0.2.0) + benchmark (0.4.0) + bigdecimal (3.1.9) + concurrent-ruby (1.3.5) + connection_pool (2.5.0) + console (1.29.2) fiber-annotation fiber-local (~> 1.1) json @@ -22,82 +38,103 @@ GEM bigdecimal rexml diff-lcs (1.5.1) + drb (2.2.1) fiber-annotation (0.2.0) fiber-local (1.1.0) fiber-storage fiber-storage (1.0.0) - hashdiff (1.1.0) - io-event (1.7.3) - json (2.7.2) + hashdiff (1.1.2) + i18n (1.14.7) + concurrent-ruby (~> 1.0) + io-event (1.7.5) + json (2.9.1) language_server-protocol (3.17.0.3) - parallel (1.25.1) - parser (3.3.2.0) + logger (1.6.5) + minitest (5.25.4) + parallel (1.26.3) + parser (3.3.7.0) ast (~> 2.4.1) racc - public_suffix (5.0.5) - racc (1.8.0) + public_suffix (6.0.1) + racc (1.8.1) + rack (3.1.8) rainbow (3.1.1) rake (13.2.1) - regexp_parser (2.9.2) - rexml (3.3.9) + regexp_parser (2.10.0) + rexml (3.4.0) rspec (3.13.0) rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) rspec-mocks (~> 3.13.0) - rspec-core (3.13.0) + rspec-core (3.13.2) rspec-support (~> 3.13.0) - rspec-expectations (3.13.0) + rspec-expectations (3.13.3) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-mocks (3.13.1) + rspec-mocks (3.13.2) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-support (3.13.1) - rubocop (1.64.1) + rspec-support (3.13.2) + rubocop (1.70.0) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8, < 3.0) - rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.31.1, < 2.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.36.2, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.31.3) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.37.0) parser (>= 3.3.1.0) rubocop-capybara (2.21.0) rubocop (~> 1.41) - rubocop-factory_bot (2.26.0) - rubocop (~> 1.41) - rubocop-rake (0.6.0) - rubocop (~> 1.0) - rubocop-rspec (2.31.0) - rubocop (~> 1.40) - rubocop-capybara (~> 2.17) - rubocop-factory_bot (~> 2.22) - rubocop-rspec_rails (~> 2.28) - rubocop-rspec_rails (2.29.0) - rubocop (~> 1.40) + rubocop-factory_bot (2.26.1) + rubocop (~> 1.61) + rubocop-performance (1.23.1) + rubocop (>= 1.48.1, < 2.0) + rubocop-ast (>= 1.31.1, < 2.0) + rubocop-rails (2.29.0) + activesupport (>= 4.2.0) + rack (>= 1.1) + rubocop (>= 1.52.0, < 2.0) + rubocop-ast (>= 1.31.1, < 2.0) + rubocop-rspec (3.4.0) + rubocop (~> 1.61) + rubocop-rspec_rails (2.30.0) + rubocop (~> 1.61) + rubocop-rspec (~> 3, >= 3.0.1) ruby-progressbar (1.13.0) - unicode-display_width (2.5.0) - vcr (6.2.0) - webmock (3.23.1) + securerandom (0.4.1) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + unicode-display_width (3.1.4) + unicode-emoji (~> 4.0, >= 4.0.4) + unicode-emoji (4.0.4) + vcr (6.3.1) + base64 + webmock (3.24.0) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) PLATFORMS - ruby + arm64-darwin-24 + x86_64-linux DEPENDENCIES + activesupport (~> 7.2) async opencage-geocoder! rake rspec rubocop - rubocop-rake + rubocop-capybara + rubocop-factory_bot + rubocop-performance + rubocop-rails rubocop-rspec + rubocop-rspec_rails vcr webmock diff --git a/README.md b/README.md index 8d37210..4942c2c 100644 --- a/README.md +++ b/README.md @@ -107,9 +107,9 @@ begin # Invalid API key geocoder = OpenCage::Geocoder.new(api_key: 'invalid-api-key') geocoder.geocode('Manchester') -rescue OpenCage::Geocoder::AuthenticationError => e +rescue OpenCage::Error::AuthenticationError => e p 'invalid apikey' -rescue OpenCage::Geocoder::QuotaExceeded => e +rescue OpenCage::Error::QuotaExceeded => e p 'over quota' rescue StandardError => e p 'other error: ' + e.message @@ -117,7 +117,7 @@ end # Using strings instead of numbers for reverse geocoding geocoder.reverse_geocode('51.5019951', '-0.0698806') -# raises OpenCage::Geocoder::InvalidRequest (not valid numeric coordinates: "51.5019951", "-0.0698806") +# raises OpenCage::Error::InvalidRequest (not valid numeric coordinates: "51.5019951", "-0.0698806") begin @@ -147,7 +147,7 @@ File.foreach('queries.txt') do |line| # there is an invalid line in the queries.txt file result = geocoder.reverse_geocode(Float(latitude), Float(longitude)) results.push(result) -rescue ArgumentError, OpenCage::Geocoder::GeocodingError => error +rescue ArgumentError, OpenCage::Error::GeocodingError => error # Stop looping through the queries if there is an error puts "Error: #{error.message}" break diff --git a/spec/open_cage/geocoder/request_spec.rb b/spec/open_cage/geocoder/request_spec.rb index 0916724..4a8be8d 100644 --- a/spec/open_cage/geocoder/request_spec.rb +++ b/spec/open_cage/geocoder/request_spec.rb @@ -4,7 +4,7 @@ let(:api_key) { '1111222233334444' } it 'creates a URI instance' do - expect(described_class.new(api_key, 'New York').url).to be_kind_of(URI::HTTPS) + expect(described_class.new(api_key, 'New York').url).to be_a(URI::HTTPS) end it 'forward' do diff --git a/spec/rubocop_spec.rb b/spec/rubocop_spec.rb index e3a077f..7ccd552 100644 --- a/spec/rubocop_spec.rb +++ b/spec/rubocop_spec.rb @@ -3,7 +3,7 @@ describe 'Ruby linting', type: :feature do it 'run rubocop' do expect do - system('bundle exec rubocop --format simple 2>&1') + system('bundle exec rubocop --no-color --format simple 2>&1') end.to output(/no offenses detect/).to_stdout_from_any_process end end