Sha256: 4e14f796948c623ef160d515d3b34beed7516cc418d9de8efac5450b7df98be3

Contents?: true

Size: 1.71 KB

Versions: 2

Compression:

Stored size: 1.71 KB

Contents

#!/usr/bin/env bash

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

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

if [ -z "$PAYMENT_METHOD" ]
then
  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"

extension_name="<%= file_name %>"

# Stay away from the bundler env of the containing extension.
function unbundled {
  ruby -rbundler -e'
      Bundler.with_unbundled_env {system *ARGV}' -- \
        env BUNDLE_SUPPRESS_INSTALL_USING_MESSAGES=true $@
}

echo "~~~> Removing the old sandbox"
rm -rf ./sandbox

echo "~~~> Creating a pristine Rails app"
rails new sandbox \
  --database="${DB:-sqlite3}" \
  --skip-git \
  --skip-keeps \
  --skip-rc \
  --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: '$SOLIDUS_BRANCH'
gem 'rails-i18n'
gem 'solidus_i18n'
gem 'solidus_auth_devise'

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 \
  $@

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_dev_support-2.9.0 lib/solidus_dev_support/templates/extension/bin/sandbox.tt
solidus_dev_support-2.8.0 lib/solidus_dev_support/templates/extension/bin/sandbox.tt