4

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.

Sander Marechal
  • 22,978
  • 13
  • 65
  • 96

2 Answers2

8

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).

Sander Marechal
  • 22,978
  • 13
  • 65
  • 96
2

You could just clear the task itself;

Rake::Task["deploy:clear_controllers"].clear

This way the action will still be invoked, but without any effect.

Koen.
  • 25,449
  • 7
  • 83
  • 78