bin/sandbox in super_good-solidus_taxjar-0.18.2 vs bin/sandbox in super_good-solidus_taxjar-1.0.0

- old
+ new

@@ -1,60 +1,67 @@ #!/usr/bin/env bash - set -e +test -z "${DEBUG+empty_string}" || set -x -case "$DB" in -postgres|postgresql) - RAILSDB="postgresql" - ;; -mysql) - RAILSDB="mysql" - ;; -sqlite|'') - RAILSDB="sqlite3" - ;; -*) - echo "Invalid DB specified: $DB" - exit 1 - ;; -esac +test "$DB" = "sqlite" && export DB="sqlite3" -if [ ! -z $SOLIDUS_BRANCH ] +if [ -z "$PAYMENT_METHOD" ] then - BRANCH=$SOLIDUS_BRANCH -else - BRANCH="master" + PAYMENT_METHOD="none" fi +if [ -z "$SOLIDUS_BRANCH" ] +then + echo "~~> Use 'export SOLIDUS_BRANCH=[main|v4.0|...]' to control the Solidus branch" + SOLIDUS_BRANCH="main" +fi +echo "~~> Using branch $SOLIDUS_BRANCH of solidus" + +case $SOLIDUS_BRANCH in + v3* | v4.0* | v4.1*) + echo "~~> Using a SOLIDUS_BRANCH older than v4.2. Skipping the --admin-preview flag for compatibility." + ADMIN_PREVIEW_FLAG=" " + ;; + *) + ADMIN_PREVIEW_FLAG="--admin-preview=false" + ;; +esac + extension_name="super_good-solidus_taxjar" # 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 --database="$RAILSDB" \ - --skip-bundle \ + +echo "~~~> Creating a pristine Rails app" +rails new sandbox \ + --database="${DB:-sqlite3}" \ --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 <<RUBY >> Gemfile -gem 'solidus', github: 'solidusio/solidus', branch: '$BRANCH' -gem 'solidus_auth_devise', '>= 2.1.0' +gem 'solidus', github: 'solidusio/solidus', branch: '$SOLIDUS_BRANCH' gem 'rails-i18n' gem 'solidus_i18n' +gem 'solidus_auth_devise' +gem "solidus_frontend" gem '$extension_name', path: '..' group :test, :development do platforms :mri do @@ -65,20 +72,20 @@ unbundled bundle install --gemfile Gemfile unbundled bundle exec rake db:drop db:create -unbundled bundle exec rails generate spree:install \ +unbundled bundle exec rails generate solidus:install \ --auto-accept \ - --user_class=Spree::User \ - --enforce_available_locales=true \ - --with-authentication=false \ + --payment-method=none \ + --frontend=none \ + ${ADMIN_PREVIEW_FLAG} \ $@ -unbundled bundle exec rails generate solidus:auth:install +SKIP_SOLIDUS_BOLT=true unbundled bundle exec rails generate solidus_frontend:install --auto-accept +unbundled bundle exec rails generate solidus:auth:install --auto-run-migrations +unbundled bundle exec rails generate super_good:solidus_taxjar:install --auto-run-migrations echo 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." +echo "๐Ÿงช This app is intended for test purposes."