Imagine the following code:
desc "callerz"
task :callerz do
set :branch, "potato"
called_with
end
desc "called with param"
task :called_with do
br = variables[:branch]
puts "called with branch #{br}"
end
In the above example, the task called_with can be passed a param form the command line:
cap called_with -s branch=master
And this allows us to send a parameter, from the commandline. The output will be:
called with branch master
If you need to call a parameterized task from another task, the above task, callerz illustrates one way of getting that result. You invoke it like this:
cap callerz
And inside, it sets the variable branch to a value. The output will be:
called with branch potato
The above code was tested in capistrano 2.15.8