Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove hook from flow in Capistrano 3

I want to deploy my PHP application using Capistrano 3. My application uses Symfony 2 as a framework and Phing as a built system. I have installed capistrano-symfony so I can use Symfony commands from inside Capistrano.

The problem is that it also modified the deployment flow. Specifically, it adds two tasks here:

https://github.com/capistrano/symfony/blob/master/lib/capistrano/tasks/symfony.rake

  after "deploy:updated", "deploy:clear_controllers"
  after "deploy:updated", "deploy:assets:install"

Is there any way to remove these hooks from the flow again? These actions are already performed by my Phing build script (which is invoked by Capistrano). There is no need to run them again.

like image 758
Sander Marechal Avatar asked Dec 26 '22 11:12

Sander Marechal


1 Answers

Finally figured it out, partially. I can remove named before hooks, but not before blocks or after hooks (because they are converted to a block inside Rake). I added this to my deploy.rb:

Rake::Task['deploy:updated'].prerequisites.delete('composer:install')

I figured out that I didn't need any of the after hooks, so I simply cleared them:

Rake::Task['deploy:updated'].actions.clear()

The only thing I can't figure out yet is how to clear specific after hooks, because they end up as blocks (i.e. anonymous functions).

like image 186
Sander Marechal Avatar answered Dec 28 '22 09:12

Sander Marechal