Skip to content

Commit

Permalink
Discourage SolidusStarterFrontend from being ran as an engine
Browse files Browse the repository at this point in the history
  • Loading branch information
gsmendoza committed Jul 13, 2021
1 parent 08ad480 commit 50b84e3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# frozen_string_literal: true

require 'solidus_dev_support/rake_tasks'

ENV['SOLIDUS_STARTER_FRONTEND_ALLOW_AS_ENGINE'] = 'true'
SolidusDevSupport::RakeTasks.install

task default: 'extension:specs'
10 changes: 10 additions & 0 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,16 @@ bundle exec rails generate solidus:auth:install --auto-run-migrations
You will need to run `bundle exec rails g solidus_starter_frontend:install` to add the
frontend assets to the existing vendored Solidus manifest files.

#### 5) Run the server with `SOLIDUS_STARTER_FRONTEND_ALLOW_AS_ENGINE` enabled

We're strongly encouraging people to use `solidus_starter_frontend` as a
generator. Thus, if you want to run it as an engine, you'll need to set an
environment variable explicitly stating so:

```sh
SOLIDUS_STARTER_FRONTEND_ALLOW_AS_ENGINE=true rails server
```

### Updating the changelog
Before and after releases the changelog should be updated to reflect the
up-to-date status of the project:
Expand Down
2 changes: 2 additions & 0 deletions lib/solidus_starter_frontend/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class Engine < Rails::Engine
end

config.to_prepare do
raise 'Error: SolidusStarterFrontend is not allowed to run as an engine' unless ENV['SOLIDUS_STARTER_FRONTEND_ALLOW_AS_ENGINE']

if defined?(Spree::Auth::Engine)
[
Spree::UserConfirmationsController,
Expand Down
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# Configure Rails Environment
ENV['RAILS_ENV'] = 'test'
ENV['SOLIDUS_STARTER_FRONTEND_ALLOW_AS_ENGINE'] = 'true'

# Run Coverage report
require 'solidus_dev_support/rspec/coverage'
Expand Down

0 comments on commit 50b84e3

Please sign in to comment.