How to run multiple tasks in Ruby? - ruby

I have a Capistrano deploy.rb script which has multiple tasks that can be invoked on the command line
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.
This is better because you will be also able to run this grouping task locally.

Related

How to run a gradle task mulitple times with different parameters

I have multiple sub-directories against which I would like to run the same set of tests.
I am thinking that one task could fetch the sub-directories to run the tests against.
The second task would use the output of the first task and run the tests against all these versions.

In gradle, how can I run a task against all projects recursively from command line?

I'm looking for a syntax along the lines of ./gradlew :all:myTask that I can quickly execute from the command line. I must have missed it in the documentation somewhere.
I know I can modify the build to include a new task that runs a task against all sub-projects, however I'd prefer to not mess with modifying the build for simple one-off scenarios.
If I understand your goal correctly, running ./gradlew myTask should do what you want by default
:myTask
:foo:myTask
:foo:bar:myTask
:baz:myTask

What is the proper way to run tasks in succession in Gradle

I have a task like this in gradle: task startServer (dependsOn: [':backend:appengineStop', ':backend:appengineRun']). The problem is appengineStop is not run or doesn't seem to be run before appengineRun runs.
I am saying this because when the server is running and I execute this task, it should stop the server first (appengineStop) and start the server again (appengineRun), but this is not happening and build fails saying "Port already in use".
That is why I listed appengineStop first so it will stop the server. Can someone please explain.
Setting of deppendsOn of your task just saying, that both tasks on wich you depends (it's ':backend:appengineStop' and ':backend:appengineRun' in your case) will be executed before your dependent startServer task. The order of execution of this tasks is not determined. Probably, they'll be executed in alphabetical order, but it's a gradle implementation's behavior and you don't use to rely on it.
Gardle tasks have a capacity to determine their order using mustRunAfter method, which make a task running just after task specified as an argument is executed.
You can try to do it by adding to your build script somthing like:
task startServer (dependsOn: [':backend:appengineStop', ':backend:appengineRun']) {
tasks.getByPath(':backend:appengineRun').mustRunAfter ':backend:appengineStop'
}

How to run a rake task depending on environment?

I'm trying to export Mixpanel raw data, as documented here
https://mixpanel.com/docs/api-documentation/exporting-raw-data-you-inserted-into-mixpanel
As the Mixpanel team didn't bother to just provide a script doing this, a kind soul made this Rake task
https://gist.github.com/wongpeiyi/3217208
I figured out that it needs to go into a file named "Rakefile", and executed with
$ rake mixpanel:pull
However, that gives
rake aborted!
Don't know how to build task 'environment'
Tasks: TOP => mixpanel:pull
How can this task be run?
Thanks!
The rake task was problably written to be included in a rails project. You can just remove the dependency on the :environment task.
So change the task line to
task :pull do
that should do the trick. It could be possible that some gems are missing (that is what the :environment task does: it loads the rails environment).

Setting up Rake with Jenkins?

How can I report to Jenkins on individual task or steps of a rake-file?
I want as much info as possible about each sub task.

Resources