每当我运行spork
时,我都会
$ spork
Using RSpec
Preloading Rails environment
Loading Spork.prefork block...
no such file to load -- spork (LoadError)
/Users/darth/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
/Users/darth/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `block in require'
/Users/darth/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `block in load_dependency'
/Users/darth/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:640:in `new_constants_in'
/Users/darth/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `load_dependency'
/Users/darth/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
/Users/darth/projects/checkin/spec/spec_helper.rb:2:in `<top (required)>'
/Users/darth/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:234:in `load'
/Users/darth/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:234:in `block in load'
/Users/darth/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `block in load_dependency'
/Users/darth/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:640:in `new_constants_in'
/Users/darth/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `load_dependency'
/Users/darth/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:234:in `load'
/Users/darth/.rvm/gems/ruby-1.9.2-p290/gems/spork-0.9.0.rc9/lib/spork/test_framework.rb:138:in `block (2 levels) in preload'
/Users/darth/.rvm/gems/ruby-1.9.2-p290/gems/spork-0.9.0.rc9/lib/spork/app_framework/rails.rb:8:in `preload'
/Users/darth/.rvm/gems/ruby-1.9.2-p290/gems/spork-0.9.0.rc9/lib/spork/test_framework.rb:134:in `block in preload'
/Users/darth/.rvm/gems/ruby-1.9.2-p290/gems/spork-0.9.0.rc9/lib/spork.rb:62:in `exec_prefork'
/Users/darth/.rvm/gems/ruby-1.9.2-p290/gems/spork-0.9.0.rc9/lib/spork/test_framework.rb:120:in `preload'
/Users/darth/.rvm/gems/ruby-1.9.2-p290/gems/spork-0.9.0.rc9/lib/spork/run_strategy/forking.rb:25:in `preload'
/Users/darth/.rvm/gems/ruby-1.9.2-p290/gems/spork-0.9.0.rc9/lib/spork/runner.rb:74:in `run'
/Users/darth/.rvm/gems/ruby-1.9.2-p290/gems/spork-0.9.0.rc9/lib/spork/runner.rb:10:in `run'
/Users/darth/.rvm/gems/ruby-1.9.2-p290/gems/spork-0.9.0.rc9/bin/spork:10:in `<top (required)>'
/Users/darth/.rvm/gems/ruby-1.9.2-p290/bin/spork:19:in `load'
/Users/darth/.rvm/gems/ruby-1.9.2-p290/bin/spork:19:in `<main>'
我记得几天前我已经开始使用Spork了,但我正在搞乱我的Gemfile让它在Heroku上工作,我现在似乎无法让它工作。这是我的Gemfile
source 'http://rubygems.org'
gem 'rack', '1.3.3'
gem 'rails', '3.1.0'
gem 'json'
gem 'jquery-rails'
gem 'pg', :group => :production
group :assets do
gem 'sass-rails', " ~> 3.1.0"
gem 'coffee-rails', "~> 3.1.0"
gem 'uglifier'
end
gem 'nifty-generators', :group => :development
group :development, :test do
gem 'sqlite3'
gem 'rspec-rails'
group :darwin do
gem 'rb-fsevent', :require => false
gem 'rb-inotify', :require => false
gem 'rb-fchange', :require => false
end
gem 'spork', '> 0.9.0.rc'
gem 'guard-rspec', :require => false
gem 'guard-spork', :require => false
gem 'growl'
gem 'cucumber-rails'
gem 'database_cleaner'
gem 'webrat'
gem 'capybara'
gem 'factory_girl_rails'
end
当我尝试在另一个项目中启动spork时,它似乎运行得很好,所以问题必须在配置中的某个地方。
bundle exec spork
给了我
/Users/darth/.rvm/gems/ruby-1.9.2-p290/gems/bundler-
1.0.21/lib/bundler/rubygems_integration.rb:143:in `block in replace_gem':
spork is not part of the bundle. Add it to Gemfile. (Gem::LoadError)
from /Users/darth/.rvm/gems/ruby-1.9.2-p290/bin/spork:18:in `<main>'
答案 0 :(得分:0)
我还没有在3.1.0中尝试这个,所以它可能无法正常工作但是在你的spork prefork中...尝试添加以下内容:
Spork.prefork do
...
#Add this following line to get spork working with rails 3
ActiveSupport::Dependencies.clear
...
end
答案 1 :(得分:0)
在rails中为我工作3.确保你的gemfile中有'spork-rails'。 我只看到你的'spork'。
我试图在bundler之外使用它,因为它不在团队项目中,没有人想要它,但除非我真的在gemfile中使用它,否则它将无效。