简体   繁体   English

如何在Ruby中运行多个任务?

[英]How to run multiple tasks in Ruby?

I have a Capistrano deploy.rb script which has multiple tasks that can be invoked on the command line 我有一个Capistrano deploy.rb脚本,该脚本具有可以在命令行上调用的多个任务

cap site1_to_live deploy
cap site2_to_live deploy
(...etc)

I have tried combining these into a single task as follows 我尝试将这些合并为一个任务,如下所示

task :all_to_live do
  site1_to_live
  site2_to_live
  site3_to_live
end

However, only one of the tasks is executed. 但是,仅执行一项任务。 How can I get all of them to run? 我怎样才能让它们全部运行?

Define rake task which would group the subtasks. 定义将分组子任务的耙任务。 Run this single rake task with capistrano. 使用capistrano运行此单个rake任务。

This is better because you will be also able to run this grouping task locally. 这样比较好,因为您还可以在本地运行此分组任务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM