From 0b72258767ac51f40aa62ec898888587c432a62d Mon Sep 17 00:00:00 2001 From: Martin Meyerhoff Date: Fri, 16 Jun 2023 11:45:58 +0200 Subject: [PATCH] Upgrade sandbox script template for recent Solidus versions The sandbox script has been updated in core, and this takes the changes from there and adds them to the bin/sandbox template. --- .../templates/extension/bin/sandbox.tt | 35 +++++++++---------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/lib/solidus_dev_support/templates/extension/bin/sandbox.tt b/lib/solidus_dev_support/templates/extension/bin/sandbox.tt index 10530b3c..5ec00fc4 100755 --- a/lib/solidus_dev_support/templates/extension/bin/sandbox.tt +++ b/lib/solidus_dev_support/templates/extension/bin/sandbox.tt @@ -5,43 +5,45 @@ test -z "${DEBUG+empty_string}" || set -x test "$DB" = "sqlite" && export DB="sqlite3" -if [ -z "$SOLIDUS_BRANCH" ] +if [ -z "$PAYMENT_METHOD" ] then - echo "~~> Use 'export SOLIDUS_BRANCH=[main|v3.2|...]' to control the Solidus branch" - SOLIDUS_BRANCH="main" + PAYMENT_METHOD="none" fi -echo "~~> Using branch $SOLIDUS_BRANCH of solidus" -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" + echo "~~> Use 'export SOLIDUS_BRANCH=[main|v4.0|...]' to control the Solidus branch" + SOLIDUS_BRANCH="main" fi -echo "~~> Using branch $SOLIDUS_FRONTEND as the solidus frontend" +echo "~~> Using branch $SOLIDUS_BRANCH of solidus" extension_name="<%= file_name %>" # 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' + Bundler.with_unbundled_env {system *ARGV}' -- \ + env BUNDLE_SUPPRESS_INSTALL_USING_MESSAGES=true $@ } +echo "~~~> Removing the old sandbox" rm -rf ./sandbox -unbundled bundle exec rails new sandbox \ + +echo "~~~> Creating a pristine Rails app" +rails new sandbox \ --database="${DB:-sqlite3}" \ - --skip-bundle \ --skip-git \ --skip-keeps \ --skip-rc \ - --skip-spring \ - --skip-test \ - --skip-javascript + --skip-bootsnap \ + --skip-test if [ ! -d "sandbox" ]; then echo 'sandbox rails application failed' exit 1 fi +echo "~~~> Adding solidus (with i18n) to the Gemfile" cd ./sandbox cat <> Gemfile gem 'solidus', github: 'solidusio/solidus', branch: '$SOLIDUS_BRANCH' @@ -63,11 +65,6 @@ 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=<%= file_name != 'solidus_auth_devise' %> \ - --payment-method=none \ - --frontend=${SOLIDUS_FRONTEND} \ $@ unbundled bundle exec rails generate solidus:auth:install --auto-run-migrations