MyApp 正在使用 rvm gemset[电子邮件受保护] /cdn-cgi/l/email-protection。这不是默认的。
我正在使用 gem“每当”定期发送电子邮件通知。这是我的日程表.rb:
every 1.minutes do
runner "MyModel.send_emails" # if ...
end
除非 gemset,否则 Cron 作业无法正常工作[电子邮件受保护] /cdn-cgi/l/email-protection是默认的。我如何改进我的schedule.rb以便为我的调度程序使用另一个gemsets(不仅仅是默认的@global)。
我已阅读官方文档:whenever https://github.com/javan/whenever and RVM问题 https://github.com/javan/whenever/wiki/RVM-Notes以及有关“rvm gemsets for无论何时”的stackoverflow问题,但尚未找到答案。
我尝试将以下代码(根据 RVM-Notes 中的建议)放入我的 shedule.rb 中:
job_type :runner, "{ cd #{@current_path} > /home/####/.rvm/gems/ruby-1.9.3-p448@
rails-3.2/bin/rails; } && RAILS_ENV=:environment bundle exec rails runner ':task' :output"
但它没有给出结果:
ERROR:
/home/###/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/spec_set.rb:92
:in `block in materialize': Could not find i18n-0.6.5 in any of the sources
(Bundler::GemNotFound)
如何为Rails gem“每当”指定rvm gemsets?非常感谢!
UPDATE
1)我尝试为我的 Gemfile 提供 rvm 符号,如下所示:
ruby=ruby-1.9.3-p448 # with # sign
ruby-gemset=rails-3.2 # with # sign
它没有给出任何结果。没有什么变化。
2)我尝试修改我的~/.rvmrc。对捆绑包的完整路径进行实验,rails 给出了以下错误列表:
/usr/bin/env: ruby: No such file or directory
/usr/bin/env: ruby: No such file or directory
/bin/bash: bundle: command not found
/bin/bash: bundle: command not found
/usr/bin/env: ruby_executable_hooks/usr/bin/env: ruby_executable_hooks: No such file or directory
: No such file or directory
这里通过job_type实验:
#job_type :runner, "{ cd #{path}; } && RAILS_ENV=:environment bundle exec rails runner ':task' :output"
job_type :runner, "{ cd #{path}; } && RAILS_ENV=:environment /home/###/.rvm/gems/ruby-1.9.3-p448@global/bin/bundle exec rails runner ':task' :output"
#job_type :runner, "cd #{path} && RAILS_ENV=development /home/###/.rvm/gems/ruby-1.9.3-p448@global/bin/bundle exec /home/###/.rvm/gems/[email protected] /cdn-cgi/l/email-protection/bin/rails runner ':task' :output"