11#! /usr/bin/env bash
22
33set -e
4+ if [ ! -z $DEBUG ]
5+ then
6+ set -x
7+ fi
48
59case " $DB " in
610postgres|postgresql)
@@ -9,21 +13,36 @@ postgres|postgresql)
913mysql)
1014 RAILSDB=" mysql"
1115 ;;
12- sqlite|' ' )
16+ sqlite3|sqlite)
17+ RAILSDB=" sqlite3"
18+ ;;
19+ ' ' )
20+ echo " ~~> Use 'export DB=[postgres|mysql|sqlite]' to control the DB adapter"
1321 RAILSDB=" sqlite3"
1422 ;;
1523* )
16- echo " Invalid DB specified: $DB "
24+ echo " Invalid value specified for the Solidus sandbox: DB=\" $DB \" ."
25+ echo " Please use 'postgres', 'mysql', or 'sqlite' instead."
1726 exit 1
1827 ;;
1928esac
29+ echo " ~~> Using $RAILSDB as the database engine"
2030
21- if [ ! -z $SOLIDUS_BRANCH ]
31+ if [ -n $SOLIDUS_BRANCH ]
2232then
2333 BRANCH=$SOLIDUS_BRANCH
2434else
35+ echo " ~~> Use 'export SOLIDUS_BRANCH=[master|v3.2|...]' to control the Solidus branch"
2536 BRANCH=" master"
2637fi
38+ echo " ~~> Using branch $BRANCH of solidus"
39+
40+ if [ -z $SOLIDUS_FRONTEND ]
41+ then
42+ echo " ~~> Use 'export SOLIDUS_FRONTEND=[solidus_frontend|solidus_starter_frontend]' to control the Solidus frontend"
43+ SOLIDUS_FRONTEND=" solidus_frontend"
44+ fi
45+ echo " ~~> Using branch $SOLIDUS_FRONTEND as the solidus frontend"
2746
2847extension_name=" <%= file_name %>"
2948
5069cd ./sandbox
5170cat << RUBY >> Gemfile
5271gem ' solidus' , github: ' solidusio/solidus' , branch: ' $BRANCH'
53- gem ' solidus_auth_devise' , ' >= 2.1.0'
5472gem ' rails-i18n'
5573gem ' solidus_i18n'
5674
@@ -71,16 +89,14 @@ unbundled bundle exec rails generate solidus:install \
7189 --auto-accept \
7290 --user_class=Spree::User \
7391 --enforce_available_locales=true \
74- --with-authentication=false \
92+ --with-authentication=< %= file_name ! = ' solidus_auth_devise ' % > \
7593 --payment-method=none \
94+ --frontend=${SOLIDUS_FRONTEND} \
7695 $@
7796
78- unbundled bundle exec rails generate solidus:auth:install
79- unbundled bundle exec rails generate ${extension_name} :install
97+ unbundled bundle exec rails generate solidus:auth:install --auto-run-migrations
98+ unbundled bundle exec rails generate ${extension_name} :install --auto-run-migrations
8099
81100echo
82101echo " 🚀 Sandbox app successfully created for $extension_name !"
83- echo " 🚀 Using $RAILSDB and Solidus $BRANCH "
84- echo " 🚀 Use 'export DB=[postgres|mysql|sqlite]' to control the DB adapter"
85- echo " 🚀 Use 'export SOLIDUS_BRANCH=<BRANCH-NAME>' to control the Solidus version"
86- echo " 🚀 This app is intended for test purposes."
102+ echo " 🧪 This app is intended for test purposes."
0 commit comments