diff --git a/.rubocop.yml b/.rubocop.yml index ed101ebf..3d7abd4d 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -3,5 +3,35 @@ inherit_from: .rubocop_todo.yml require: - solidus_dev_support/rubocop +FactoryBot/CreateList: + Enabled: false + +FactoryBot/AssociationStyle: + Enabled: false + +FactoryBot/FactoryNameStyle: + Enabled: false + +FactoryBot/ConsistentParenthesesStyle: + Enabled: false + +FactoryBot/FactoryClassName: + Enabled: false + +FactoryBot/RedundantFactoryOption: + Enabled: false + +Gemspec/RequiredRubyVersion: + Enabled: false + +Capybara/RSpec/PredicateMatcher: + Enabled: false + +Capybara/ClickLinkOrButtonStyle: + Enabled: false + +Capybara/NegationMatcher: + Enabled: false + AllCops: NewCops: disable diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index b47d97e1..9c8f42b8 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,22 +1,20 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2023-05-23 11:06:18 UTC using RuboCop version 1.51.0. +# on 2025-04-15 07:15:34 UTC using RuboCop version 1.74.0. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 1 -Capybara/VisibilityMatcher: +# Offense count: 28 +Capybara/AmbiguousClick: Exclude: - - 'spec/features/admin/products_spec.rb' + - 'spec/features/admin/translations_spec.rb' # Offense count: 1 -# Configuration parameters: Severity, Include. -# Include: **/*.gemspec -Gemspec/RequiredRubyVersion: +Capybara/VisibilityMatcher: Exclude: - - 'solidus_globalize.gemspec' + - 'spec/features/admin/products_spec.rb' # Offense count: 1 # This cop supports safe autocorrection (--autocorrect). @@ -27,8 +25,9 @@ Layout/ExtraSpacing: # Offense count: 1 # This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator. +# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator, EnforcedStyleForRationalLiterals. # SupportedStylesForExponentOperator: space, no_space +# SupportedStylesForRationalLiterals: space, no_space Layout/SpaceAroundOperators: Exclude: - 'app/models/concerns/solidus_globalize/translatable.rb' @@ -81,16 +80,9 @@ RSpec/NamedSubject: - 'spec/models/product_property_spec.rb' - 'spec/support/shared_contexts/translatable_context.rb' -# Offense count: 1 -# Configuration parameters: Include. -# Include: db/migrate/*.rb -Rails/NotNullColumn: - Exclude: - - 'db/migrate/20191108162345_add_locale_to_friendly_id_slugs.rb' - # Offense count: 2 # This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. +# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings. # URISchemes: http, https Layout/LineLength: Max: 128 diff --git a/LICENSE b/LICENSE index 0cb7db7d..0a256713 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,6 @@ Copyright (c) 2020 Solidus +Copyright (c) 2016-2025 Nebulab +Triodec, GMS and other contributors All rights reserved. Redistribution and use in source and binary forms, with or without modification, diff --git a/bin/sandbox b/bin/sandbox index 75a3890f..ecc41b5c 100755 --- a/bin/sandbox +++ b/bin/sandbox @@ -1,78 +1,76 @@ #!/usr/bin/env bash set -e -test -z "${DEBUG+empty_string}" || set -x -test "$DB" = "sqlite" && export DB="sqlite3" - -if [ -z "$SOLIDUS_BRANCH" ] -then - echo "~~> Use 'export SOLIDUS_BRANCH=[master|v3.2|...]' to control the Solidus branch" - SOLIDUS_BRANCH="master" -fi -echo "~~> Using branch $SOLIDUS_BRANCH of solidus" +case "$DB" in +postgres|postgresql) + RAILSDB="postgresql" + ;; +mysql) + RAILSDB="mysql" + ;; +sqlite|'') + RAILSDB="sqlite3" + ;; +*) + echo "Invalid DB specified: $DB" + exit 1 + ;; +esac -if [ -z "$SOLIDUS_FRONTEND" ] +if [ ! -z $SOLIDUS_BRANCH ] then - echo "~~> Use 'export SOLIDUS_FRONTEND=[solidus_frontend|solidus_starter_frontend]' to control the Solidus frontend" - SOLIDUS_FRONTEND="solidus_frontend" + BRANCH=$SOLIDUS_BRANCH +else + BRANCH="main" fi -echo "~~> Using branch $SOLIDUS_FRONTEND as the solidus frontend" extension_name="solidus_globalize" # Stay away from the bundler env of the containing extension. function unbundled { - ruby -rbundler -e'b = proc {system *ARGV}; Bundler.respond_to?(:with_unbundled_env) ? Bundler.with_unbundled_env(&b) : Bundler.with_clean_env(&b)' -- $@ + ruby -rbundler -e'b = proc {system *ARGV}; Bundler.respond_to?(:with_unbundled_env) ? Bundler.with_unbundled_env(&b) : Bundler.with_clean_env(&b)' -- "$@" } rm -rf ./sandbox -unbundled bundle exec rails new sandbox \ - --database="${DB:-sqlite3}" \ - --skip-bundle \ +rails new sandbox \ + --database="$RAILSDB" \ --skip-git \ - --skip-keeps \ --skip-rc \ - --skip-spring \ - --skip-test \ - --skip-javascript if [ ! -d "sandbox" ]; then echo 'sandbox rails application failed' exit 1 fi +# ๐Ÿ”ฅ Fix for Sprockets error: Ensure the manifest.js file exists +mkdir -p sandbox/app/assets/config +cat < sandbox/app/assets/config/manifest.js +//= link_tree ../images +//= link_directory ../javascripts .js +//= link_directory ../stylesheets .css +EOF + cd ./sandbox cat <> Gemfile -gem 'solidus', github: 'solidusio/solidus', branch: '$SOLIDUS_BRANCH' -gem 'rails-i18n' -gem 'solidus_i18n' - -gem '$extension_name', path: '..' - group :test, :development do platforms :mri do gem 'pry-byebug' end end RUBY - -unbundled bundle install --gemfile Gemfile - +unbundled bundle add solidus --github solidusio/solidus --branch "${BRANCH:-main}" --version '> 0.a' unbundled bundle exec rake db:drop db:create - unbundled bundle exec rails generate solidus:install \ --auto-accept \ - --user_class=Spree::User \ - --enforce_available_locales=true \ - --with-authentication=true \ --payment-method=none \ - --frontend=${SOLIDUS_FRONTEND} \ $@ - -unbundled bundle exec rails generate solidus:auth:install --auto-run-migrations -unbundled bundle exec rails generate ${extension_name}:install --auto-run-migrations +unbundled bundle add ${extension_name} --path '../' +unbundled bundle exec rails generate $extension_name:install --auto-run-migrations echo -echo "๐Ÿš€ Sandbox app successfully created for $extension_name!" -echo "๐Ÿงช This app is intended for test purposes." +echo "๐Ÿš€ Sandbox app successfully created for ${extension_name}!" +echo "๐Ÿš€ Using $RAILSDB and Solidus $BRANCH" +echo "๐Ÿš€ Use 'export DB=[postgres|mysql|sqlite]' to control the DB adapter" +echo "๐Ÿš€ Use 'export SOLIDUS_BRANCH=' to control the Solidus version" +echo "๐Ÿš€ This app is intended for test purposes." diff --git a/config/locales/en.yml b/config/locales/en.yml index 26f37031..22b98bd9 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1,6 +1,7 @@ en: spree: - back_to_resource_list: Back to resource list + back_to_resource_list: Back to %{resource} list + editing_resource: Editing %{resource} globalize: locales_displayed_on_translation_forms: Locales displayed on translation forms no_translations_for_criteria: There are no translations for given criteria diff --git a/db/migrate/20191108162345_add_locale_to_friendly_id_slugs.rb b/db/migrate/20191108162345_add_locale_to_friendly_id_slugs.rb index fbb186a7..4de374e4 100644 --- a/db/migrate/20191108162345_add_locale_to_friendly_id_slugs.rb +++ b/db/migrate/20191108162345_add_locale_to_friendly_id_slugs.rb @@ -2,7 +2,8 @@ class AddLocaleToFriendlyIdSlugs < SolidusSupport::Migration[4.2] def change - add_column :friendly_id_slugs, :locale, :string, length: 2, null: false, after: :scope + # Added default to prevent not null constraint violation. + add_column :friendly_id_slugs, :locale, :string, length: 2, default: 'en', null: false, after: :scope remove_index :friendly_id_slugs, [:slug, :sluggable_type] add_index :friendly_id_slugs, [:slug, :sluggable_type, :locale], diff --git a/lib/generators/solidus_globalize/install/install_generator.rb b/lib/generators/solidus_globalize/install/install_generator.rb index b17463e4..6f540f29 100644 --- a/lib/generators/solidus_globalize/install/install_generator.rb +++ b/lib/generators/solidus_globalize/install/install_generator.rb @@ -8,6 +8,7 @@ class InstallGenerator < Rails::Generators::Base def add_javascripts append_file "vendor/assets/javascripts/spree/backend/all.js", "//= require spree/backend/solidus_globalize\n" + empty_directory 'app/assets/javascripts' end def add_migrations diff --git a/solidus_globalize.gemspec b/solidus_globalize.gemspec index e743dcef..e0df910d 100644 --- a/solidus_globalize.gemspec +++ b/solidus_globalize.gemspec @@ -32,7 +32,7 @@ Gem::Specification.new do |s| s.add_dependency 'deface', '~> 1.5' s.add_dependency 'friendly_id-globalize' - s.add_dependency 'globalize', '~> 6.0' + s.add_dependency 'globalize', '~> 7.0' s.add_dependency 'solidus_core', ['>= 2.0.0', '< 5'] s.add_dependency 'solidus_support', '~> 0.8' diff --git a/spec/features/admin/products_spec.rb b/spec/features/admin/products_spec.rb index 285b88e0..4d7b4624 100644 --- a/spec/features/admin/products_spec.rb +++ b/spec/features/admin/products_spec.rb @@ -10,7 +10,7 @@ it "doesnt blow up" do visit spree.admin_products_path click_icon :copy - expect(page).to have_selector '.flash', text: 'Product has been cloned', visible: false + expect(page).to have_css '.flash', text: 'Product has been cloned', visible: false end end end