Skip to content

Commit

Permalink
Merge pull request #5891 from tvdeyen/ruby-3.1
Browse files Browse the repository at this point in the history
Bump minimum Ruby version to 3.1
  • Loading branch information
tvdeyen authored Oct 31, 2024
2 parents b099358 + a9c88c9 commit f4c1cee
Show file tree
Hide file tree
Showing 402 changed files with 1,455 additions and 1,415 deletions.
68 changes: 52 additions & 16 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ executors:
parameters: &parameters
ruby:
type: string
default: "3.0"
default: "3.1"
working_directory: &workdir ~/solidus
environment: &environment
DEFAULT_MAX_WAIT_TIME: 10
Expand Down Expand Up @@ -192,10 +192,10 @@ commands:
parameters:
app_root:
type: string
default: '/tmp/my_app'
default: "/tmp/my_app"
path:
type: string
default: '/'
default: "/"
expected_text:
type: string

Expand Down Expand Up @@ -240,7 +240,7 @@ jobs:
ESLINT_USE_FLAT_CONFIG: false
steps:
- checkout
- run: 'bundle install'
- run: "bundle install"
- run:
name: Check Ruby
command: "bin/rake lint:rb"
Expand Down Expand Up @@ -291,7 +291,7 @@ jobs:
default: postgres
ruby:
type: string
default: '3.2'
default: "3.2"
rails:
type: string
default: "7.1"
Expand Down Expand Up @@ -327,28 +327,28 @@ jobs:
default: postgres
ruby:
type: string
default: '3.2'
default: "3.2"
executor:
name: << parameters.database >>
ruby: << parameters.ruby >>
parallelism: 3
environment:
COVERAGE: 'true'
COVERAGE: "true"
COVERAGE_DIR: /tmp/coverage
DISABLE_ACTIVE_STORAGE: false
steps:
- setup
- run:
name: Setup Coverage Env Vars
command: |
echo 'export COVERAGE_FILE=/tmp/coverage/coverage.xml' >> $BASH_ENV
source $BASH_ENV
echo 'export COVERAGE_FILE=/tmp/coverage/coverage.xml' >> $BASH_ENV
source $BASH_ENV
- run:
name: Verify Coverage Env Vars
command: |
echo $COVERAGE
echo /tmp/coverage
echo /tmp/coverage/coverage.xml
echo $COVERAGE
echo /tmp/coverage
echo /tmp/coverage/coverage.xml
- run:
name: Setup Coverage Directory
command: mkdir -p /tmp/coverage
Expand All @@ -370,13 +370,49 @@ workflows:
# https://www.fastruby.io/blog/ruby/rails/versions/compatibility-table.html.
- test_solidus:
name: &name "test-rails-<<matrix.rails>>-ruby-<<matrix.ruby>>-<<matrix.database>>-<<#matrix.paperclip>>paperclip<</matrix.paperclip>><<^matrix.paperclip>>activestorage<</matrix.paperclip>>"
matrix: { parameters: { rails: ['7.0', '7.1'], ruby: ['3.0'], database: ['mysql'], paperclip: [true] } }
matrix:
{
parameters:
{
rails: ["7.0", "7.1"],
ruby: ["3.1"],
database: ["mysql"],
paperclip: [true],
},
}
- test_solidus:
name: *name
matrix: { parameters: { rails: ['7.0', '7.1'], ruby: ['3.1'], database: ['postgres'], paperclip: [false] } }
matrix:
{
parameters:
{
rails: ["7.0", "7.1"],
ruby: ["3.1"],
database: ["postgres"],
paperclip: [false],
},
}
- test_solidus:
name: *name
matrix: { parameters: { rails: ['7.0'], ruby: ['3.2'], database: ['sqlite'], paperclip: [false] } }
matrix:
{
parameters:
{
rails: ["7.0"],
ruby: ["3.2"],
database: ["sqlite"],
paperclip: [false],
},
}
- test_solidus:
name: *name
matrix: { parameters: { rails: ['7.1', 'main'], ruby: ['3.3.2'], database: ['sqlite'], paperclip: [false] } }
matrix:
{
parameters:
{
rails: ["7.1", "main"],
ruby: ["3.3.2"],
database: ["sqlite"],
paperclip: [false],
},
}
4 changes: 4 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
989ba2e74e49332d2281187d09a2dc7aad75922a
# Rubocop auto (Mar 8, 2018)
b3007bb0973dcb987b0328b4e59306cd2549148d
# Autocorrect circle/config.yml with prettier (Sep 12, 2024)
c636624093fec55e38f14cade4dee4ec0a829802
# Rubocop: Autocorrect (Sep 12, 2024)
273e5bd54e2b1783206043e316c2de4c9e95eb45
32 changes: 16 additions & 16 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ require:

AllCops:
Exclude:
- '**/{tmp,vendor,spec/dummy,sandbox,templates,pkg}/**/*'
TargetRubyVersion: 3.0
- "**/{tmp,vendor,spec/dummy,sandbox,templates,pkg}/**/*"
TargetRubyVersion: 3.1
NewCops: disable
SuggestExtensions: false

Expand Down Expand Up @@ -121,7 +121,7 @@ Rails/DynamicFindBy:
# It's okay to skip model validations to setup a spec.
Rails/SkipsModelValidations:
Exclude:
- '*/spec/**/*'
- "*/spec/**/*"

# We use a lot of
#
Expand All @@ -132,15 +132,15 @@ Rails/SkipsModelValidations:
# syntax in the specs files.
Lint/AmbiguousBlockAssociation:
Exclude:
- '*/spec/**/*'
- 'spec/**/*' # For the benefit of apps that inherit from this config
- "*/spec/**/*"
- "spec/**/*" # For the benefit of apps that inherit from this config

# We use eval to add common_spree_dependencies into the Gemfiles of each of our gems
Security/Eval:
Exclude:
- 'Gemfile'
- 'common_spree_dependencies.rb'
- '*/Gemfile'
- "Gemfile"
- "common_spree_dependencies.rb"
- "*/Gemfile"

Naming/VariableNumber:
Enabled: false
Expand Down Expand Up @@ -306,10 +306,10 @@ Style/FrozenStringLiteralComment:
Enabled: true
EnforcedStyle: always
Exclude:
- '*/lib/generators/**/*'
- '**/bin/**/*'
- '*/db/migrate/**/*'
- '*/config/importmap.rb'
- "*/lib/generators/**/*"
- "**/bin/**/*"
- "*/db/migrate/**/*"
- "*/config/importmap.rb"

# json.() is idiomatic in jbuilder files
Style/LambdaCall:
Expand All @@ -333,13 +333,13 @@ Lint/SuppressedException:

Lint/MissingSuper:
Exclude:
- '*/app/components/**/*' # components need pristine initializer methods
- 'core/lib/spree/deprecated_instance_variable_proxy.rb' # this is a known class that doesn't require super
- 'core/lib/spree/preferences/configuration.rb' # this class has no superclass defining `self.inherited`
- "*/app/components/**/*" # components need pristine initializer methods
- "core/lib/spree/deprecated_instance_variable_proxy.rb" # this is a known class that doesn't require super
- "core/lib/spree/preferences/configuration.rb" # this class has no superclass defining `self.inherited`

Rails/FindEach:
Exclude:
- 'db/migrate/**/*'
- "db/migrate/**/*"

# Since we're writing library code we can't assume that
# tasks should load the rails environment loaded.
Expand Down
2 changes: 1 addition & 1 deletion admin/app/components/solidus_admin/base_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class BaseComponent < ViewComponent::Base
include Turbo::FramesHelper

def icon_tag(name, **attrs)
render component("ui/icon").new(name: name, **attrs)
render component("ui/icon").new(name:, **attrs)
end

def missing_translation(key, options)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def initialize(user_label:, account_path:, logout_path:, logout_method:)
def locale_options_for_select(available_locales)
available_locales.map do |locale|
[
t("spree.i18n.this_file_language", locale: locale, default: locale.to_s, fallback: false),
t("spree.i18n.this_file_language", locale:, default: locale.to_s, fallback: false),
locale,
]
end.sort
Expand All @@ -27,7 +27,7 @@ def autosubmit_select_tag(name, options, icon:, &block)
block_given? ? capture(&block) : nil,
tag.label(safe_join([
icon_tag(icon, class: "w-full max-w-[20px] h-5 fill-current shrink"),
tag.select(options, name: name, onchange: "this.form.requestSubmit()", class: "w-full appearance-none grow bg-transparent outline-none"),
tag.select(options, name:, onchange: "this.form.requestSubmit()", class: "w-full appearance-none grow bg-transparent outline-none"),
icon_tag("expand-up-down-line", class: "w-full max-w-[20px] h-5 fill-current shrink"),
]), class: "flex gap-2 items-center px-2"),
])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def initialize(
@logo_path = logo_path
@items = items.map do |attrs|
children = attrs[:children].to_a.map { SolidusAdmin::MenuItem.new(**_1, top_level: false) }
SolidusAdmin::MenuItem.new(**attrs, children: children, top_level: true)
SolidusAdmin::MenuItem.new(**attrs, children:, top_level: true)
end
@store = store
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def state_column
'canceled' => :blue,
'cart' => :graphite_light,
}[order.state] || :yellow
component('ui/badge').new(name: order.state.humanize, color: color)
component('ui/badge').new(name: order.state.humanize, color:)
end
}
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def initialize(adjustment)
end

def call
render component("ui/thumbnail_with_caption").new(caption: caption, detail: detail) do
render component("ui/thumbnail_with_caption").new(caption:, detail:) do
thumbnail
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def initialize(adjustment)
end

def call
render component("ui/thumbnail_with_caption").new(icon: icon, caption: caption, detail: detail)
render component("ui/thumbnail_with_caption").new(icon:, caption:, detail:)
end

def caption
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def self.from_product(product)
:unavailable
end

new(status: status)
new(status:)
end

def initialize(status:)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def stock_movements_column
count = stock_movement_counts[_1.id] || 0

link_to(
"#{count} #{Spree::StockMovement.model_name.human(count: count).downcase}",
"#{count} #{Spree::StockMovement.model_name.human(count:).downcase}",
spree.admin_stock_location_stock_movements_path(
_1.stock_location.id,
q: { variant_sku_eq: _1.variant.sku },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def columns
color = _1.active? ? :green : :graphite_light
text = _1.active? ? t('.active') : t('.inactive')

component('ui/badge').new(name: text, color: color)
component('ui/badge').new(name: text, color:)
},
},
{
Expand All @@ -78,7 +78,7 @@ def columns
count = _1.stock_movements.count

link_to(
"#{count} #{Spree::StockMovement.model_name.human(count: count).downcase}",
"#{count} #{Spree::StockMovement.model_name.human(count:).downcase}",
spree.admin_stock_location_stock_movements_path(_1),
class: 'body-link'
)
Expand Down
34 changes: 17 additions & 17 deletions admin/app/components/solidus_admin/ui/forms/field/component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ def self.text_field(form, method, object: nil, hint: nil, tip: nil, size: :m, **
object_name, object, label, errors = extract_form_details(form, object, method)

new(
label: label,
hint: hint,
tip: tip,
label:,
hint:,
tip:,
error: errors,
input_attributes: {
name: "#{object_name}[#{method}]",
tag: :input,
size: size,
size:,
value: object.public_send(method),
error: (errors.to_sentence.capitalize if errors),
**attributes,
Expand All @@ -37,15 +37,15 @@ def self.select(form, method, choices, object: nil, hint: nil, tip: nil, size: :
object_name, object, label, errors = extract_form_details(form, object, method)

new(
label: label,
hint: hint,
tip: tip,
label:,
hint:,
tip:,
error: errors,
input_attributes: {
name: "#{object_name}[#{method}]",
tag: :select,
choices: choices,
size: size,
choices:,
size:,
value: object.public_send(method),
error: (errors.to_sentence.capitalize if errors),
**attributes,
Expand All @@ -57,13 +57,13 @@ def self.text_area(form, method, object: nil, hint: nil, tip: nil, size: :m, **a
object_name, object, label, errors = extract_form_details(form, object, method)

new(
label: label,
hint: hint,
tip: tip,
label:,
hint:,
tip:,
error: errors,
input_attributes: {
name: "#{object_name}[#{method}]",
size: size,
size:,
tag: :textarea,
value: object.public_send(method),
error: (errors.to_sentence.capitalize if errors),
Expand All @@ -76,14 +76,14 @@ def self.toggle(form, method, object: nil, hint: nil, tip: nil, size: :m, **attr
object_name, object, label, errors = extract_form_details(form, object, method)

new(
label: label,
hint: hint,
tip: tip,
label:,
hint:,
tip:,
error: errors,
).with_content(
component('ui/forms/switch').new(
name: "#{object_name}[#{method}]",
size: size,
size:,
checked: object.public_send(method),
include_hidden: true,
**attributes,
Expand Down
Loading

0 comments on commit f4c1cee

Please sign in to comment.