Capistrano 3 : Invoke one custom made task from another task

In previous versions, it was like normal ruby of JavaScript function call

You can do it by using namespace:

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

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

In Capistrano 3 or later

use invoke(), e.g.

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

you also could use Rake::Task["namespace:task"].invoke, this works

Generally you do this by defining dependencies:

before :bar, :foo

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s