Sunday, February 4, 2007

Capistrano 1.4.0

Posted by jamis

Capistrano is a utility for executing commands in parallel on multiple machines, such as for automating the deployment of applications. Version 1.4.0 is now available.

To install:

gem install capistrano

Version 1.4.0 fixes a few bugs, and adds a few features. The new features:

  • A “capture” helper has been added, to make it easy to capture the stdout of a remote command and return it as a string:

result = capture(“uptime”)

  • A “get” helper has been added, to mirror the “put” command, letting you easily download files from a remote server to the local host. It will only download from the first server that matches the criteria for the current task. You must have Net::SFTP installed (gem install net-sftp) in order to use the “get” helper.

get “#{current_path}/log/production.log”, “logs/production.log”

  • Support for a system-wide config file has been added. If a file exists in “/etc/capistrano.conf”, it will be loaded immediately after the standard recipe file is loaded, and immediately before any user-specific configuration.

The fixed bugs:

  • There used to be issues with cap hanging when running multiple capistrano instances at the same time when using gateways. This has been fixed.
  • The permissions tweaking in the standard recipe has been refactored into a separate task (set_permissions), which you can override if you are on a host that won’t let you set group-writable permissions.
  • The setup task now uses umask so that intermediate directories are created with the proper permissions.
  • Make sure the standard recipe loads first, so that .caprc and friends can oerride what it defines.
  • cold_deploy now calls update instead of deploy, to avoid invoking the restart task.
  • The ‘touch’ command in update_code now sets TZ to UTC for the duration of that command, so that asset timestamps are set correctly.
  • An off-by-one bug in the width computation for show_tasks has been fixed.

Minor deprecations:

  • The c/-caprc switch has been removed, since the new load order (standard, system, user, application) makes it meaningless.

Thanks to Mark Imbriaco, Neil Wilson, Bojan Mihelac, Joshua Wehner, and Mike Bailey for their contributions to this release.