Fishing For Trout In Our Suspenders

It’s been a long time coming but I came
Been a lotta fun, lotta pain
A lotta shit changed. I used to hop trains
now I’m hoppin in planes headed to Maine

Peter Gunz, probably talking about open source software and maybe Hoptoad.

The backstory

thoughtbot created a “rails-template” Subversion repository in 2007 which we used instead of the rails command. Projects got going faster using the configuration and dependencies we’d grown to appreciate.

When we switched to git in 2008, we named the repository “Suspenders”.

Since then, Rails has seen tons of improvements, we’ve started using jQuery, Timecop, Formtastic, RSpec with Shoulda, and lots of other great projects. All of that stuff would go into Suspenders.

What was cool was you’d run a command to update all the “best practices” in Suspenders into all of your Rails apps. Something like:

git pull suspenders master

However, some things sucked about this:

  • Enjoy that giant git history stretching back over 3 years in your “fresh” Rails app.
  • Not actually using the rails command so if we screwed up updating Rails, you might be missing some of Rails awesomeness.

New Suspenders

The New Suspenders is a Ruby gem that installs a suspenders script which runs rails with a Rails template to cleanly create a Rails 3 project.

It then uses Trout to let you update individual files to the latest and greatest Suspenders version.

So the workflow is now:

gem install suspenders
suspenders create my_sweet_app

You now have a Rails 3 app with jQuery, Paperclip, Flutie, RSpec with Shoulda matchers, and all that jazz included and configured correctly. A fresh git repo with a clean history wraps all that new code in its sweet embrace.

A few months go by and Suspenders gets some great updates that you want to pull into your app:

trout update Gemfile

Made possible by…

A big reason this is now possible is Bundler and Rails 3. Suspenders is good example of what they have made possible by cleanly separating concerns. Thanks to Yehuda, Carl, and the others responsible.

Working with those enablers, Mike Burns made the Suspenders gem and command line interface and Joe Ferris made Trout.

Give it a shot

It’s taken years to reach the current state of what all our Rails app should contain and how to cleanly separate concerns of “template” and “updating from best practice repo”. However, we’re excited about where we’re at now and hope you will be, too.

Note that there’s no official upgrade path for existing Suspenders apps.

Give it a shot!

Hound automatically reviews Ruby, JavaScript, and CoffeeScript code in your GitHub pull requests and comments on style violations. It is free for open source repos and $12/month per private repo.