solidusio / solidus

🛒 Solidus, the open-source eCommerce framework for industry trailblazers.
https://solidus.io
Other
4.97k stars 1.29k forks source link

`uninitialized constant Spree` when invoking `common:test_app` Rake task #1907

Closed bbuchalter closed 7 years ago

bbuchalter commented 7 years ago

I'm attempting to write a new Solidus extension but cannot get the dummy app to run database migrations via the common:test_app Rake task. The migration works as expected when run directly from spec/dummy.

Steps to reproduce

chruby 2.3
gem install bundler
git clone https://github.com/bbuchalter/solidus_production_logs.git
cd solidus_production_logs
./bin/setup
bundle exec rake

Steps to workaround

# After executing steps to reproduce
bundle exec rake railties:install:migrations
bundle exec rake db:migrate VERBOSE=false

Expected behavior

Expected database migrations to run after dummy Solidus app was created.

Actual behavior

Generating dummy Rails application...
Setting up dummy database...
bundle exec rake db:migrate VERBOSE=false
rake aborted!
NameError: uninitialized constant Spree
/Users/brian/workspace/solidus_production_logs/spec/dummy/config/initializers/spree.rb:4:in `<top (required)>'
/Users/brian/workspace/solidus_production_logs/vendor/bundle/gems/railties-4.2.8/lib/rails/engine.rb:652:in `block in load_config_initializer'
/Users/brian/workspace/solidus_production_logs/vendor/bundle/gems/activesupport-4.2.8/lib/active_support/notifications.rb:166:in `instrument'
/Users/brian/workspace/solidus_production_logs/vendor/bundle/gems/railties-4.2.8/lib/rails/engine.rb:651:in `load_config_initializer'
/Users/brian/workspace/solidus_production_logs/vendor/bundle/gems/railties-4.2.8/lib/rails/engine.rb:616:in `block (2 levels) in <class:Engine>'
/Users/brian/workspace/solidus_production_logs/vendor/bundle/gems/railties-4.2.8/lib/rails/engine.rb:615:in `each'
/Users/brian/workspace/solidus_production_logs/vendor/bundle/gems/railties-4.2.8/lib/rails/engine.rb:615:in `block in <class:Engine>'
/Users/brian/workspace/solidus_production_logs/vendor/bundle/gems/railties-4.2.8/lib/rails/initializable.rb:30:in `instance_exec'
/Users/brian/workspace/solidus_production_logs/vendor/bundle/gems/railties-4.2.8/lib/rails/initializable.rb:30:in `run'
/Users/brian/workspace/solidus_production_logs/vendor/bundle/gems/railties-4.2.8/lib/rails/initializable.rb:55:in `block in run_initializers'
/Users/brian/workspace/solidus_production_logs/vendor/bundle/gems/railties-4.2.8/lib/rails/initializable.rb:54:in `run_initializers'
/Users/brian/workspace/solidus_production_logs/vendor/bundle/gems/railties-4.2.8/lib/rails/application.rb:352:in `initialize!'
/Users/brian/workspace/solidus_production_logs/spec/dummy/config/environment.rb:5:in `<top (required)>'
/Users/brian/workspace/solidus_production_logs/vendor/bundle/gems/railties-4.2.8/lib/rails/application.rb:328:in `require'
/Users/brian/workspace/solidus_production_logs/vendor/bundle/gems/railties-4.2.8/lib/rails/application.rb:328:in `require_environment!'
/Users/brian/workspace/solidus_production_logs/vendor/bundle/gems/railties-4.2.8/lib/rails/application.rb:457:in `block in run_tasks_blocks'
/Users/brian/.gem/ruby/2.3.3/gems/bundler-1.14.6/lib/bundler/cli/exec.rb:74:in `load'
/Users/brian/.gem/ruby/2.3.3/gems/bundler-1.14.6/lib/bundler/cli/exec.rb:74:in `kernel_load'
/Users/brian/.gem/ruby/2.3.3/gems/bundler-1.14.6/lib/bundler/cli/exec.rb:27:in `run'
/Users/brian/.gem/ruby/2.3.3/gems/bundler-1.14.6/lib/bundler/cli.rb:335:in `exec'
/Users/brian/.gem/ruby/2.3.3/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/Users/brian/.gem/ruby/2.3.3/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/Users/brian/.gem/ruby/2.3.3/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
/Users/brian/.gem/ruby/2.3.3/gems/bundler-1.14.6/lib/bundler/cli.rb:20:in `dispatch'
/Users/brian/.gem/ruby/2.3.3/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
/Users/brian/.gem/ruby/2.3.3/gems/bundler-1.14.6/lib/bundler/cli.rb:11:in `start'
/Users/brian/.gem/ruby/2.3.3/gems/bundler-1.14.6/exe/bundle:32:in `block in <top (required)>'
/Users/brian/.gem/ruby/2.3.3/gems/bundler-1.14.6/lib/bundler/friendly_errors.rb:121:in `with_friendly_errors'
/Users/brian/.gem/ruby/2.3.3/gems/bundler-1.14.6/exe/bundle:24:in `<top (required)>'
/Users/brian/.gem/ruby/2.3.3/bin/bundle:22:in `load'
/Users/brian/.gem/ruby/2.3.3/bin/bundle:22:in `<main>'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
rake aborted!
Command failed with status (1): [bundle exec rake db:migrate VERBOSE=false...]
/Users/brian/workspace/solidus_production_logs/vendor/bundle/gems/solidus_core-1.4.0/lib/spree/testing_support/common_rake.rb:20:in `block (2 levels) in <top (required)>'
/Users/brian/workspace/solidus_production_logs/Rakefile:20:in `block in <top (required)>'
/Users/brian/workspace/solidus_production_logs/Rakefile:11:in `block in <top (required)>'
/Users/brian/.gem/ruby/2.3.3/gems/bundler-1.14.6/lib/bundler/cli/exec.rb:74:in `load'
/Users/brian/.gem/ruby/2.3.3/gems/bundler-1.14.6/lib/bundler/cli/exec.rb:74:in `kernel_load'
/Users/brian/.gem/ruby/2.3.3/gems/bundler-1.14.6/lib/bundler/cli/exec.rb:27:in `run'
/Users/brian/.gem/ruby/2.3.3/gems/bundler-1.14.6/lib/bundler/cli.rb:335:in `exec'
/Users/brian/.gem/ruby/2.3.3/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/Users/brian/.gem/ruby/2.3.3/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/Users/brian/.gem/ruby/2.3.3/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
/Users/brian/.gem/ruby/2.3.3/gems/bundler-1.14.6/lib/bundler/cli.rb:20:in `dispatch'
/Users/brian/.gem/ruby/2.3.3/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
/Users/brian/.gem/ruby/2.3.3/gems/bundler-1.14.6/lib/bundler/cli.rb:11:in `start'
/Users/brian/.gem/ruby/2.3.3/gems/bundler-1.14.6/exe/bundle:32:in `block in <top (required)>'
/Users/brian/.gem/ruby/2.3.3/gems/bundler-1.14.6/lib/bundler/friendly_errors.rb:121:in `with_friendly_errors'
/Users/brian/.gem/ruby/2.3.3/gems/bundler-1.14.6/exe/bundle:24:in `<top (required)>'
/Users/brian/.gem/ruby/2.3.3/bin/bundle:22:in `load'
/Users/brian/.gem/ruby/2.3.3/bin/bundle:22:in `<main>'
Tasks: TOP => common:test_app
(See full trace by running task with --trace)

System configuration

Solidus Version: 1.4.0

Extensions in use: none

bbuchalter commented 7 years ago

I was able to take a different approach to creating an extension.