Capistrano 1.1

Capistrano is a utility for executing tasks in parallel across multiple remote hosts. It was formerly known as SwitchTower.


gem install capistrano

Version 1.1 introduces a few changes:

  • The generated capistrano.rake file is simpler now than it used to be. You can easily append custom options to individual tasks now. For instance, if you want the deploy to be silent, instead of verbose, just add “-q” to the parameter list for that task.
  • The generated capistrano.rake file uses the “remote” namespace, so you’ll need to have at least Rake 0.7.0. You can still do “rake deploy” and “rake rollback”, but the other tasks must be prefixed with the namespace (“rake remote:exec”, “rake remote:show_tasks”, etc.)
  • The ‘switchtower’ command is replaced by the ‘cap’ command.
  • The cap utility is verbose by default. If you want it to be silent, use the -q option. If you want it to be less verbose, you can specify the -v or -vv flags explicitly.
  • The cap utility uses more rake-like command-line semantics. Instead of needing to do “cap -r config/deploy -a deploy”, you can just do “cap deploy”. It will look for config/deploy.rb, capfile, or Capfile automatically, and will treat raw parameters as action names.

Upgrading/switching from SwitchTower to Capistrano is a little inconvenient. Here’s what you’ll need to do:

  • gem uninstall switchtower (remove all versions)
  • gem install capistrano
  • For each of your Rails projects, do “cap -A .”, keeping your deploy.rb
  • For each of your Rails projects, remove lib/tasks/switchtower.rake


SwitchTower is now Capistrano

We were served with a “cease and desist” from Raindance Communications, Inc. over the use of their registered trademark SWITCHTOWER on Friday. This led to a wild three-day brainstorming session and a new name for SwitchTower: Capistrano.

New gems and so forth will be available tomorrow, as well as updated documentation using the new name. For existing SwitchTower users, you’ll need to run cap -A . on each of your projects, once the new gems are available and installed. (cap is the new name of the switchtower utility.)

You can read all about the brainstorming process and how the new name was selected on Jamis’ blog.

Rick Olson joins the Rails core

Rick Olson aka technoweenie has been granted the rank of core and will join the new 12-strong group of developers with commit rights to the Rails source.

Rick has long been a prominent figure in the Rails community with ton of great plugins to his name, but it has been his work on Rails 1.1 that made us realize that he was an obvious fit.

From the upgraded calculations, to enumeration support for RJS, to his work on eager loading, and a ton of other minor issues, Rick has shown strong knowledge and ability across the code base. When Rails 1.1 is released shortly, you’ll be using a lot of Rick’s code.

So congratulations, Rick! You’ve joined the exclusive club of Rails core committers.

Sneak peak at effortless deployment with Rails Machine

SwitchTower author Jamis Buck has provided an excellent manual documenting how to use it. Those who’ve taken the plunge are loving how easy it makes deployment, as well as myriad other tasks. But I’m still always hearing, “We haven’t setup SwitchTower yet but are really looking forward to”.

Enter Rails Machine. It sets out to lower the barrier to using SwitchTower by taking care of all the setup and maintenance. They are scheduling to open their doors in April. For now take a look at the short movie they’ve made showing how easy they’ve made it for you to get going with SwitchTower. They get you up and running in under 5 minutes. No more excuse to not realize how much you love SwitchTower.

RubyConf 2006 location announced

Hot on the heals of the fervor behind the upcoming RailsConf, the location of RubyConf 2006 has been announced. This fall it’s going to be in Denver, Colorado from October 20-22, 2006.

Two years ago we had about 70 people at RubyConf. This past year we stopped accepting signups months before the event when 200 tickets were sold. This year’s conference promises to have huge demand.

Venue, schedule and registration should be opening up in the Spring. Keep an eye on the RubyConf site as more details trickle out.

Big thanks to David Black and the others behind RubyCentral for their tireless work setting all this up.

Annotated models

Ever working with a model and you forget what all of its columns are? Ever find yourself with your schema.rb open in a separate window so you can see what the structure is of your tables?

Dave Thomas, of Rails Pragmatic Studio fame (among a brazillion other things), hacked up a plugin that adds a comment block to the top of all of your model classes documenting the current schema for the given model. It ends up looking something like this:

  1. Schema as of Sun Feb 26 21:58:32 CST 2006 (schema version 7)
  2. id :integer(11) not null
  3. quantity :integer(11)
  4. product_id :integer(11)
  5. unit_price :float
  6. order_id :integer(11)
class LineItem < ActiveRecord::Base belongs_to :product

When the schema is updated, the comment is updated to reflect the new schema.

Install it with the plugin script:

script/plugin install

Run it with a custom rake task:

rake annotate_models

Check out the caveats in the README.

Thanks for sharing Dave.

Getting Real: How to build web apps like 37s

So now that we’ve forced our technology of web applications upon the world with Ruby on Rails, we decided to get opinionated about everything else involved too. Getting Real, the book is a 171-paged PDF that sells for $19 and tries to explain the guiding principles behind Basecamp, Backpack, Writeboard, Ta-da List, and Campfire. The why’s and the how’s.

If you’re doing web application work for yourself or others, there should at least be a handful of essays that gives you a bright idea or the motivation to make a change. And we’re giving away four of the 91 essays for you to sample first. Yay, free stuff!

New in Rails: Enumerable#group_by and Array#in_groups_of

Changeset 3726 adds two little methods to ActiveSupport: Enumerable#group_by and @ Array#in_groups_of@.

Enumerable#group_by is for collecting an enumerable into sets, grouped by the result of a block. Useful, for example, for grouping records by date.

     latest_transcripts.group_by(&:day).each do |day, transcripts| 
       p "#{day} -> #{ * ', '}"
     "2006-03-01 -> Transcript"
     "2006-02-28 -> Transcript"
     "2006-02-27 -> Transcript, Transcript"
     "2006-02-26 -> Transcript, Transcript"

Enumerable#group_by will be baked right into Ruby in the future, and currently lives in the 1.9 branch.

Array#in_groups_of let’s you iterate over an array in groups of a certain size, optionally padding any remaining
slots with a specified value (nil by default).

     %w(1 2 3 4 5 6 7).in_groups_of(3) {|g| p g}
     ["1", "2", "3"]
     ["4", "5", "6"]
     ["7", nil, nil]

You gotta love the elegant encapsulation afforded by blocks! Yield.

Two Ruby articles in the latest ObjectiveView

ObjectiveView, a journal for software developers that focuses each issue on a specific topic, has two Ruby related articles in their latest issue, New Technologies Focus.

The first is an introduction to Ruby by Amy Hoy. She brings her quirky right-brained ebullience to bear, providing a thorough yet accessible tour of Ruby. She emphasizes that one of its most salient characteristics is that it makes you happy. If her writing style is any indication, she’s loving life.

ThoughtWorker Obie Fernandez serves up the other article which demonstrats what DHH’s often cited phrase “opinionated software” means and how it relates to Rails. Keep an eye out for Obie’s upcoming book, Extending Ruby on Rails (Into the Enterprise) which is expected out in Fall 2006 by Addison-Wesley.

These two tutorials provide a nice introduction to both Ruby and Rails.

Past issues of ObjectView which focus on such topics as agile development, use cases and componentized development, are also available, so check out the rest of the back issues on their website.