From b95f6fea142e4f14aa53e991da7c3e8726981590 Mon Sep 17 00:00:00 2001 From: fab-girard Date: Wed, 7 Feb 2024 09:56:29 +0100 Subject: [PATCH 1/3] Use ruby 2.7 --- .ruby_version | 2 +- Gemfile | 2 +- docker/Dockerfile | 7 +------ 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/.ruby_version b/.ruby_version index b4395d7..44d859d 100644 --- a/.ruby_version +++ b/.ruby_version @@ -1 +1 @@ -ruby 2.5.7 +ruby 2.7.0 diff --git a/Gemfile b/Gemfile index 131f881..7bd3ec9 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,5 @@ source 'https://rubygems.org' -ruby '~> 2.5.0' +ruby '~> 2.7.0' gem 'rack' gem 'rake' diff --git a/docker/Dockerfile b/docker/Dockerfile index 2eaadb9..9883909 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,5 +1,5 @@ # 1.0.13 is the latest version containing bundler 2 -FROM phusion/passenger-ruby25:1.0.13 +FROM phusion/passenger-ruby27:2.5.1 VOLUME /srv/app/poly @@ -12,11 +12,6 @@ WORKDIR /srv/app # Install app ENV REDIS_HOST redis-cache -# untill phusion/passenger-ruby27 -RUN mv /etc/apt/sources.list.d /etc/apt/sources.list.d.bak && \ - apt update && apt install -y ca-certificates && \ - mv /etc/apt/sources.list.d.bak /etc/apt/sources.list.d - RUN apt-get update && \ apt-get install -y git build-essential zlib1g-dev gdal-bin \ zlib1g libsqlite3-mod-spatialite libsqlite3-dev \ From 14e3d5c6a420dc6e2f6947e56b3846859f75679d Mon Sep 17 00:00:00 2001 From: fab-girard Date: Wed, 7 Feb 2024 09:57:15 +0100 Subject: [PATCH 2/3] Bundle update with ruby 2.7 --- Gemfile | 2 +- Gemfile.lock | 147 ++++++++++++++++++++++++--------------------------- 2 files changed, 71 insertions(+), 78 deletions(-) diff --git a/Gemfile b/Gemfile index 7bd3ec9..28fd8a2 100644 --- a/Gemfile +++ b/Gemfile @@ -21,7 +21,7 @@ gem 'actionpack' gem 'grape-erb' gem 'geocoder', git: 'https://github.com/Mapotempo/geocoder.git' -gem 'sqlite3' +gem 'sqlite3', '< 1.5' gem 'redis-activesupport' gem 'sentry-raven' diff --git a/Gemfile.lock b/Gemfile.lock index a3f955a..b3efd12 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,89 +7,78 @@ GIT GEM remote: https://rubygems.org/ specs: - actionpack (6.1.7.6) - actionview (= 6.1.7.6) - activesupport (= 6.1.7.6) - rack (~> 2.0, >= 2.0.9) + actionpack (7.1.3) + actionview (= 7.1.3) + activesupport (= 7.1.3) + nokogiri (>= 1.8.5) + racc + rack (>= 2.2.4) + rack-session (>= 1.0.1) rack-test (>= 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.2.0) - actionview (6.1.7.6) - activesupport (= 6.1.7.6) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + actionview (7.1.3) + activesupport (= 7.1.3) builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) - activesupport (6.1.7.6) + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + activesupport (7.1.3) + base64 + bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) minitest (>= 5.1) + mutex_m tzinfo (~> 2.0) - zeitwerk (~> 2.3) ansi (1.5.0) ast (2.4.2) + base64 (0.2.0) + bigdecimal (3.1.6) border_patrol (0.2.1) nokogiri (>= 1.4.3.1) builder (3.2.4) byebug (11.1.3) concurrent-ruby (1.2.3) + connection_pool (2.4.1) crass (1.0.6) docile (1.4.0) - domain_name (0.5.20190701) - unf (>= 0.0.5, < 1.0.0) - dry-configurable (0.12.1) - concurrent-ruby (~> 1.0) - dry-core (~> 0.5, >= 0.5.0) - dry-container (0.7.2) - concurrent-ruby (~> 1.0) - dry-configurable (~> 0.1, >= 0.1.3) - dry-core (0.6.0) + domain_name (0.6.20240107) + drb (2.2.0) + ruby2_keywords + dry-core (1.0.0) concurrent-ruby (~> 1.0) - dry-inflector (0.2.0) - dry-logic (1.2.0) + zeitwerk (~> 2.6) + dry-inflector (1.0.0) + dry-logic (1.5.0) concurrent-ruby (~> 1.0) - dry-core (~> 0.5, >= 0.5) - dry-types (1.5.1) + dry-core (~> 1.0, < 2) + zeitwerk (~> 2.6) + dry-types (1.7.1) concurrent-ruby (~> 1.0) - dry-container (~> 0.3) - dry-core (~> 0.5, >= 0.5) - dry-inflector (~> 0.1, >= 0.1.2) - dry-logic (~> 1.0, >= 1.0.2) + dry-core (~> 1.0) + dry-inflector (~> 1.0) + dry-logic (~> 1.4) + zeitwerk (~> 2.6) erubi (1.12.0) erubis (2.7.0) fakeredis (0.9.2) redis (~> 4.8) - faraday (1.10.3) - faraday-em_http (~> 1.0) - faraday-em_synchrony (~> 1.0) - faraday-excon (~> 1.1) - faraday-httpclient (~> 1.0) - faraday-multipart (~> 1.0) - faraday-net_http (~> 1.0) - faraday-net_http_persistent (~> 1.0) - faraday-patron (~> 1.0) - faraday-rack (~> 1.0) - faraday-retry (~> 1.0) + faraday (2.8.1) + base64 + faraday-net_http (>= 2.0, < 3.1) ruby2_keywords (>= 0.0.4) - faraday-em_http (1.0.0) - faraday-em_synchrony (1.0.0) - faraday-excon (1.1.0) - faraday-httpclient (1.0.1) - faraday-multipart (1.0.4) - multipart-post (~> 2) - faraday-net_http (1.0.1) - faraday-net_http_persistent (1.2.0) - faraday-patron (1.0.0) - faraday-rack (1.0.0) - faraday-retry (1.0.3) - grape (1.7.0) - activesupport + faraday-net_http (3.0.2) + grape (1.8.0) + activesupport (>= 5) builder dry-types (>= 1.1) mustermann-grape (~> 1.0.0) rack (>= 1.3.0) rack-accept - grape-entity (0.10.2) + grape-entity (1.0.0) activesupport (>= 3.0.0) multi_json (>= 1.3.2) grape-erb (0.0.1) @@ -97,7 +86,7 @@ GEM grape i18n tilt - grape-swagger (1.4.2) + grape-swagger (1.6.1) grape (~> 1.3) grape-swagger-entity (0.5.3) grape-entity (>= 0.6.0) @@ -110,14 +99,16 @@ GEM domain_name (~> 0.5) i18n (1.14.1) concurrent-ruby (~> 1.0) + json (2.7.1) + language_server-protocol (3.17.0.3) loofah (2.22.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) mime-types (3.5.2) mime-types-data (~> 3.2015) mime-types-data (3.2024.0206) - mini_portile2 (2.6.1) - minitest (5.15.0) + mini_portile2 (2.8.5) + minitest (5.22.1) minitest-focus (1.4.0) minitest (>= 4, < 6) minitest-reporters (1.6.1) @@ -126,15 +117,15 @@ GEM minitest (>= 5.0) ruby-progressbar multi_json (1.15.0) - multipart-post (2.3.0) - mustermann (2.0.2) + mustermann (3.0.0) ruby2_keywords (~> 0.0.1) mustermann-grape (1.0.2) mustermann (>= 1.0.0) + mutex_m (0.2.0) netrc (0.11.0) nio4r (2.7.0) - nokogiri (1.12.5) - mini_portile2 (~> 2.6.1) + nokogiri (1.15.5) + mini_portile2 (~> 2.8.2) racc (~> 1.4) parallel (1.24.0) parser (3.3.0.5) @@ -143,7 +134,7 @@ GEM puma (6.4.2) nio4r (~> 2.0) racc (1.7.3) - rack (2.2.8) + rack (3.0.9) rack-accept (0.4.5) rack (>= 0.4) rack-contrib (2.4.0) @@ -152,14 +143,17 @@ GEM rack (>= 2.0.0) rack-server-pages (0.1.0) rack + rack-session (2.0.0) + rack (>= 3.0.0) rack-test (2.1.0) rack (>= 1.3) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.5.0) - loofah (~> 2.19, >= 2.19.1) + rails-html-sanitizer (1.6.0) + loofah (~> 2.21) + nokogiri (~> 1.14) rainbow (3.1.1) rake (13.1.0) redis (4.8.1) @@ -175,17 +169,19 @@ GEM mime-types (>= 1.16, < 4.0) netrc (~> 0.8) rexml (3.2.6) - rubocop (1.28.2) + rubocop (1.60.2) + json (~> 2.3) + language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 3.1.0.0) + parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) - rexml - rubocop-ast (>= 1.17.0, < 2.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.30.0, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.17.0) - parser (>= 3.1.1.0) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.30.0) + parser (>= 3.2.1.0) ruby-progressbar (1.13.0) ruby2_keywords (0.0.5) sentry-raven (3.1.2) @@ -200,9 +196,6 @@ GEM tilt (2.3.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unf (0.1.4) - unf_ext - unf_ext (0.0.9.1) unicode-display_width (2.5.0) zeitwerk (2.6.13) @@ -237,10 +230,10 @@ DEPENDENCIES rubocop sentry-raven simplecov - sqlite3 + sqlite3 (< 1.5) RUBY VERSION - ruby 2.5.7p206 + ruby 2.7.0p0 BUNDLED WITH 2.3.15 From 5b318fb0e4f8808c5e4732662ebc5bf4966dfd2f Mon Sep 17 00:00:00 2001 From: fab-girard Date: Wed, 7 Feb 2024 10:06:32 +0100 Subject: [PATCH 3/3] Fix tests with new ruby versions and dependencies --- test/api/v01/bulk_test.rb | 8 ++++---- test/api/v01/unitary_test.rb | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/test/api/v01/bulk_test.rb b/test/api/v01/bulk_test.rb index 23ef412..ed407ca 100644 --- a/test/api/v01/bulk_test.rb +++ b/test/api/v01/bulk_test.rb @@ -160,10 +160,10 @@ def test_use_quotas ]} assert_equal 429, last_response.status assert JSON.parse(last_response.body)['message'].include?('Too many monthly requests') - assert_equal({ "Content-Type" => "application/json; charset=UTF-8", - "X-RateLimit-Limit" => 2, - "X-RateLimit-Remaining" => 0, - "X-RateLimit-Reset" => Time.now.utc.to_date.next_month.to_time.to_i }, last_response.headers) + assert_equal({ "content-type" => "application/json; charset=UTF-8", + "x-ratelimit-limit" => 2, + "x-ratelimit-remaining" => 0, + "x-ratelimit-reset" => Time.now.utc.to_date.next_month.to_time.to_i }, last_response.headers) end def test_should_geocode_when_at_least_one_of_query_postcode_city_street diff --git a/test/api/v01/unitary_test.rb b/test/api/v01/unitary_test.rb index 9b00e98..5736d5b 100644 --- a/test/api/v01/unitary_test.rb +++ b/test/api/v01/unitary_test.rb @@ -142,10 +142,10 @@ def test_use_quotas patch '/0.1/geocode', {api_key: 'bulk_limit', query: 'Place Pey Berland, Bordeaux', country: 'demo'} assert_equal 429, last_response.status assert JSON.parse(last_response.body)['message'].include?('Too many daily requests') - assert_equal({ "Content-Type" => "application/json; charset=UTF-8", - "X-RateLimit-Limit" => 1, - "X-RateLimit-Remaining" => 0, - "X-RateLimit-Reset" => Time.now.utc.to_date.next_day.to_time.to_i }, last_response.headers) + assert_equal({ "content-type" => "application/json; charset=UTF-8", + "x-ratelimit-limit" => 1, + "x-ratelimit-remaining" => 0, + "x-ratelimit-reset" => Time.now.utc.to_date.next_day.to_time.to_i }, last_response.headers) end def test_nil_quotas