guard/guard-spork — Issue #42:  #<RuntimeError: Application has been already initialized.>
Author: alduro
Created: 2011-11-02 13:47:02+00:00
State: open

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 '
/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-firebug'
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" }

# Rails example
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" }
# Capybara request specs
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