每当使用Rails时都找不到耙 [英] Could not find rake using whenever rails

查看:68
本文介绍了每当使用Rails时都找不到耙的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,我有一个奇怪的问题,我试图在任何时候执行rake任务,但是有这个问题在任何来源中都找不到rake-10.4.2(Bundler :: GemNotFound )。这很奇怪,因为它在ruby 2.1.2版本 /home/vyivrain/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/bundler中搜索此rake版本。 -1.6.2 / lib / bundler / spec_set.rb:92 。但是我在rvm中使用ruby 2.2.0,gem列表也在使用该版本。

这是一个简单的cron作业:

Hello I have a strange problem, I'm trying to get rake task working in whenever, but have this problem Could not find rake-10.4.2 in any of the sources (Bundler::GemNotFound). It's strange, because it searches this rake version in ruby 2.1.2 version /home/vyivrain/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.2/lib/bundler/spec_set.rb:92. However I'm using ruby 2.2.0 in rvm and the gem list is also using that version.
It's a simple cron job:

every 1.minute do
  rake 'process_email:handle', output: 'log/mail.log', environment: 'development'
end

Rakefile:

namespace :process_email do
  desc 'Handle email'
  task handle: :environment do
    MOBIZARD_MAILER.processor.retrieve_mail
  end
end

Mobizard邮件程序是我自己的gem,它通过ruby邮件gem检索邮件,该邮件使用相同的ruby 2.2.0和相同的gem列表。

mail.log中的整个堆栈跟踪如下所示:

Mobizard mailer is my own gem, that retrieves mails through ruby mail gem, that uses same ruby 2.2.0 and same gem list.
Whole stack trace in mail.log looks like this:

/home/vyivrain/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.2/lib/bundler/spec_set.rb:92:in `block in materialize': Could not find rake-10.4.2 in any of the sources (Bundler::GemNotFound)
    from /home/vyivrain/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.2/lib/bundler/spec_set.rb:85:in `map!'
    from /home/vyivrain/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.2/lib/bundler/spec_set.rb:85:in `materialize'
    from /home/vyivrain/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.2/lib/bundler/definition.rb:133:in `specs'
    from /home/vyivrain/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.2/lib/bundler/definition.rb:178:in `specs_for'
    from /home/vyivrain/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.2/lib/bundler/definition.rb:167:in `requested_specs'
    from /home/vyivrain/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.2/lib/bundler/environment.rb:18:in `requested_specs'
    from /home/vyivrain/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.2/lib/bundler/runtime.rb:13:in `setup'
    from /home/vyivrain/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.2/lib/bundler.rb:120:in `setup'
    from /home/vyivrain/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.2/lib/bundler/setup.rb:17:in `<top (required)>'
    from /home/vyivrain/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /home/vyivrain/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'

Thx来回答。

推荐答案

这是因为输出设置了 -l <​​/ code>标志,该标志被rvm错误地解释。

It is because the output is set with the -l flag, which is incorrectly interpreted by rvm.

您可以在此处阅读有关此问题的更多信息:

You can read more about this issue here:

https://github.com/javan/whenever/issues/325

这篇关于每当使用Rails时都找不到耙的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆