Capistrano 2 Callbacks

Converting the callbacks in my cap recipes to the new capistrano 2 format wasn’t as easy as I thought it would be. It turned out I had to use fully qualified task names in the after callback instead of the non-namespaced-names.

Here’s a sample of working callbacks:

namespace :deploy do
  after "deploy:setup", "deploy:sposivip:create_galleries", "deploy:sposivip:freeze_rails"
  after "deploy:update", "deploy:site5:link_public_html", "deploy:sposivip:link_rails", "deploy:sposivip:link_galleries"
end

Here I have two callbacks. The first one runs after setup, creating shared paths and freezing rails in the shared directory, so I avoid having a copy on rails in each release.

The second callback runs after deploy:update, so it will be called whenever I do a simple deploy or a cold deploy, it links back various directories in the shared path and it links the shared rails in vendor.

One Response to “Capistrano 2 Callbacks”

  1. links for 2007-08-24 -- A Tempest of Thoughts Says:

    [...] Capistrano 2 Callbacks (tags: capistrano capistrano2 callbacks rails programming ruby deployment) Last Modified : August 25th, 2007 Filed under : Del.icio.us Navigate : Previous post / Share : [...]