Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop support for Ruby 3.1 #8513

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ jobs:
fail-fast: false
matrix:
include:
- { ruby: '3.1', postgres: 13.5 }
- { ruby: '3.2', postgres: 13.5 }

services:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1
ruby-version: 3.2

- name: Run RuboCop linter
uses: reviewdog/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion .ruby-style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ require:
- "./lib/custom_cops/empty_lines_around_rescued_exceptions.rb"

AllCops:
TargetRubyVersion: 3.1
TargetRubyVersion: 3.2
RubyInterpreters:
- ruby
- rake
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version.example
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.6
3.2.6
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,9 @@ see [the project website](http://alaveteli.org) for instructions on installing A

Every Alaveteli commit is tested by GitHub Actions on the [following Ruby platforms](https://github.com/mysociety/alaveteli/blob/develop/.github/workflows/ci.yml#L27-L29)

* ruby-3.1
* ruby-3.2

If you use a ruby version management tool (such as RVM or .rbenv) and want to use the default development version used by the Alaveteli team (currently 3.1.6), you can create a `.ruby-version` symlink with a target of `.ruby-version.example` to switch to that automatically in the project directory.
If you use a ruby version management tool (such as RVM or .rbenv) and want to use the default development version used by the Alaveteli team (currently 3.2.6), you can create a `.ruby-version` symlink with a target of `.ruby-version.example` to switch to that automatically in the project directory.

## How to contribute

Expand Down
6 changes: 1 addition & 5 deletions app/controllers/refusal_advice_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,11 @@ def refusal_advice_params
end

def parsed_refusal_advice_params
parsed_params = refusal_advice_params.merge(
refusal_advice_params.merge(
actions: refusal_advice_params.fetch(:actions).
each_pair do |_, suggestions|
suggestions.transform_values! { |v| v == 'true' }
end
).to_h

return parsed_params.deep_symbolize_keys if RUBY_VERSION < '3.0'

parsed_params
end
end
20 changes: 8 additions & 12 deletions app/models/post_redirect.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,14 @@ def post_params=(params)
def post_params
return {} if post_params_yaml.nil?

if RUBY_VERSION < "3.1"
YAML.load(post_params_yaml)
else
YAML.load(
post_params_yaml,
permitted_classes: [
ActionController::Parameters,
ActiveSupport::HashWithIndifferentAccess,
Symbol
]
)
end
YAML.load(
post_params_yaml,
permitted_classes: [
ActionController::Parameters,
ActiveSupport::HashWithIndifferentAccess,
Symbol
]
)
end

# We store YAML version of textual "reason for redirect" parameters
Expand Down
6 changes: 1 addition & 5 deletions config/routes/redirects.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@
encoded_parts = [
*params[:locale], 'request', info_request.url_title, *prefix, *suffix
].map do |part|
if RUBY_VERSION < '3.1'
URI.encode_www_form_component(part).gsub('+', '%20')
else
URI.encode_uri_component(part)
end
URI.encode_uri_component(part)
end

# join encoded parts together with slashes
Expand Down
10 changes: 10 additions & 0 deletions doc/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# develop

## Highlighted Features

* Drop support for Ruby 3.1 (Graeme Porteous)

## Upgrade Notes

* _Required:_ This upgrade requires upgrading Ruby from 3.1 to 3.2 or later.

# 0.45.0.0

## Highlighted Features
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
context: .
dockerfile: docker/Dockerfile
args:
RUBY_VERSION: '${RUBY_VERSION:-3.1}'
RUBY_VERSION: '${RUBY_VERSION:-3.2}'
tty: true
stdin_open: true
environment:
Expand All @@ -30,7 +30,7 @@ services:
context: .
dockerfile: docker/Dockerfile
args:
RUBY_VERSION: '${RUBY_VERSION:-3.1}'
RUBY_VERSION: '${RUBY_VERSION:-3.2}'
command: bundle exec sidekiq
volumes:
- ./:/alaveteli
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG RUBY_VERSION=3.1
ARG RUBY_VERSION=3.2
FROM ruby:${RUBY_VERSION}-bullseye

ENV DOCKER 1
Expand Down
1 change: 1 addition & 0 deletions gems/alaveteli_features/alaveteli_features.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Gem::Specification.new do |spec|
spec.summary = "Helper methods to manage and test Alaveteli features"
spec.homepage = "https://alaveteli.org"
spec.license = "MIT"
spec.required_ruby_version = ">= 3.2.0"

spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
Expand Down
2 changes: 1 addition & 1 deletion gems/excel_analyzer/excel_analyzer.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
spec.summary = "File analysers for ActiveStorage"
spec.description = "Extra ActiveStorage Analysers for Alaveteli"
spec.homepage = "https://alaveteli.org"
spec.required_ruby_version = ">= 3.1.0"
spec.required_ruby_version = ">= 3.2.0"

spec.metadata["homepage_uri"] = spec.homepage

Expand Down
8 changes: 4 additions & 4 deletions lib/tasks/config_files.rake
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace :config_files do
cpus: ENV.fetch('CPUS') { '1' },
mailto: ENV.fetch('MAILTO') { "#{ ENV['DEPLOY_USER'] }@localhost" },
rails_env: ENV.fetch('RAILS_ENV') { 'development' },
ruby_version: ENV.fetch('RUBY_VERSION') { '3.1.6' },
ruby_version: ENV.fetch('RUBY_VERSION') { '3.2.6' },
site: ENV.fetch('SITE') { 'foi' },
user: ENV.fetch('DEPLOY_USER') { 'alaveteli' },
vcspath: ENV.fetch('VCSPATH') { 'alaveteli' },
Expand Down Expand Up @@ -123,7 +123,7 @@ namespace :config_files do
'VCSPATH=alaveteli ' \
'SITE=alaveteli ' \
'SCRIPT_FILE=config/sysvinit-thin.example ' \
'RUBY_VERSION=3.1.6 ' \
'RUBY_VERSION=3.2.6 ' \
'USE_RBENV=false '
check_for_env_vars(%w[DEPLOY_USER VHOST_DIR SCRIPT_FILE], example)

Expand All @@ -147,7 +147,7 @@ namespace :config_files do
'VCSPATH=alaveteli ' \
'SITE=alaveteli ' \
'DAEMON=alert-tracks.service ' \
'RUBY_VERSION=3.1.6 ' \
'RUBY_VERSION=3.2.6 ' \
'USE_RBENV=false '
check_for_env_vars(%w[DEPLOY_USER VHOST_DIR DAEMON], example)

Expand All @@ -167,7 +167,7 @@ namespace :config_files do
'VHOST_DIR=/dir/above/alaveteli VCSPATH=alaveteli ' \
'SITE=alaveteli CRONTAB=config/crontab-example ' \
'[email protected] ' \
'RUBY_VERSION=3.1.6 ' \
'RUBY_VERSION=3.2.6 ' \
'USE_RBENV=false '
check_for_env_vars(%w[DEPLOY_USER VHOST_DIR VCSPATH SITE CRONTAB], example)
convert_erb(ENV['CRONTAB'], **default_replacements)
Expand Down
6 changes: 1 addition & 5 deletions script/update-rubocop-config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,7 @@ def default_config

File.write(tmp_path, Net::HTTP.get(uri)) unless File.exist?(tmp_path)

if RUBY_VERSION < "3.1"
yaml = YAML.load_file(tmp_path)
else
yaml = YAML.load_file(tmp_path, permitted_classes: [Regexp, Symbol])
end
yaml = YAML.load_file(tmp_path, permitted_classes: [Regexp, Symbol])

m.deep_merge!(yaml)
end
Expand Down
Loading