Skip to content
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
30 changes: 30 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
26 changes: 9 additions & 17 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -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).
Expand All @@ -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'
Expand Down Expand Up @@ -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
2 changes: 2 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
78 changes: 38 additions & 40 deletions bin/sandbox
Original file line number Diff line number Diff line change
@@ -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 <<EOF > sandbox/app/assets/config/manifest.js
//= link_tree ../images
//= link_directory ../javascripts .js
//= link_directory ../stylesheets .css
EOF

cd ./sandbox
cat <<RUBY >> 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=<BRANCH-NAME>' to control the Solidus version"
echo "🚀 This app is intended for test purposes."
3 changes: 2 additions & 1 deletion config/locales/en.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 2 additions & 1 deletion db/migrate/20191108162345_add_locale_to_friendly_id_slugs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion solidus_globalize.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
2 changes: 1 addition & 1 deletion spec/features/admin/products_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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