尝试设置 javan 每当 gem。
安装 0.8.4 版本。
schedule.rb 看起来像这样:
if Rails.env == 'production'
set :output, "#{::Rails.root.to_s}/tmp/cron.log"
every '*/1 * * * *' do
command "bundle exec rake ts:reindex RAILS_ENV=production"
end
end
当我做“每当”时,我得到:
/home/slagrz/.rvm/gems/ruby-1.9.3-p448/gems/whenever-0.6.8/lib/whenever/job_list.rb:21:in `eval': uninitialized constant Whenever::JobList::Rails (NameError)
from /home/slagrz/.rvm/gems/ruby-1.9.3-p448/gems/whenever-0.6.8/lib/whenever/job_list.rb:21:in `eval'
from /home/slagrz/.rvm/gems/ruby-1.9.3-p448/gems/whenever-0.6.8/lib/whenever/job_list.rb:21:in `initialize'
from /home/slagrz/.rvm/gems/ruby-1.9.3-p448/gems/whenever-0.6.8/lib/whenever.rb:15:in `new'
from /home/slagrz/.rvm/gems/ruby-1.9.3-p448/gems/whenever-0.6.8/lib/whenever.rb:15:in `cron'
from /home/slagrz/.rvm/gems/ruby-1.9.3-p448/gems/whenever-0.6.8/lib/whenever/command_line.rb:41:in `run'
from /home/slagrz/.rvm/gems/ruby-1.9.3-p448/gems/whenever-0.6.8/lib/whenever/command_line.rb:8:in `execute'
from /home/slagrz/.rvm/gems/ruby-1.9.3-p448/gems/whenever-0.6.8/bin/whenever:38:in `<top (required)>'
from /home/slagrz/.rvm/gems/ruby-1.9.3-p448/bin/whenever:23:in `load'
from /home/slagrz/.rvm/gems/ruby-1.9.3-p448/bin/whenever:23:in `<main>'
from /home/slagrz/.rvm/gems/ruby-1.9.3-p448/bin/ruby_noexec_wrapper:14:in `eval'
from /home/slagrz/.rvm/gems/ruby-1.9.3-p448/bin/ruby_noexec_wrapper:14:in `<main>'
所以,只是想知道我是否安装了错误的版本,或者计划文件的格式是否会影响它。
谢谢