Capistrano 2 Thoughts

written July 30 2007 by
Kommen
tagged with
2 Comments so far. Go, post one!
Previous 3 Years Ruby on Rails
Akismator — The Better… Next

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.

2 Comments

Make our day bright and participate!
Permalink to this comment { Kid }
on September 10 2007 (about 17:24 PM)

Man you don’t even know how long I’ve waited for this since disabling my own Movable Type widget (that doesn’t work since Haloscan bypasses that code).

THANK YOU!

Permalink to this comment { Adam }
on September 14 2007 (about 15:46 PM)

well, that’s really very usefull… Thanks a lot!