I have a Capistrano recipe that declares a before_deploy task to perform some backups before a deploy occurs for a Rails app that will go into production soon.
This works fine when I execute "cap deploy", but does not execute at all if I do "cap deploy_with_migrations". I think that it should execute, as should an after_deploy task if it is defined. The reason is because they do almost the same thing, except there is migrations involved in the middle of the latter. If you know you don't need to do a migration, you can just run "cap deploy" and if you do, then you can run "cap deploy_with_migrations" and that should be the only difference. I looked in Capistrano Edge and saw "deploy_with_niftiness" which is a good hypothetical where I think before_deploy/after_deploy should also be executed.
Paul Goscicki blogged about encountering the same problem and expecting the same behavior at http://paulgoscicki.com/archives/2007/02/late-night-capistrano/
I looked at the capistrano source code and can think of a few ways to fix this:
1. Put a patch into actor.define_task to look explicitly for name == "deploy_with_migrations" and in that specific case, send "before_deploy" and "after_deploy". What it will do now is "before_deploy_with_migrations" and "after_deploy_with_migrations".
2. Do the same patch, but look for anything that matches "foo_with_bar". That could be a convention that means it is almost the same as foo, but slightly different and so "before_foo" and "after_foo" should be called.
3. Change standard.rb to put in an explicit call to before_deploy and after_deploy in deploy_with_migrations task.
I've already made a patch doing it way 1, but it seems like way 2 would be the most elegant. Way 3 seems to break the spirit of the before/after hooks.