新rake任务出现问题,为什么rspec会被触发?

时间:2011-04-08 22:51:00

标签: ruby ruby-on-rails-3 rspec rake

我在我的rails 3项目中的lib / tasks中编写了一个rake任务,它似乎运行良好,只是在运行后出现以下错误:

$ rake dictionary:import_italian

(See full trace by running task with --trace)
/usr/lib/ruby/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in `load': no such file to load -- /home/fletch/Dropbox/bin/kp/dictionary:import_italian (LoadError)
from /usr/lib/ruby/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in `load_spec_files'
from /usr/lib/ruby/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in `map'
from /usr/lib/ruby/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in `load_spec_files'
from /usr/lib/ruby/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/command_line.rb:18:in `run'
from /usr/lib/ruby/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:55:in `run_in_process'
from /usr/lib/ruby/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:46:in `run'
from /usr/lib/ruby/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:10:in `autorun'
from /usr/bin/rake:19

有人能告诉我是什么原因造成的吗?

更新:再看一遍后,我发现它与其他内置的rake任务一起发生,但rake spec似乎工作正常。

$ rake db:migrate
(in /home/fletch/Dropbox/bin/kp)
==  AddIndexesToWords: migrating ==============================================
-- add_index(:words, :title)
   -> 0.1121s
-- add_index(:words, :language_id)
   -> 0.0869s
==  AddIndexesToWords: migrated (0.1992s) =====================================

/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:235:in `load': no such file to load -- /home/fletch/Dropbox/bin/kp/db:migrate (LoadError)
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:235:in `load'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:225:in `load_dependency'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:596:in `new_constants_in'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:225:in `load_dependency'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:235:in `load'
from /usr/lib/ruby/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in `load_spec_files'
from /usr/lib/ruby/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in `map'
from /usr/lib/ruby/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in `load_spec_files'
from /usr/lib/ruby/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/command_line.rb:18:in `run'
from /usr/lib/ruby/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:55:in `run_in_process'
from /usr/lib/ruby/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:46:in `run'
from /usr/lib/ruby/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:10:in `autorun'
from /usr/bin/rake:19

1 个答案:

答案 0 :(得分:1)

好的,事实证明这是在我的佣金任务中,我使用了describe而不是desc来给它一个描述。但不确定为什么这影响了我所有的其他佣金任务。