I’ve spent some time this evening playing with SwitchTower. It’s a tool for deploying Rails applications. It’s just perfect for sending what’s on my test environment (Mac) up to my server (FreeBSD). Not only that, it’s relatively simple to get going, compared to many other deployment tools I’ve used (and written) in the past.

But it’s also very flexible. For example, just when I thought I’d gotten everything set up and running, I discovered that my database.yml file was wrong. It’s fine for development, but not the live server. Yet switchtower has a really handy feature where it can render a template into a file. So now I get my database.yml generated on install, pointing at the right place.

task :after_update_code do
  buffer = render("config/database.yml.rhtml", :shared_path => shared_path)
  put buffer, "#{release_path}/config/database.yml", :mode => 0644

Anyway, if you’re doing Rails at all, invest some time in learning SwitchTower. It doesn’t take long, and you’ll be much better off for it.