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

Upgrade Ruby to version 3.1.4 #5157

Merged
merged 5 commits into from
Sep 12, 2023
Merged
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
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ stages:
- lint

tests:
image: "ruby:3.0.6"
image: "ruby:3.1.4"
stage: test
services:
- postgres:10.10
Expand Down Expand Up @@ -34,7 +34,7 @@ tests:
# PRONTO_GITLAB_API_PRIVATE_TOKEN to your repository CI/CD settings
# giving it the value of the Personal Access Token
linters:
image: "ruby:3.0.6"
image: "ruby:3.1.4"
stage: lint
cache:
key: consul
Expand Down
11 changes: 11 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,13 @@ Lint/UselessAssignment:
Lint/Void:
Enabled: true

Naming/BlockForwarding:
Enabled: true
Exclude:
- "app/controllers/application_controller.rb"
- "app/controllers/management/base_controller.rb"
- "app/controllers/subscriptions_controller.rb"

Naming/VariableName:
Enabled: true

Expand Down Expand Up @@ -620,6 +627,9 @@ Style/AndOr:
Style/ArrayCoercion:
Enabled: true

Style/ArrayIntersect:
Enabled: true

Style/BlockDelimiters:
Enabled: true

Expand All @@ -646,6 +656,7 @@ Style/HashExcept:

Style/HashSyntax:
Enabled: true
EnforcedShorthandSyntax: either

Style/HashTransformKeys:
Enabled: true
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.6
3.1.4
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ruby:3.0.6-buster
FROM ruby:3.1.4-buster

ENV DEBIAN_FRONTEND noninteractive

Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -784,4 +784,4 @@ DEPENDENCIES
wkhtmltopdf-binary (~> 0.12.6)

BUNDLED WITH
2.2.33
2.3.26
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ You can access the main website of the project at [http:https://consuldemocracy.org](h

**NOTE**: For more detailed instructions check the [docs](https://docs.consuldemocracy.org)

Prerequisites: install git, Ruby 3.0.6, CMake, pkg-config, shared-mime-info, Node.js and PostgreSQL (>=9.5).
Prerequisites: install git, Ruby 3.1.4, CMake, pkg-config, shared-mime-info, Node.js and PostgreSQL (>=9.5).

```bash
git clone https://github.com/consuldemocracy/consuldemocracy.git
Expand Down
2 changes: 1 addition & 1 deletion README_ES.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Puedes acceder a la página principal del proyecto en [http:https://consuldemocracy.or

**NOTA**: para unas instrucciones más detalladas consulta la [documentación](https://docs.consuldemocracy.org)

Prerequisitos: tener instalado git, Ruby 3.0.6, CMake, pkg-config, shared-mime-info, Node.js y PostgreSQL (9.5 o superior).
Prerequisitos: tener instalado git, Ruby 3.1.4, CMake, pkg-config, shared-mime-info, Node.js y PostgreSQL (9.5 o superior).

```bash
git clone https://github.com/consuldemocracy/consuldemocracy.git
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/stats_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def index

private

def daily_cache(key, &block)
Rails.cache.fetch("public_stats/#{Time.current.strftime("%Y-%m-%d")}/#{key}", &block)
def daily_cache(key, &)
Rails.cache.fetch("public_stats/#{Time.current.strftime("%Y-%m-%d")}/#{key}", &)
end
end
6 changes: 3 additions & 3 deletions app/graphql/types/base_object.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Types
class BaseObject < GraphQL::Schema::Object
def self.field(*args, **kwargs, &block)
super(*args, **kwargs, &block)
def self.field(*args, **kwargs, &)
super(*args, **kwargs, &)

# The old api contained non-camelized fields
# We want to support these for now, but throw a deprecation warning
Expand All @@ -14,7 +14,7 @@ def self.field(*args, **kwargs, &block)
if field_name.to_s.include?("_")
reason = "Snake case fields are deprecated. Please use #{field_name.to_s.camelize(:lower)}."
kwargs = kwargs.merge({ camelize: false, deprecation_reason: reason })
super(*args, **kwargs, &block)
super(*args, **kwargs, &)
end

# Make sure associations only return public records
Expand Down
4 changes: 2 additions & 2 deletions app/helpers/globalize_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def translation_enabled_tag(locale, enabled)
hidden_field_tag("enabled_translations[#{locale}]", (enabled ? 1 : 0))
end

def globalize(locale, &block)
Globalize.with_locale(locale, &block)
def globalize(locale, &)
Globalize.with_locale(locale, &)
end
end
14 changes: 7 additions & 7 deletions app/helpers/translatable_form_helper.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
module TranslatableFormHelper
def translatable_form_for(record, options = {}, &block)
form_for(record, options.merge(builder: TranslatableFormBuilder), &block)
def translatable_form_for(record, options = {}, &)
form_for(record, options.merge(builder: TranslatableFormBuilder), &)
end

def translations_interface_enabled?
Setting["feature.translation_interface"].present? || backend_translations_enabled?
end

def backend_translations_enabled?
(controller.class.module_parents & [Admin, Management, Valuation, SDGManagement]).any?
controller.class.module_parents.intersect?([Admin, Management, Valuation, SDGManagement])
end

def highlight_translation_html_class
Expand All @@ -18,13 +18,13 @@ def highlight_translation_html_class
class TranslatableFormBuilder < ConsulFormBuilder
attr_accessor :translations

def translatable_fields(&block)
def translatable_fields(&)
@translations = {}
visible_locales.map do |locale|
@translations[locale] = translation_for(locale)
end
safe_join(visible_locales.map do |locale|
Globalize.with_locale(locale) { fields_for_locale(locale, &block) }
Globalize.with_locale(locale) { fields_for_locale(locale, &) }
end)
end

Expand All @@ -46,8 +46,8 @@ def fields_for_locale(locale)
end
end

def fields_for_translation(translation, &block)
fields_for(:translations, translation, builder: TranslationsFieldsBuilder, &block)
def fields_for_translation(translation, &)
fields_for(:translations, translation, builder: TranslationsFieldsBuilder, &)
end

def translation_for(locale)
Expand Down
4 changes: 2 additions & 2 deletions app/mailers/mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ def already_confirmed(user)

private

def with_user(user, &block)
I18n.with_locale(user.locale, &block)
def with_user(user, &)
I18n.with_locale(user.locale, &)
end

def prevent_delivery_to_users_without_email
Expand Down
4 changes: 2 additions & 2 deletions app/models/budget/stats.rb
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def supports(supportable)

stats_cache(*stats_methods)

def stats_cache(key, &block)
Rails.cache.fetch("budgets_stats/#{budget.id}/#{phases.join}/#{key}/#{version}", &block)
def stats_cache(key, &)
Rails.cache.fetch("budgets_stats/#{budget.id}/#{phases.join}/#{key}/#{version}", &)
end
end
4 changes: 2 additions & 2 deletions app/models/poll/stats.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def total_unregistered_booth

stats_cache(*stats_methods)

def stats_cache(key, &block)
Rails.cache.fetch("polls_stats/#{poll.id}/#{key}/#{version}", &block)
def stats_cache(key, &)
Rails.cache.fetch("polls_stats/#{poll.id}/#{key}/#{version}", &)
end
end
2 changes: 1 addition & 1 deletion app/models/sdg/process_enabled.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ def module_name
def relatable?
return true if controller_path_name?

(SDG::Related::RELATABLE_TYPES & [record_or_name.class.name, record_or_name]).any?
SDG::Related::RELATABLE_TYPES.intersect?([record_or_name.class.name, record_or_name])
end
end
4 changes: 2 additions & 2 deletions app/models/tenant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ def self.switch(...)
Apartment::Tenant.switch(...)
end

def self.run_on_each(&block)
def self.run_on_each(&)
["public"].union(Apartment.tenant_names).each do |schema|
switch(schema, &block)
switch(schema, &)
end
end

Expand Down
2 changes: 1 addition & 1 deletion config/deploy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
lock "~> 3.17.1"

def deploysecret(key, default: "")
@deploy_secrets_yml ||= YAML.load_file("config/deploy-secrets.yml")[fetch(:stage).to_s]
@deploy_secrets_yml ||= YAML.load_file("config/deploy-secrets.yml", aliases: true)[fetch(:stage).to_s]
@deploy_secrets_yml.fetch(key.to_s, default)
end

Expand Down
1 change: 0 additions & 1 deletion config/puma/defaults.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
workers 2
preload_app!

restart_command "bundle exec --keep-file-descriptors puma"
plugin :tmp_restart

on_restart do
Expand Down
4 changes: 2 additions & 2 deletions lib/remote_translations/microsoft/available_locales.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def self.remote_available_locales
JSON.parse(result)["translation"].map(&:first)
end

def self.daily_cache(key, &block)
Rails.cache.fetch("remote_available_locales/#{Time.current.strftime("%Y-%m-%d")}/#{key}", &block)
def self.daily_cache(key, &)
Rails.cache.fetch("remote_available_locales/#{Time.current.strftime("%Y-%m-%d")}/#{key}", &)
end
end
4 changes: 2 additions & 2 deletions spec/sessions_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
def in_browser(name, &block)
Capybara.using_session(name, &block)
def in_browser(name, &)
Capybara.using_session(name, &)
end
Loading