This post was first published on the imedo.de devblog. The blog went offline in 2012, so I migrated the posts to my personal blog.

Capistrano 2 supports custom deploy strategies. You basically just have to implement the “deploy!” and “check!” methods in your class and you’re good to go.

But how do you tell Capistrano to use your strategy?

I looked into the code and found no way of setting your strategy. So I changed capistrano, that it’s possible to set the strategy. When I asked Jamis Buck to pull the change, he suggested that I just set the strategy directly. This approach wouldn’t need any changes to to code base.

Well then we went ahead and did just that. So here’s the code for setting your custom deploy strategy (Don’t forget to require the file with your code)


set :strategy, Capistrano::Deploy::Strategy::DifferentAppRootRemoteCache.new(self)

It works like a charm.

Related Posts