Capistrano 2 Thoughts

written July 30 2007 by
{ Kommen }
Comments 2

A few days ago Jamis released Capistrano 2.0.

I just wanted to write down some things I ran into — maybe someone finds it useful. This article will not be a complete “what is new in cap 2” article.

renamed variables

They now are the same for each version control system.

set variables at runtime

A feature I find really helpful. E.g if you don’t want to store a password in the configuration file.



set :scm_password do
    Capistrano::CLI.password_prompt
end


hooks

To hook into an existing task you now have to specify a the whole taskname including the namespace. E.g.:
after "deploy:update_code", :link_in_configfiles where deploy is the namespace and update_code the task name.

To see a full list of tasks and its namespaces run cap -T.

overwriting tasks

The new namespaces also effects how to overwrite a task. E.g. to overwrite the old :restart task, you now have to write it like that (the restart task also is in the deploy namespace):


deploy.task :restart do
    # restart your servers here
end


I think most other things are documented or mentioned here:

Also, because Capistrano won’t win a price for the best documentation, often a look at the source code can be helpful. It’s clean and easy to understand.

You've reached the end of this page. Feel free to dig into the archives of this blog or subscribe to our newsfeed.