Skip to content

Commit

Permalink
Goal
Browse files Browse the repository at this point in the history
----

As a solidus_starter_frontend contributor
I want the gem's sandbox script to generate the app with the solidus_starter_frontend gem as an engine
So that the app would pick up changes I make to the app code

Background
----------

Currently, the sandbox script both loads the gem and runs its generator. We want it to only the load the gem.

Previous implementations
------------------------

* [Document how to run the extension as an engine in a Rails app](a4600e2) - This commit documents how to install solidus_starter_frontend as an engine.
* Fix sandbox script #166 - This PR fixed the script to run `solidus_starter_frontend`  as a generator instead of as a gem.

Relevant links
--------------

#167 (comment) - discussion on having two strategies for generating the sandbox app: one with the Starter FE running as an engine and other where Starter FE is generated into the app.

Implementation
--------------

* Point solidus gems in sandbox Gemfile to those in
solidus_starter_frontend's Gemfile.

* Fix: Install solidus using `solidus:install` instead of
`spree:install`.

* Fix: Pass `--auto-run-migrations` instead of `--auto-accept` to
`solidus:auth:install`.

* Remove `solidus_starter_frontend` call.

* Call `bundle exec rails g solidus_starter_frontend:install`.
  • Loading branch information
gsmendoza committed Jul 20, 2021
1 parent 09537bf commit 1f90a92
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions bin/sandbox
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,19 @@ cat <<RUBY >> Gemfile
# By default, the solidus gem also includes the standard frontend via
# the solidus_frontend gem. To make this extension work, you need to
# exclude it and manually include all the other Solidus components.
gem 'solidus_core'
gem 'solidus_api'
gem 'solidus_backend'
gem 'solidus_sample'
solidus_repo = ENV.fetch('SOLIDUS_REPO', 'solidusio/solidus')
solidus_branch = ENV.fetch('SOLIDUS_BRANCH', 'master')
solidus_i18n_repo = ENV.fetch('SOLIDUS_I18N_REPO', 'solidusio/solidus_i18n')
solidus_i18n_branch = ENV.fetch('SOLIDUS_I18N_BRANCH', 'master')
gem 'solidus_core', github: solidus_repo, branch: solidus_branch
gem 'solidus_api', github: solidus_repo, branch: solidus_branch
gem 'solidus_backend', github: solidus_repo, branch: solidus_branch
gem 'solidus_sample', github: solidus_repo, branch: solidus_branch
gem 'solidus_i18n', github: solidus_i18n_repo, branch: solidus_i18n_branch
gem 'rails-i18n'
gem 'solidus_i18n'
gem '$extension_name', path: '..'
gem 'solidus_auth_devise'
RUBY
Expand Down Expand Up @@ -93,16 +100,16 @@ unbundled bundle install --gemfile Gemfile

unbundled bundle exec rake db:drop db:create

unbundled bundle exec rails generate spree:install \
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 --auto-accept
unbundled bundle exec rails generate ${extension_name}:install --auto-accept
unbundled bundle exec rails generate solidus:auth:install --auto-run-migrations
unbundled bundle exec rails g solidus_starter_frontend:install

echo
echo "🚀 Sandbox app successfully created for $extension_name!"
Expand Down

0 comments on commit 1f90a92

Please sign in to comment.