diff options
author | Alessandro Desantis <desa.alessandro@gmail.com> | 2020-06-13 17:22:13 +0200 |
---|---|---|
committer | Alessandro Desantis <desa.alessandro@gmail.com> | 2020-06-13 17:29:14 +0200 |
commit | 5b1b4c685e6baa5c6fa52ef2da479205f2c6e632 (patch) | |
tree | 863dfc0ba12468d3f9c02a72001d336b51225ee7 /bin/sandbox | |
parent | f0e6a42a0229f42b3ad42fbd157c958696388e2e (diff) |
Update to the latest solidus_dev_support
Diffstat (limited to 'bin/sandbox')
-rwxr-xr-x | bin/sandbox | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/bin/sandbox b/bin/sandbox new file mode 100755 index 0000000..6b848ab --- /dev/null +++ b/bin/sandbox @@ -0,0 +1,84 @@ +#!/usr/bin/env bash + +set -e + +case "$DB" in +postgres|postgresql) + RAILSDB="postgresql" + ;; +mysql) + RAILSDB="mysql" + ;; +sqlite|'') + RAILSDB="sqlite3" + ;; +*) + echo "Invalid DB specified: $DB" + exit 1 + ;; +esac + +if [ ! -z $SOLIDUS_BRANCH ] +then + BRANCH=$SOLIDUS_BRANCH +else + BRANCH="master" +fi + +extension_name="solidus_subscriptions" + +# 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)' -- $@ +} + +rm -rf ./sandbox +unbundled bundle exec rails new sandbox --database="$RAILSDB" \ + --skip-bundle \ + --skip-git \ + --skip-keeps \ + --skip-rc \ + --skip-spring \ + --skip-test \ + --skip-javascript + +if [ ! -d "sandbox" ]; then + echo 'sandbox rails application failed' + exit 1 +fi + +cd ./sandbox +cat <<RUBY >> Gemfile +gem 'solidus', github: 'solidusio/solidus', branch: '$BRANCH' +gem 'solidus_auth_devise', '>= 2.1.0' +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 exec rake db:drop db:create + +unbundled bundle exec rails generate spree:install \ + --auto-accept \ + --user_class=Spree::User \ + --enforce_available_locales=true \ + --with-authentication=false \ + $@ + +unbundled bundle exec rails generate solidus:auth:install + +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." |