guard / guard-spork

Guard::Spork automatically manage Spork DRb servers
https://rubygems.org/gems/guard-spork
MIT License
296 stars 58 forks source link

#<RuntimeError: Application has been already initialized.> #42

Closed alduro closed 12 years ago

alduro commented 12 years ago

I'm having this problem as well. I have changed spork and spork-guard gems version with no luck. Perhaps there should be a combination of gems versions of cucumber-rails, spork and guard ( guard-spork and guard-cucumber as well ) but I haven't found them yet. Any help would be appreciate. Thanks.

aldo@macbook ~/Satio/Desarrollo/rails/kazoo (feature/refactoring) > guard Guard is now watching at '/Users/aldo/Satio/Desarrollo/rails/kazoo' Starting Spork for RSpec & Cucumber Using RSpec Using Cucumber Preloading Rails environment /Users/aldo/Satio/Desarrollo/rails/kazoo/features/support/env.rb has not been bootstrapped. Run spork --bootstrap to do so. Loading Spork.prefork block... Preloading Rails environment Spork is ready and listening on 8990! Spork server for RSpec & Cucumber successfully started Running all features Using the default profile... Running tests with args ["--require", "/Users/aldo/.rvm/gems/ruby-1.9.2-p290@kazoo/gems/guard-cucumber-0.7.3/lib/guard/cucumber/notification_formatter.rb", "--format", "Guard::Cucumber::NotificationFormatter", "--out", "/dev/null", "--require", "features", "features", "--format", "rerun", "--out", "rerun.txt", "--strict", "--tags", "~@wip", "--no-profile"]... Exception encountered: backtrace: /Users/aldo/.rvm/gems/ruby-1.9.2-p290@kazoo/gems/railties-3.1.1/lib/rails/application.rb:95:in initialize!' /Users/aldo/.rvm/gems/ruby-1.9.2-p290@kazoo/gems/cucumber-rails-1.1.1/lib/cucumber/rails/application.rb:15:ininitialize!' /Users/aldo/.rvm/gems/ruby-1.9.2-p290@kazoo/gems/railties-3.1.1/lib/rails/railtie/configurable.rb:30:in method_missing' /Users/aldo/Satio/Desarrollo/rails/kazoo/config/environment.rb:5:in' /Users/aldo/.rvm/gems/ruby-1.9.2-p290@kazoo/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in require' /Users/aldo/.rvm/gems/ruby-1.9.2-p290@kazoo/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:inblock in require' /Users/aldo/.rvm/gems/ruby-1.9.2-p290@kazoo/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:225:in load_dependency' /Users/aldo/.rvm/gems/ruby-1.9.2-p290@kazoo/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:inrequire' /Users/aldo/.rvm/gems/ruby-1.9.2-p290@kazoo/gems/cucumber-rails-1.1.1/lib/cucumber/rails.rb:7:in <top (required)>' /Users/aldo/.rvm/gems/ruby-1.9.2-p290@kazoo/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:inrequire' /Users/aldo/.rvm/gems/ruby-1.9.2-p290@kazoo/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in block in require' /Users/aldo/.rvm/gems/ruby-1.9.2-p290@kazoo/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:225:inload_dependency' /Users/aldo/.rvm/gems/ruby-1.9.2-p290@kazoo/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in require' /Users/aldo/Satio/Desarrollo/rails/kazoo/features/support/env.rb:12:in' /Users/aldo/.rvm/gems/ruby-1.9.2-p290@kazoo/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:234:in load' /Users/aldo/.rvm/gems/ruby-1.9.2-p290@kazoo/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:234:inblock in load' /Users/aldo/.rvm/gems/ruby-1.9.2-p290@kazoo/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:225:in load_dependency' /Users/aldo/.rvm/gems/ruby-1.9.2-p290@kazoo/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:234:inload' /Users/aldo/.rvm/gems/ruby-1.9.2-p290@kazoo/gems/spork-0.9.0.rc9/lib/spork/run_strategy/forking.rb:11:in block in run' /Users/aldo/.rvm/gems/ruby-1.9.2-p290@kazoo/gems/spork-0.9.0.rc9/lib/spork/forker.rb:21:inblock in initialize' /Users/aldo/.rvm/gems/ruby-1.9.2-p290@kazoo/gems/spork-0.9.0.rc9/lib/spork/forker.rb:18:in fork' /Users/aldo/.rvm/gems/ruby-1.9.2-p290@kazoo/gems/spork-0.9.0.rc9/lib/spork/forker.rb:18:ininitialize' /Users/aldo/.rvm/gems/ruby-1.9.2-p290@kazoo/gems/spork-0.9.0.rc9/lib/spork/run_strategy/forking.rb:9:in new' /Users/aldo/.rvm/gems/ruby-1.9.2-p290@kazoo/gems/spork-0.9.0.rc9/lib/spork/run_strategy/forking.rb:9:inrun' /Users/aldo/.rvm/gems/ruby-1.9.2-p290@kazoo/gems/spork-0.9.0.rc9/lib/spork/server.rb:48:in run' /Users/aldo/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/drb/drb.rb:1558:inperform_without_block' /Users/aldo/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/drb/drb.rb:1518:in perform' /Users/aldo/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/drb/drb.rb:1592:inblock (2 levels) in main_loop' /Users/aldo/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/drb/drb.rb:1588:in loop' /Users/aldo/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/drb/drb.rb:1588:inblock in main_loop' Done.

Guard::RSpec is running, with RSpec 2!

GEMFILE

source 'http://rubygems.org' source 'http://gems.github.com'

gem 'rails', '3.1.1' gem 'pg'

group :assets do gem 'sass-rails', '~> 3.1.4' gem 'coffee-rails', '~> 3.1.1' gem 'uglifier', '~> 1.0.3' end

gem "haml" gem "haml-rails"

gem 'jquery-rails' gem 'devise' # Devise must be required before RailsAdmin gem 'cancan'

gem 'fastercsv' gem 'to_xls' gem 'prawn'

gem 'carrierwave'

gem 'rails_admin', :branch => 'rails-3.1', :git => 'git@github.com:oyster/rails_admin.git'

gem 'capistrano' gem 'capistrano-ext'

gem 'rest-client' gem 'dynamic_form'

gem 'settingslogic' gem 'thor'

group :feed do gem 'net-sftp' end

group :development do gem 'annotate', :git => 'git://github.com/ctran/annotate_models.git' gem 'thin' gem 'wirble' gem 'hirb' gem "rails-erd" gem 'rails-dev-tweaks', '>= 0.5.1' gem 'ruby-debug19', :require => 'ruby-debug' end

group :test do gem 'therubyracer' gem 'turn', :require => false gem 'webmock' gem 'rr' gem 'minitest' gem 'parallel_tests' gem 'simplecov' gem 'capybara-webkit' gem 'factory_girl_rails' gem 'capybara' gem 'cucumber' gem 'cucumber-rails' gem 'guard-cucumber' gem 'database_cleaner' gem 'rb-fsevent' gem 'spork', '~> 0.9.0.rc' gem 'guard-spork', :git => 'git://github.com/guard/guard-spork.git' gem 'rspec' gem 'rspec-rails' gem 'guard-rspec' gem 'guard-coffeescript' gem 'guard-livereload' gem 'jasmine', '1.1.0' gem 'autotest' gem 'pickle' end

Guardfile

guard 'spork', :wait => 60, :cucumber_env => { 'RAILS_ENV' => 'test' }, :rspec_env => { 'RAILS_ENV' => 'test' } do watch('config/application.rb') watch('config/environment.rb') watch(%r{^config/environments/.+.rb$}) watch(%r{^config/initializers/.+.rb$}) watch('Gemfile') watch('Gemfile.lock') watch('spec/spec_helper.rb') watch('test/test_helper.rb') end

guard 'coffeescript', :output => 'public/javascripts/compiled' do watch(/^app\/assets\/javascripts\/(.).js.coffee/) watch(/^app\/assets\/javascripts\/(.).js/) end

guard 'coffeescript', :output => 'spec/javascripts/compiled' do watch(/^spec\/javascripts\/(.*).coffee/) end

guard 'cucumber', :cli => "--drb" do watch(%r{^features/.+.feature$}) watch(%r{^features/support/.+$}) { 'features' } watch(%r{^features/step_definitions/(.+)_steps.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' } end

guard 'rspec', :version => 2, :cli => "--drb", :all_on_start => false, :all_after_pass => false do watch(%r{^spec/.+_spec.rb$}) watch(%r{^lib/(.+).rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } watch('spec/spec_helper.rb') { "spec" } watch(%r{^spec/.+spec.rb$}) watch(%r{^app/(.+).rb$}) { |m| "spec/#{m[1]}_spec.rb" } watch(%r{^lib/(.+).rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } watch(%r{^app/controllers/(.+)(controller).rb$}) { |m| ["spec/routing/#{m[1]}routing_spec.rb", "spec/#{m[2]}s/#{m[1]}#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] } watch(%r{^spec/support/(.+).rb$}) { "spec" } watch('spec/spec_helper.rb') { "spec" } watch('config/routes.rb') { "spec/routing" } watch('app/controllers/application_controller.rb') { "spec/controllers" } watch(%r{^app/views/(.+)/.*.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" } end

config/cucumber.yml

<% rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : "" rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"

std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags ~@wip"

std_opts = "--format rerun --out rerun.txt --strict --tags ~@wip" %> default: --drb <%= std_opts %> wip: --tags @wip:3 --wip features rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip

netzpirat commented 12 years ago

Discovered this in your logs:

/Users/aldo/Satio/Desarrollo/rails/kazoo/features/support/env.rb has not been bootstrapped. Run spork --bootstrap to do so.

So you have to bootstrap Spork for Cucumber.

alduro commented 12 years ago

Hey netzpirat, it is working now ! Thanks ! Perhaps you can help me, How can I improve cucumber output format ?

aldo@macbook ~/Satio/Desarrollo/rails/kazoo (feature/refactoring) > guard Guard is now watching at '/Users/aldo/Satio/Desarrollo/rails/kazoo' Starting Spork for RSpec & Cucumber Using RSpec Using Cucumber Preloading Rails environment Preloading Rails environment Loading Spork.prefork block... Loading Spork.prefork block... [DEPRECATION WARNING] Nested I18n namespace lookup under "activerecord.models.values" is no longer supported [DEPRECATION WARNING] Nested I18n namespace lookup under "activerecord.models.values" is no longer supported Spork is ready and listening on 8989! Spork is ready and listening on 8990! Spork server for RSpec & Cucumber successfully started Running all features Using the default profile... Running tests with args ["--require", "/Users/aldo/.rvm/gems/ruby-1.9.2-p290@kazoo/gems/guard-cucumber-0.7.3/lib/guard/cucumber/notification_formatter.rb", "--format", "Guard::Cucumber::NotificationFormatter", "--out", "/dev/null", "--require", "features", "features", "--format", "rerun", "--out", "rerun.txt", "--strict", "--tags", "~@wip", "--no-profile"]... Disabling profiles... WARNING: i18n methods within step definitions are deprecated. Use #step instead:/Users/aldo/Satio/Desarrollo/rails/kazoo/features/step_definitions/load_data_steps.rb:235:in block in <top (required)>' WARNING: i18n methods within step definitions are deprecated. Use #step instead:/Users/aldo/Satio/Desarrollo/rails/kazoo/features/step_definitions/load_data_steps.rb:236:inblock in <top (required)>'

netzpirat commented 12 years ago

The cucumber guard does not output any visible output to the console, the injected formatter is only for system notifications. Please read the section Cucumber configuration in the readme on how to properly configure Cucumber. A small hint: when you set the :cli options you overwrite the following defaults: --no-profile --color --format progress --strict, so you may want to set your :cli options to something like --no-profile --color --format progress --strict --drb. Now you can change to format to whatever is available in Cucumber: https://github.com/cucumber/cucumber/tree/master/lib/cucumber/formatter

alduro commented 12 years ago

Thanks Michael ! that was really helpful. Everything is working now.