本地任务
本地任务可以通过将 on
替换为 run_locally
来运行
desc 'Notify service of deployment'
task :notify do
run_locally do
with rails_env: :development do
rake 'service:notify'
end
end
end
当然,您始终可以使用标准的 ruby 语法在本地运行操作
desc 'Notify service of deployment'
task :notify do
%x(RAILS_ENV=development bundle exec rake "service:notify")
end
或者,您可以使用 rake 语法
desc "Notify service of deployment"
task :notify do
sh 'RAILS_ENV=development bundle exec rake "service:notify"'
end