Skip to content


Subversion checkout URL

You can clone with
Download ZIP

2.x DSL Configuration Tasks After

Michael Nikitochkin edited this page · 4 revisions


after(task_name, *args, &block) 



This method lets you tell Capistrano to invoke one or more other tasks after invoking a particular task. This makes it very easy to extend an existing recipe, by adding these hooks to be executed after some task. (For adding tasks to be executed before another task, see the before method.)



This may be either a symbol or a string that gives the fully qualified name of the task to extend. This means that if you want to extend the deploy:upload task, you must give the task name as deploy:upload, and not merely as :upload.

The task does not have to exist at the time the callback is defined. If it does not exist, it will never be called, and the callback will never be used. If it is defined later, the callback defined by after will be remembered.


This must be zero or task arguments, identifying the tasks that should be executed after task_name is executed. Multiple invocations of after will imply the order in which the callbacks are invoked.

after "deploy:symlink", :symlink_database_config
after "deploy:symlink", "uname", "-a"


If a block is given, it will be treated as an anonymous task. The block itself will be invoked after task_name, and will use the same server scope as task_name. In general, using a block with after is discouraged because it makes it harder to reuse code, but there are times when it can be genuinely useful.

after "deploy:symlink" do
  run "#{sudo} ln -nsf /path/to/real/config.yml /u/apps/social/current/config/database.yml"
Something went wrong with that request. Please try again.