【发布时间】:2012-03-30 07:04:28
【问题描述】:
我有一个看起来像这样的 rake 任务(crontab):
cd /data/TheApp/current && bundle exec rake nightly_tasks[3]
--trace --silent 2>> /data/TheApp/shared/log/tasks_prod_errors.log
在测试和开发中一切都运行良好,但在 prod 我得到这个错误:
rake aborted!
no such file to load -- ruby-debug
/usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in
`require'
/usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in
`block (2 levels) in require'
好的,所以我检查了我的 gemfile,我有这个:
group :development, :test do
gem 'ruby-debug19', :require => 'ruby-debug', :platforms => :ruby
...
生产环境应该忽略 ruby 调试要求。所以我检查了我的 RAILS_ENV,它是正确的:
$ echo $RAILS_ENV
production
最重要的是,在这个 rake 任务中曾经需要 ruby debug 的行被注释掉了。所以在我看来,bundle exec 不可能尝试在 prod 中加载 ruby-debug。这可能与 gemfile.lock 有关吗?里面有一个 ruby-debug19 的条目。但是为什么我的 rake 任务会在这种情况下加载它呢?
此外,从命令行运行命令也可以正常工作。令人困惑。
【问题讨论】:
-
您的应用程序中的任何地方都需要“ruby-debug”吗?
-
@FrederickCheung 是的,但它在我的规格测试中。怀疑 Rake 会使用该代码。
标签: ruby-on-rails ruby ruby-on-rails-3.1 rake