Sha256: b6e306a9bc0c339fe0a1bd3b84360afe192858ff01e6798c07cc57abe0465eee

Contents?: true

Size: 1.86 KB

Versions: 15

Compression:

Stored size: 1.86 KB

Contents

#!/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_bactracs"

# 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 solidus:install \
  --auto-accept \
  --user_class=Spree::User \
  --enforce_available_locales=true \
  --with-authentication=false \
  --payment-method=none \
  $@

unbundled bundle exec rails generate solidus:auth:install
unbundled bundle exec rails generate ${extension_name}: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."

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
solidus_bactracs-4.0.1 bin/sandbox
solidus_bactracs-4.0.0 bin/sandbox
solidus_bactracs-3.5.2 bin/sandbox
solidus_bactracs-3.5.1 bin/sandbox
solidus_bactracs-3.5.0 bin/sandbox
solidus_bactracs-3.4.0 bin/sandbox
solidus_bactracs-3.3.2 bin/sandbox
solidus_bactracs-3.3.1 bin/sandbox
solidus_bactracs-3.3.0 bin/sandbox
solidus_bactracs-3.2.2 bin/sandbox
solidus_bactracs-3.2.1 bin/sandbox
solidus_bactracs-3.2.0 bin/sandbox
solidus_bactracs-3.1.2 bin/sandbox
solidus_bactracs-3.1.1 bin/sandbox
solidus_bactracs-3.1.0 bin/sandbox