Capistrano 2.2.0

Posted by Jamis on February 27, 2008 @ 09:08 PM

Capistrano 2.2.0 is now available (well, it’s released, anyway, you might need to wait for the file to propagate to the gem mirrors).

gem install capistrano

Version 2.2.0 sports the following changes:

FEATURE: Dynamic role definition. The role() method now accepts a block, which should return either a host name, a Capistrano::ServerDefinition object, an array of host names, or an array of Capistrano::ServerDefinition objects. This can be used to describe the servers in a role at runtime.

1
2
3
4
role :app do
  hosts = some_method_that_looks_up_the_current_hosts
  hosts[0,3]
end

FEATURE: Alternative server-centric role definitions, using the server() method:

1
2
3
4
5
role :app, "server"
role :web, "server"

# the above is the same as this:
server "server", :app, :web

FEATURE: Support for a :max_hosts option in tasks, that restricts the task so that it is only executed in hosts at a time, in chunks. This helps people who use Capistrano with very large numbers of servers, and prevents them running into connection caps and from running out of memory.

1
2
3
4
5
6
7
8
9
10
11
12
13
task :ping, :max_hosts => 100 do
  # anything here will only run against 100 hosts at a time
end

# alternatively, you can pass :max_hosts to the run command itself for
# finer granularity
task :pong do
  # this will run on ALL hosts at once
  run "something"

  # this will run on no more than 100 hosts at a time
  run "something-else", :max_hosts => 100
end

ENHANCEMENT: Improved Git support! Not being a git user myself (yet), I can’t really speak intelligently about what the changes are, but if you use git chances are you aren’t afraid to dig into the code and read it. For those of you that use git, I’d encourage you to blog about the changes, to assuage some of my embarrassment about releasing code that I can’t describe intelligently!

ENHANCEMENT: Password prompt support in the Mercurial SCM.

ENHANCEMENT: Implement Bzr#next_revision so that pending changes can be reported correctly, and use checkout—lightweight instead of branch.

ENHANCEMENT: Bring back the :p4sync_flags and :p4client_root variables for perforce SCM.

Additionally, there are several minor bugs and typos that have been fixed. You can see the CHANGELOG for all the gory details.

As ever, please report bugs via the Rails trac, at http://dev.rubyonrails.org. And if you aren’t yet subscribed to the Capistrano mailing list, it’s where all the cool cappists hang out.

Posted in Announcements

Comments

Have something to add? Click here to leave a comment.

03 Mar 2008

1. Don said...

Hello Jamis,

I’m new to RoR and Capistrano and I’m running into some issues deploying my new application.

A little background: my work station is Windows xp -I have svn command line and svn Tortoise installed I’m deploying to a fedora 8 box (my test box) My svn is on my test box

my deploy.rb file is pretty standard I have it prompt me for my svn password and user name and password for ssh to my fedora box.

the problem:

when I try to do a cold deploy IE cap deploy:cold Capistrano flips my slashes from forward to back.

C:\Documents and Settings\Don\My Documents\NetBeansProjects\someSoftWare * executing `deploy:cold’ * executing `deploy:update’ ** transaction: start * executing `deploy:update_code’ SVN Password: http:\\192.168.1.121\svn\someSoftWare\trunk: (Not a valid URL)

an additional concern: Capistrano seem to mix up the parameters when it does its “svn info” call

c:/ruby/lib/ruby/gems/1.8/gems/capistrano – bla bla bla `query_revision’: tried to run `svn info—username xxx—password xxx—no-auth-cache http://192.168.1.121/svn/someSoftWare/trunk/ -rHEAD’ and got unexpected result ”” (RuntimeError)

When I run it from svn command line it runs fine:

C:\>svn info http://192.168.1.121/svn/someSoftWare/Trunk -rHEAD—username xxx—password xxx Path: Trunk URL: http://192.168.1.121/svn/SomeSoftware/Trunk Repository Root: http://192.168.1.121/svn Repository UUID: 83f63d38-5a67-411b-a7a5-b180abd2e38f Revision: 64 Node Kind: directory Last Changed Author: xxx Last Changed Rev: 64 Last Changed Date: 2008-03-02 20:36:54 -0700 (Sun, 02 Mar 2008)

I read about someone having a like problem and he solved it by Uninstalling svn Tortoise which seems crazy to me. Even it worked there has to be an alternative. Did I mention I’m very fond of svn Tortoise and its user interface.

Thanks for any advice in advance

Don

2. Jamis said...

@Don, I’m afraid I cannot answer support questions here, but if you query the mailing list you might have better luck.

06 Mar 2008

3. dru said...

Thanks Jamis and team. You guys rock! I just started using cap and its been a big time saver.