Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you add some steps to a capistrano task?

Tags:

capistrano

I'd like to stop some processes before running the deploy:migrate task. I know that I can redefine the deploy:migrate task by copying the existing code and adding the stop/start steps at the beginning and end of the task.

I'm wondering if there is a way to avoid copying the code from the default deploy:migrate task in my version of the task. Is there a way to refer to the existing deploy:migrate task when defining a new task of the same name?

like image 335
readonly Avatar asked Oct 08 '09 21:10

readonly


1 Answers

Rather than redefining deploy:migrate, you should define a before or after hook for it. First, create a new task that does the stuff you need to do:

task :custom_name do
  # whatever you need to do
end

And then set this new task to be run before or after the deploy:migrate task by doing one of the following:

before "deploy:migrate", :custom_name
after "deploy:migrate", :custom_name
like image 63
Emily Avatar answered Oct 21 '22 23:10

Emily