Skip to content

Commit 0b72258

Browse files
committed
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.
1 parent 7da6101 commit 0b72258

1 file changed

Lines changed: 16 additions & 19 deletions

File tree

  • lib/solidus_dev_support/templates/extension/bin

lib/solidus_dev_support/templates/extension/bin/sandbox.tt

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,45 @@ test -z "${DEBUG+empty_string}" || set -x
55

66
test "$DB" = "sqlite" && export DB="sqlite3"
77

8-
if [ -z "$SOLIDUS_BRANCH" ]
8+
if [ -z "$PAYMENT_METHOD" ]
99
then
10-
echo "~~> Use 'export SOLIDUS_BRANCH=[main|v3.2|...]' to control the Solidus branch"
11-
SOLIDUS_BRANCH="main"
10+
PAYMENT_METHOD="none"
1211
fi
13-
echo "~~> Using branch $SOLIDUS_BRANCH of solidus"
1412

15-
if [ -z "$SOLIDUS_FRONTEND" ]
13+
if [ -z "$SOLIDUS_BRANCH" ]
1614
then
17-
echo "~~> Use 'export SOLIDUS_FRONTEND=[solidus_frontend|solidus_starter_frontend]' to control the Solidus frontend"
18-
SOLIDUS_FRONTEND="solidus_frontend"
15+
echo "~~> Use 'export SOLIDUS_BRANCH=[main|v4.0|...]' to control the Solidus branch"
16+
SOLIDUS_BRANCH="main"
1917
fi
20-
echo "~~> Using branch $SOLIDUS_FRONTEND as the solidus frontend"
18+
echo "~~> Using branch $SOLIDUS_BRANCH of solidus"
2119

2220
extension_name="<%= file_name %>"
2321

2422
# Stay away from the bundler env of the containing extension.
2523
function unbundled {
26-
ruby -rbundler -e'b = proc {system *ARGV}; Bundler.respond_to?(:with_unbundled_env) ? Bundler.with_unbundled_env(&b) : Bundler.with_clean_env(&b)' -- $@
24+
ruby -rbundler -e'
25+
Bundler.with_unbundled_env {system *ARGV}' -- \
26+
env BUNDLE_SUPPRESS_INSTALL_USING_MESSAGES=true $@
2727
}
2828

29+
echo "~~~> Removing the old sandbox"
2930
rm -rf ./sandbox
30-
unbundled bundle exec rails new sandbox \
31+
32+
echo "~~~> Creating a pristine Rails app"
33+
rails new sandbox \
3134
--database="${DB:-sqlite3}" \
32-
--skip-bundle \
3335
--skip-git \
3436
--skip-keeps \
3537
--skip-rc \
36-
--skip-spring \
37-
--skip-test \
38-
--skip-javascript
38+
--skip-bootsnap \
39+
--skip-test
3940

4041
if [ ! -d "sandbox" ]; then
4142
echo 'sandbox rails application failed'
4243
exit 1
4344
fi
4445

46+
echo "~~~> Adding solidus (with i18n) to the Gemfile"
4547
cd ./sandbox
4648
cat <<RUBY >> Gemfile
4749
gem 'solidus', github: 'solidusio/solidus', branch: '$SOLIDUS_BRANCH'
@@ -63,11 +65,6 @@ unbundled bundle exec rake db:drop db:create
6365

6466
unbundled bundle exec rails generate solidus:install \
6567
--auto-accept \
66-
--user_class=Spree::User \
67-
--enforce_available_locales=true \
68-
--with-authentication=<%= file_name != 'solidus_auth_devise' %> \
69-
--payment-method=none \
70-
--frontend=${SOLIDUS_FRONTEND} \
7168
$@
7269

7370
unbundled bundle exec rails generate solidus:auth:install --auto-run-migrations

0 commit comments

Comments
 (0)