From: Tom Hughes Date: Tue, 13 Aug 2024 20:05:51 +0000 (+0100) Subject: Drop support for ruby 3.0 X-Git-Tag: live~108^2~2 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/6789fc30813990710c5fb786bf90a70867f77339 Drop support for ruby 3.0 Also add Ubuntu 24.04 and drop 20.04 as 24.04 is needed for ruby 3.1 without rvm so we should test it. --- diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 9fc132014..343084b0f 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -7,7 +7,7 @@ concurrency: cancel-in-progress: true env: os: ubuntu-22.04 - ruby: '3.0' + ruby: '3.1' jobs: rubocop: name: RuboCop diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 46ab75482..6e2b77059 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,8 +10,8 @@ jobs: name: Ubuntu ${{ matrix.ubuntu }}, Ruby ${{ matrix.ruby }} strategy: matrix: - ubuntu: [20.04, 22.04] - ruby: ['3.0', '3.1', '3.2', '3.3'] + ubuntu: [22.04, 24.04] + ruby: ['3.1', '3.2', '3.3'] runs-on: ubuntu-${{ matrix.ubuntu }} env: RAILS_ENV: test diff --git a/.rubocop.yml b/.rubocop.yml index c0f0c1fa0..8b6ed0180 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -9,7 +9,7 @@ require: - rubocop-rake AllCops: - TargetRubyVersion: 3.0 + TargetRubyVersion: 3.1 NewCops: enable Exclude: - 'vendor/**/*' diff --git a/Gemfile b/Gemfile index 27f295eb6..ffcbc82fd 100644 --- a/Gemfile +++ b/Gemfile @@ -130,7 +130,7 @@ gem "gd2-ffij", ">= 0.4.0" gem "marcel" # Used for browser detection -gem "browser", "< 6" # for ruby 3.0 support +gem "browser", "< 6" # for ruby 3.1 support # Used for S3 object storage gem "aws-sdk-s3" @@ -141,9 +141,6 @@ gem "image_processing" # Used to validate widths gem "unicode-display_width" -# Keep ruby 3.0 compatibility -gem "multi_xml", "~> 0.6.0" - # Gems useful for development group :development do gem "better_errors" diff --git a/Gemfile.lock b/Gemfile.lock index 1012a09db..f537a3654 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -344,7 +344,8 @@ GEM minitest (>= 4, < 6) msgpack (1.7.2) multi_json (1.15.0) - multi_xml (0.6.0) + multi_xml (0.7.1) + bigdecimal (~> 3.1) mutex_m (0.2.0) net-http (0.4.1) uri @@ -670,7 +671,6 @@ DEPENDENCIES minitest (~> 5.1) minitest-focus multi_json - multi_xml (~> 0.6.0) omniauth (~> 2.0.2) omniauth-facebook omniauth-github diff --git a/INSTALL.md b/INSTALL.md index c8e28a62f..8667fb512 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -9,7 +9,7 @@ are two alternatives which make it easier to get a consistent development enviro * **Vagrant** This installs the software into a virtual machine. For Vagrant instructions see [VAGRANT.md](VAGRANT.md). * **Docker** This installs the software using containerization. For Docker instructions see [DOCKER.md](DOCKER.md). -These instructions are based on Ubuntu 22.04 LTS, which is the platform used by the OSMF servers. +These instructions are based on Ubuntu 24.04 LTS, which is the platform used by the OSMF servers. The instructions also work, with only minor amendments, for all other current Ubuntu releases, Fedora and MacOSX We don't recommend attempting to develop or deploy this software on Windows. Some Ruby gems may not be supported. If you need to use Windows the easiest solutions in order are [Docker](DOCKER.md), [Vagrant](VAGRANT.md), and Ubuntu in a virtual machine. @@ -22,12 +22,12 @@ of packages required before you can get the various gems installed. ## Minimum requirements -* Ruby 3.0+ +* Ruby 3.1+ * PostgreSQL 13+ * Bundler (see note below about [developer Ruby setup](#rbenv)) * Javascript Runtime -These can be installed on Ubuntu 22.04 or later with: +These can be installed on Ubuntu 24.04 or later with: ``` sudo apt-get update diff --git a/Vagrantfile b/Vagrantfile index 7895d3b86..c2869cd5f 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -4,7 +4,7 @@ Vagrant.configure("2") do |config| # use official ubuntu image for virtualbox config.vm.provider "virtualbox" do |vb, override| - override.vm.box = "ubuntu/jammy64" + override.vm.box = "ubuntu/noble64" override.vm.synced_folder ".", "/srv/openstreetmap-website" vb.customize ["modifyvm", :id, "--memory", "4096"] vb.customize ["modifyvm", :id, "--cpus", "2"] @@ -16,13 +16,13 @@ Vagrant.configure("2") do |config| # use third party image and sshfs or NFS sharing for lxc config.vm.provider "lxc" do |_, override| - override.vm.box = "generic/ubuntu2204" + override.vm.box = "generic/ubuntu2404" override.vm.synced_folder ".", "/srv/openstreetmap-website", :type => sharing_type end # use third party image and sshfs or NFS sharing for libvirt config.vm.provider "libvirt" do |_, override| - override.vm.box = "generic/ubuntu2204" + override.vm.box = "generic/ubuntu2404" override.vm.synced_folder ".", "/srv/openstreetmap-website", :type => sharing_type end diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb index 5b264db97..84398ad61 100644 --- a/app/controllers/api_controller.rb +++ b/app/controllers/api_controller.rb @@ -142,8 +142,8 @@ class ApiController < ApplicationController ## # wrap an api call in a timeout - def api_call_timeout(&block) - Timeout.timeout(Settings.api_timeout, &block) + def api_call_timeout(&) + Timeout.timeout(Settings.api_timeout, &) rescue ActionView::Template::Error => e e = e.cause diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index fdc2ac4e8..7ce804ced 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -215,10 +215,10 @@ class ApplicationController < ActionController::Base ## # wrap a web page in a timeout - def web_timeout(&block) + def web_timeout(&) raise Timeout::Error if Settings.web_timeout.negative? - Timeout.timeout(Settings.web_timeout, &block) + Timeout.timeout(Settings.web_timeout, &) rescue ActionView::Template::Error => e e = e.cause diff --git a/app/helpers/browse_helper.rb b/app/helpers/browse_helper.rb index 9ea384811..69a8f8fa2 100644 --- a/app/helpers/browse_helper.rb +++ b/app/helpers/browse_helper.rb @@ -44,9 +44,9 @@ module BrowseHelper t "printable_name.version", :version => object.version end - def element_strikethrough(object, &block) + def element_strikethrough(object, &) if object.redacted? || !object.visible? - tag.s(&block) + tag.s(&) else yield end diff --git a/app/helpers/user_mailer_helper.rb b/app/helpers/user_mailer_helper.rb index e5d6e39ac..d47827074 100644 --- a/app/helpers/user_mailer_helper.rb +++ b/app/helpers/user_mailer_helper.rb @@ -18,10 +18,10 @@ module UserMailerHelper ) end - def message_body(&block) + def message_body(&) render( :partial => "message_body", - :locals => { :body => capture(&block) } + :locals => { :body => capture(&) } ) end diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index 86e77703b..dee3dafbe 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -247,8 +247,8 @@ class UserMailer < ApplicationMailer end end - def with_recipient_locale(recipient, &block) - I18n.with_locale(Locale.available.preferred(recipient.preferred_languages), &block) + def with_recipient_locale(recipient, &) + I18n.with_locale(Locale.available.preferred(recipient.preferred_languages), &) end def from_address(name, type, id, token, user_id = nil) diff --git a/lib/classic_pagination/pagination.rb b/lib/classic_pagination/pagination.rb index c7022e0b0..b54b0e9f8 100644 --- a/lib/classic_pagination/pagination.rb +++ b/lib/classic_pagination/pagination.rb @@ -288,7 +288,7 @@ module ActionController end # Successively yields all the paginator's pages to the given block. - def each(&_block) + def each(&) page_count.times do |n| yield self[n + 1] end diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rb index 63c8090a8..d2c3d5196 100644 --- a/test/application_system_test_case.rb +++ b/test/application_system_test_case.rb @@ -38,7 +38,7 @@ class ApplicationSystemTestCase < ActionDispatch::SystemTestCase click_on "Logout", :match => :first end - def within_sidebar(&block) - within "#sidebar_content", &block + def within_sidebar(&) + within("#sidebar_content", &) end end diff --git a/test/test_helper.rb b/test/test_helper.rb index 171028f4b..79d5d0d33 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -340,10 +340,10 @@ module ActiveSupport Settings.merge!(saved_settings) end - def with_user_account_deletion_delay(value, &block) + def with_user_account_deletion_delay(value, &) freeze_time - with_settings(:user_account_deletion_delay => value, &block) + with_settings(:user_account_deletion_delay => value, &) ensure unfreeze_time end