Sha256: 6c4cc48602b06fcfc08548b74a1cc69ecb89aba50a44c0dbe78e07841a65eec1

Contents?: true

Size: 1.98 KB

Versions: 2

Compression:

Stored size: 1.98 KB

Contents

#!/usr/bin/env bash

set -e
test -z "${DEBUG+empty_string}" || set -x

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

if [ -z "$SOLIDUS_BRANCH" ]
then
  echo "~~> Use 'export SOLIDUS_BRANCH=[main|v3.2|...]' to control the Solidus branch"
  SOLIDUS_BRANCH="main"
fi
echo "~~> Using branch $SOLIDUS_BRANCH of solidus"

if [ -z "$SOLIDUS_FRONTEND" ]
then
  echo "~~> Use 'export SOLIDUS_FRONTEND=[solidus_frontend|solidus_starter_frontend]' to control the Solidus frontend"
  SOLIDUS_FRONTEND="solidus_frontend"
fi
echo "~~> Using branch $SOLIDUS_FRONTEND as the solidus frontend"

extension_name="solidus_user_roles"

# 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="${DB:-sqlite3}" \
  --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: '$SOLIDUS_BRANCH'
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 solidus:install \
  --auto-accept \
  --user_class=Spree::User \
  --enforce_available_locales=true \
  --with-authentication=true \
  --payment-method=none \
  --frontend=${SOLIDUS_FRONTEND} \
  $@

unbundled bundle exec rails generate solidus:auth:install --auto-run-migrations
unbundled bundle exec rails generate ${extension_name}:install --auto-run-migrations

echo
echo "๐Ÿš€ Sandbox app successfully created for $extension_name!"
echo "๐Ÿงช This app is intended for test purposes."

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
solidus_user_roles-2.0.1 bin/sandbox
solidus_user_roles-2.0.0 bin/sandbox