【发布时间】:2010-09-08 14:13:20
【问题描述】:
我的 rails 应用程序中有 rake 任务。我想在 rake 任务中运行命令行命令。我怎样才能做到这一点。我尝试了以下但失败了
desc "Sending the newsletter to all the users"
task :sending_mail do
run "cd #{RAILS_ROOT} && ar_sendmail -o -t NewsLetters -v"
system "cd #{RAILS_ROOT} && ar_sendmail -o -t NewsLetters -v &"
end
上述运行命令抛出未定义的运行方法和系统命令未抛出任何错误但未执行。
【问题讨论】:
标签: ruby-on-rails shell command-line rake rake-task