Skip to content

Commit

Permalink
Merge pull request openstreetmap#5070 from tomhughes/rails72
Browse files Browse the repository at this point in the history
Update to rails 7.2.0
  • Loading branch information
gravitystorm authored Oct 2, 2024
2 parents e8da505 + 60c1ae7 commit 5720968
Show file tree
Hide file tree
Showing 34 changed files with 289 additions and 203 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ concurrency:
cancel-in-progress: true
env:
os: ubuntu-22.04
ruby: '3.0'
ruby: '3.1'
jobs:
rubocop:
name: RuboCop
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require:
- rubocop-rake

AllCops:
TargetRubyVersion: 3.0
TargetRubyVersion: 3.1
NewCops: enable
Exclude:
- 'vendor/**/*'
Expand Down
7 changes: 2 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source "https://rubygems.org"

# Require rails
gem "rails", "~> 7.1.0"
gem "rails", "~> 7.2.0"
gem "turbo-rails"

# Require json for multi_json
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand Down
139 changes: 68 additions & 71 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,86 +3,82 @@ GEM
specs:
aasm (5.5.0)
concurrent-ruby (~> 1.0)
actioncable (7.1.4)
actionpack (= 7.1.4)
activesupport (= 7.1.4)
actioncable (7.2.0)
actionpack (= 7.2.0)
activesupport (= 7.2.0)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
zeitwerk (~> 2.6)
actionmailbox (7.1.4)
actionpack (= 7.1.4)
activejob (= 7.1.4)
activerecord (= 7.1.4)
activestorage (= 7.1.4)
activesupport (= 7.1.4)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.1.4)
actionpack (= 7.1.4)
actionview (= 7.1.4)
activejob (= 7.1.4)
activesupport (= 7.1.4)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
actionmailbox (7.2.0)
actionpack (= 7.2.0)
activejob (= 7.2.0)
activerecord (= 7.2.0)
activestorage (= 7.2.0)
activesupport (= 7.2.0)
mail (>= 2.8.0)
actionmailer (7.2.0)
actionpack (= 7.2.0)
actionview (= 7.2.0)
activejob (= 7.2.0)
activesupport (= 7.2.0)
mail (>= 2.8.0)
rails-dom-testing (~> 2.2)
actionpack (7.1.4)
actionview (= 7.1.4)
activesupport (= 7.1.4)
actionpack (7.2.0)
actionview (= 7.2.0)
activesupport (= 7.2.0)
nokogiri (>= 1.8.5)
racc
rack (>= 2.2.4)
rack (>= 2.2.4, < 3.2)
rack-session (>= 1.0.1)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
useragent (~> 0.16)
actionpack-page_caching (1.2.4)
actionpack (>= 4.0.0)
actiontext (7.1.4)
actionpack (= 7.1.4)
activerecord (= 7.1.4)
activestorage (= 7.1.4)
activesupport (= 7.1.4)
actiontext (7.2.0)
actionpack (= 7.2.0)
activerecord (= 7.2.0)
activestorage (= 7.2.0)
activesupport (= 7.2.0)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.1.4)
activesupport (= 7.1.4)
actionview (7.2.0)
activesupport (= 7.2.0)
builder (~> 3.1)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
active_record_union (1.3.0)
activerecord (>= 4.0)
activejob (7.1.4)
activesupport (= 7.1.4)
activejob (7.2.0)
activesupport (= 7.2.0)
globalid (>= 0.3.6)
activemodel (7.1.4)
activesupport (= 7.1.4)
activerecord (7.1.4)
activemodel (= 7.1.4)
activesupport (= 7.1.4)
activemodel (7.2.0)
activesupport (= 7.2.0)
activerecord (7.2.0)
activemodel (= 7.2.0)
activesupport (= 7.2.0)
timeout (>= 0.4.0)
activerecord-import (1.8.1)
activerecord (>= 4.2)
activestorage (7.1.4)
actionpack (= 7.1.4)
activejob (= 7.1.4)
activerecord (= 7.1.4)
activesupport (= 7.1.4)
activestorage (7.2.0)
actionpack (= 7.2.0)
activejob (= 7.2.0)
activerecord (= 7.2.0)
activesupport (= 7.2.0)
marcel (~> 1.0)
activesupport (7.1.4)
activesupport (7.2.0)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
logger (>= 1.4.2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
annotate (3.2.0)
Expand Down Expand Up @@ -346,8 +342,8 @@ GEM
minitest (>= 4, < 6)
msgpack (1.7.2)
multi_json (1.15.0)
multi_xml (0.6.0)
mutex_m (0.2.0)
multi_xml (0.7.1)
bigdecimal (~> 3.1)
net-http (0.4.1)
uri
net-imap (0.4.16)
Expand Down Expand Up @@ -448,20 +444,20 @@ GEM
rackup (1.0.0)
rack (< 3)
webrick
rails (7.1.4)
actioncable (= 7.1.4)
actionmailbox (= 7.1.4)
actionmailer (= 7.1.4)
actionpack (= 7.1.4)
actiontext (= 7.1.4)
actionview (= 7.1.4)
activejob (= 7.1.4)
activemodel (= 7.1.4)
activerecord (= 7.1.4)
activestorage (= 7.1.4)
activesupport (= 7.1.4)
rails (7.2.0)
actioncable (= 7.2.0)
actionmailbox (= 7.2.0)
actionmailer (= 7.2.0)
actionpack (= 7.2.0)
actiontext (= 7.2.0)
actionview (= 7.2.0)
activejob (= 7.2.0)
activemodel (= 7.2.0)
activerecord (= 7.2.0)
activestorage (= 7.2.0)
activesupport (= 7.2.0)
bundler (>= 1.15.0)
railties (= 7.1.4)
railties (= 7.2.0)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
Expand All @@ -479,10 +475,10 @@ GEM
rails_param (1.3.1)
actionpack (>= 3.2.0)
activesupport (>= 3.2.0)
railties (7.1.4)
actionpack (= 7.1.4)
activesupport (= 7.1.4)
irb
railties (7.2.0)
actionpack (= 7.2.0)
activesupport (= 7.2.0)
irb (~> 1.13)
rackup (>= 1.0.0)
rake (>= 12.2)
thor (~> 1.0, >= 1.2.2)
Expand Down Expand Up @@ -546,6 +542,7 @@ GEM
sass-embedded (1.64.2)
google-protobuf (~> 3.23)
rake (>= 13.0.0)
securerandom (0.3.1)
selenium-webdriver (4.23.0)
base64 (~> 0.2)
logger (~> 1.4)
Expand Down Expand Up @@ -591,6 +588,7 @@ GEM
concurrent-ruby (~> 1.0)
unicode-display_width (2.6.0)
uri (0.13.1)
useragent (0.16.10)
validates_email_format_of (1.8.2)
i18n (>= 0.8.0)
simpleidn
Expand Down Expand Up @@ -672,7 +670,6 @@ DEPENDENCIES
minitest (~> 5.1)
minitest-focus
multi_json
multi_xml (~> 0.6.0)
omniauth (~> 2.0.2)
omniauth-facebook
omniauth-github
Expand All @@ -688,7 +685,7 @@ DEPENDENCIES
quad_tile (~> 1.0.1)
rack-cors
rack-uri_sanitizer
rails (~> 7.1.0)
rails (~> 7.2.0)
rails-controller-testing
rails-i18n (~> 7.0.0)
rails_param
Expand Down Expand Up @@ -717,4 +714,4 @@ DEPENDENCIES
webmock

BUNDLED WITH
2.4.19
2.5.11
6 changes: 3 additions & 3 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions app/controllers/api_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ def api_call_handle_error

##
# 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

Expand Down
4 changes: 2 additions & 2 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,10 @@ def set_locale

##
# 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

Expand Down
4 changes: 2 additions & 2 deletions app/helpers/browse_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ def printable_element_version(object)
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
Expand Down
4 changes: 2 additions & 2 deletions app/helpers/user_mailer_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ def link_to_user(display_name)
)
end

def message_body(&block)
def message_body(&)
render(
:partial => "message_body",
:locals => { :body => capture(&block) }
:locals => { :body => capture(&) }
)
end

Expand Down
4 changes: 2 additions & 2 deletions app/mailers/user_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,8 @@ def user_avatar_file(user)
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)
Expand Down
Loading

0 comments on commit 5720968

Please sign in to comment.