Closed frankapimenta closed 12 years ago
I'm not sure to understand well that error. Please can you give me your Guardfile & Gemfile and be more precise about what you are doing to get this (command line used, actions...). It could also be a error specific to Spork and not guard-spork.
I have installed spork and guard-spork in a recent created rails project. When I run spork i have the error I have posted. When i open the file application.rb and comment the line: Bundler.require *Rails.groups(:assets => %w(development test)), spork and guard-spork starts working again. My gemfile:
source 'http://rubygems.org'
gem 'rails', '3.1.0'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
# Database
gem 'sqlite3'
gem 'sqlite3-ruby', :require => 'sqlite3'
# Inherited Resources
gem 'inherited_resources'
# Responders
gem 'responders'
# HasScope
gem 'has_scope'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'haml-rails'
#gem 'sass-rails' in rails 3.1 by default
gem 'coffee-rails', '~> 3.1.0'
gem 'uglifier'
gem 'jquery-rails'
end
group :development do
# Deploy with Capistrano
gem 'capistrano'
# Capybara
gem 'capybara'
# Oink
gem 'oink'
# Annotate
gem 'annotate'
end
group :test do
# Use unicorn as the web server
gem 'unicorn'
# Sport -> tests server
gem 'spork', '~> 0.9.0.rc'
gem 'guard-spork'
gem 'autotest', '4.4.6'
gem 'autotest-rails-pure', '4.1.2'
gem 'autotest-fsevent', '0.2.4'
gem 'autotest-growl', '0.2.9'
# To use debugger
gem 'ruby-debug19', :require => 'ruby-debug'
# FactoryGirl as object mocking
gem 'factory_girl'
# Rspec as test framework -> TDD
gem 'rspec'
gem 'rspec-rails', :require => 'rpsec'
gem 'guard-rspec'
# Cucumber as scenarios tests framework -> BDD
gem 'cucumber'
gem 'cucumber-rails', :require => 'cucumber'
gem 'guard-cucumber'
# Pickle -> Cucumber support
gem 'pickle'
# Database
gem 'database_cleaner'
# Migrations helper
gem 'migration_test_helper'
# Routes test
gem 'webrat'
gem 'webmock'
# Colors in test feedback
gem 'syntax'
end
Guard:
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
guard 'spork', :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 '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
Ok so it isn't a guard-spork
issue, but more a Spork
issue. I think you have a conflict with a gem required by Bundler, try to update Bundler (1.1.rc just came out this week) and commented gem after gem in your Gemfile to see from which it comes.
When I hit spork or guard (spork) I have the following error:
rvm/gems/ruby-1.9.2-p180@rails31/gems/bundler-1.0.18/lib/bundler/runtime.rb:68:in'
require' .rvm/gems/ruby-1.9.2-p180@rails31/gems/bundler-1.0.18/lib/bundler/runtime.rb:68:in
block (2 levels) in require' .rvm/gems/ruby-1.9.2-p180@rails31/gems/bundler-1.0.18/lib/bundler/runtime.rb:66:ineach' .rvm/gems/ruby-1.9.2-p180@rails31/gems/bundler-1.0.18/lib/bundler/runtime.rb:66:in
block in require' .rvm/gems/ruby-1.9.2-p180@rails31/gems/bundler-1.0.18/lib/bundler/runtime.rb:55:ineach' .rvm/gems/ruby-1.9.2-p180@rails31/gems/bundler-1.0.18/lib/bundler/runtime.rb:55:in
require' .rvm/gems/ruby-1.9.2-p180@rails31/gems/bundler-1.0.18/lib/bundler.rb:120:inrequire' .../config/application.rb:7:in
<top (required)>' .rvm/gems/ruby-1.9.2-p180@rails31/gems/spork-0.9.0.rc9/lib/spork/app_framework/rails.rb:48:inrequire' .rvm/gems/ruby-1.9.2-p180@rails31/gems/spork-0.9.0.rc9/lib/spork/app_framework/rails.rb:48:in
preload_rails' .rvm/gems/ruby-1.9.2-p180@rails31/gems/spork-0.9.0.rc9/lib/spork/app_framework/rails.rb:7:inpreload' .rvm/gems/ruby-1.9.2-p180@rails31/gems/spork-0.9.0.rc9/lib/spork/test_framework.rb:134:in
block in preload' .rvm/gems/ruby-1.9.2-p180@rails31/gems/spork-0.9.0.rc9/lib/spork.rb:62:inexec_prefork' .rvm/gems/ruby-1.9.2-p180@rails31/gems/spork-0.9.0.rc9/lib/spork/test_framework.rb:120:in
preload' .rvm/gems/ruby-1.9.2-p180@rails31/gems/spork-0.9.0.rc9/lib/spork/run_strategy/forking.rb:25:inpreload' .rvm/gems/ruby-1.9.2-p180@rails31/gems/spork-0.9.0.rc9/lib/spork/runner.rb:74:in
run' .rvm/gems/ruby-1.9.2-p180@rails31/gems/spork-0.9.0.rc9/lib/spork/runner.rb:10:inrun' .rvm/gems/ruby-1.9.2-p180@rails31/gems/spork-0.9.0.rc9/bin/spork:10:in
<top (required)>' .rvm/gems/ruby-1.9.2-p180@rails31/bin/spork:19:inload' .rvm/gems/ruby-1.9.2-p180@rails31/bin/spork:19:in
Which is caused by:
Bundler.require *Rails.groups(:assets => %w(development test))
in application.rb
if I comment the line above everything works fine. My questions are what is the problem? how can it be solved? is it a bug?
Best.