How do I invoke one Capistrano task from another? How do I invoke one Capistrano task from another? ruby-on-rails ruby-on-rails

How do I invoke one Capistrano task from another?


For the record: in the Capistrano 3, use invoke(), e.g.

desc "Task that does something"task :do_something do  invoke 'namespace:task'end

More at https://github.com/capistrano/capistrano#before--after


You can do it by using namespace:

namespace :test do  task :one do  end  task :two do    test.one    #or just directly call it:    one  endend

Just be careful with the name you use to not overwrite some important function.


Generally you do this by defining dependencies:

before :bar, :foo