Skip to content

Commit

Permalink
Drop support for ruby 3.0
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tomhughes committed Aug 26, 2024
1 parent a45467d commit ab044bf
Show file tree
Hide file tree
Showing 18 changed files with 35 additions and 38 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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:22.04
FROM ubuntu:24.04

ENV DEBIAN_FRONTEND=noninteractive

Expand Down
5 changes: 1 addition & 4 deletions Gemfile
Original file line number Diff line number Diff line change
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
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -671,7 +672,6 @@ DEPENDENCIES
mini_racer (~> 0.9.0)
minitest (~> 5.1)
minitest-focus
multi_xml (~> 0.6.0)
oauth-plugin (>= 0.5.1)
omniauth (~> 2.0.2)
omniauth-facebook
Expand Down
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
4 changes: 2 additions & 2 deletions app/controllers/api_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,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 @@ -219,8 +219,8 @@ def set_locale

##
# wrap a web page in a timeout
def web_timeout(&block)
Timeout.timeout(Settings.web_timeout, &block)
def web_timeout(&)
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
4 changes: 2 additions & 2 deletions app/models/client_application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ def self.find_token(token_key)
token if token&.authorized?
end

def self.verify_request(request, options = {}, &block)
signature = OAuth::Signature.build(request, options, &block)
def self.verify_request(request, options = {}, &)
signature = OAuth::Signature.build(request, options, &)
return false unless OauthNonce.remember(signature.request.nonce, signature.request.timestamp)

signature.verify
Expand Down
6 changes: 3 additions & 3 deletions config/initializers/oauth.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,16 @@ def self.skip_before_filter(...)
end

module OAuthFilter
def oauth1_verify(request, options = {}, &block)
signature = OAuth::Signature.build(request, options, &block)
def oauth1_verify(request, options = {}, &)
signature = OAuth::Signature.build(request, options, &)
return false unless OauthNonce.remember(signature.request.nonce, signature.request.timestamp)

value = signature.verify
if request.ssl? && !value
http_request = request.dup
http_request.define_singleton_method(:scheme) { "http" }
http_request.define_singleton_method(:port) { 80 }
signature = OAuth::Signature.build(http_request, options, &block)
signature = OAuth::Signature.build(http_request, options, &)
value = signature.verify
end
value
Expand Down
2 changes: 1 addition & 1 deletion lib/classic_pagination/pagination.rb
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ def [](number)
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
Expand Down
4 changes: 2 additions & 2 deletions test/application_system_test_case.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def sign_out
click_on "Logout", :match => :first
end

def within_sidebar(&block)
within "#sidebar_content", &block
def within_sidebar(&)
within("#sidebar_content", &)
end
end
8 changes: 4 additions & 4 deletions test/integration/client_applications_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ def test_3rd_party_token

##
# utility method to make the HTML screening easier to read.
def assert_in_heading(&block)
assert_select("div.content-heading", &block)
def assert_in_heading(&)
assert_select("div.content-heading", &)
end

##
# utility method to make the HTML screening easier to read.
def assert_in_body(&block)
assert_select("div#content", &block)
def assert_in_body(&)
assert_select("div#content", &)
end
end
4 changes: 2 additions & 2 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -376,10 +376,10 @@ def with_settings(settings)
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
Expand Down

0 comments on commit ab044bf

Please sign in to comment.