Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I invoke one Capistrano task from another?

How do I invoke one Capistrano task from another?

For example:

task :foo do   # stuff end  task :bar do   # INVOKE :foo end 
like image 985
weicool Avatar asked Dec 02 '10 18:12

weicool


2 Answers

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

like image 144
Ain Tohvri Avatar answered Sep 22 '22 21:09

Ain Tohvri


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   end end 

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

like image 21
mpapis Avatar answered Sep 20 '22 21:09

mpapis