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

Allow Rails 7.2 #5843

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Draft
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
76 changes: 56 additions & 20 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 @@ -159,7 +159,7 @@ commands:
ruby -v >> /tmp/.ruby-versions
gem --version >> /tmp/.gems-versions
bundle --version >> /tmp/.gems-versions
gem search -eq rails -v "~> 7" -v "< 7.2" >> /tmp/.gems-versions # get the latest rails from rubygems
gem search -eq rails -v "~> 7" -v "< 8.0" >> /tmp/.gems-versions # get the latest rails from rubygems
gem search -eq solidus >> /tmp/.gems-versions # get the latest solidus from rubygems

cat /tmp/.ruby-versions
Expand All @@ -172,7 +172,7 @@ commands:
name: "Prepare the rails application"
command: |
cd /tmp
test -d my_app || (gem install rails -v "< 7.1" && gem install solidus)
test -d my_app || (gem install rails -v "< 8.0" && gem install solidus)
test -d my_app || rails new my_app --skip-git
- save_cache:
key: solidus-installer-v9-{{ checksum "/tmp/.ruby-versions" }}-{{ checksum "/tmp/.gems-versions" }}
Expand All @@ -191,10 +191,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 @@ -223,7 +223,7 @@ commands:
mkdir -p /tmp/dummy_extension
cd /tmp/dummy_extension
bundle init
bundle add rails -v "< 7.1" --skip-install
bundle add rails -v "< 8.0" --skip-install
bundle add sqlite3 -v "~> 1.3" --skip-install
test -n "<<parameters.extra_gems>>" && bundle add <<parameters.extra_gems>> --skip-install
bundle add solidus --path "$(ruby -e"puts File.expand_path ENV['CIRCLE_WORKING_DIRECTORY']")"
Expand All @@ -239,7 +239,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 All @@ -255,7 +255,7 @@ jobs:
solidus_installer:
executor:
name: sqlite
ruby: "3.0"
ruby: "3.1"
steps:
- checkout
- run:
Expand Down Expand Up @@ -292,7 +292,7 @@ jobs:
default: postgres
ruby:
type: string
default: '3.2'
default: "3.2"
rails:
type: string
default: "7.1"
Expand Down Expand Up @@ -328,28 +328,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 @@ -371,13 +371,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", "7.2"],
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", "7.2"],
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.1"],
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.2", "main"],
ruby: ["3.3.5"],
database: ["sqlite"],
paperclip: [false],
},
}
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 @@ -117,7 +117,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 @@ -68,7 +68,7 @@ def filters
{
label: option_type.presentation,
combinator: 'or',
attribute: "variants_option_values",
attribute: "option_values_id",
predicate: "in",
options: option_type.option_values.pluck(:name, :id),
}
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
Loading