Welcome to the Gem Teardown for the 2013 Rails Rumble. For background, the Rails Rumble is a competition where teams have 48 hours to build a Rails app from scratch. Teams compete for fame and sweet prizes provided by the Rails Rumble sponsors. The contest wrapped up last week and the winners have been announced. Congratulations to everyone who participated!
The Rails Rumble organizers (especially Tom Mango and Zach Inglis) were kind enough to collect Gemfiles from the teams and provide them to me for analysis. I did a similar writeup last year.
I analyzed 221 Gemfiles. Read on to learn how the teams were able to create such amazing apps in a weekend.
The basic Rails stack:
- Rails - 83% used Rails 4, the rest stuck with Rails 3. Four diehards used Sinatra.
- jQuery - used by 92%. Hard to believe there were a few holdouts.
- Coffeescript - used by 86%. So much for that controversy.
- Sass - used by 81%. The rest mostly used Less. Is it time to declare a winner?
- HAML - used by 33%. 18% of the teams used Slim, which is great progress in my opinion. Everyone else must've used <%= 'ERB' %>.
- Bootstrap - used by 37%. 10% used Zurb Foundation and a few used Neat. Nice to have some competition, though Bootstrap is clearly dominating.
Note for the pedantic: Yes, I know that Coffeescript and Sass are both included in the default Rails Gemfile.
First surprise - Turbo unlinked
This was an eye opener for me - a ton of the Rails 4 teams turned off Turbolinks. I guess the speed boost doesn't outweigh the caveats. Proceed with caution!
MySQL and Postgres are duking it out
MySQL and Postgres were evenly matched at 43% and 37% respectively. Mongo clocked in at an impressive 12% despite all the chitchat on HN. A handful of teams ditched the separate db entirely and used SQLite.
Nine teams used Redis and twelve used Memcache via Dalli. I would've expected more usage, frankly. Those tools are indispensable for me and nearly everyone else trying to build a scalable web app.
A whopping 52% of teams used RSpec for BDD. 38% used FactoryGirl to create fixtures. 23% used Capybara to test user interaction, often in tandem with Poltergeist or Selenium.
I'm curious how many people actually have time for BDD during the 48 hour competition. It's impossible to count tests by reading a Gemfile.
Among those who bothered to specify a server, 20% used Unicorn, 11% used Thin, and 8% used Puma. Puma has some DNA from Mongrel. I don't personally know anyone on Puma and I was surprised to see such a strong showing. Read more about Unicorn vs. Puma here. Note that the default install for the Rails Rumble uses Apache + Passenger, so a web server isn't really required.
13% of the teams used Mina for deployment. Perhaps the recent jump to version 3 will clear some of the cobwebs from Capistrano.
Many of the teams used background jobs, and Sidekiq continues to take mind share from both Delayed Job and Resque.
CarrierWave and Paperclip make it easy to tack file attachments onto models. I've used both and I don't have a recommendation. They both seem quite capable to me.
Compass and Bourbon both aim to provide a comprehensive set of Sass mixins to take the pain out of writing CSS. I'm mildly ashamed to admit that I mostly rely on the mixins provided with Bootstrap. Bourbon looks to be gaining traction, possibly due to its relationship with Neat. A couple of teams used both libraries for ultimate CSS power!
This continues to be a crowded and competitive space, with Honeybadger opening up a slight lead over the New Relic juggernaut. Personally I wish that one of these services would find a way to replicate the awesomeness of Crashlytics, minus the denim. Reminder note to self: don't create a startup to handle 500 errors.
Popular gems that everyone loves
An amazing 46% of the teams used Devise for authentication, often with an OmniAuth plugin to facilitate logging into Facebook, Github or Twitter. If you have user accounts, you should probably be using Devise.
37% of the teams added Better Errors, which dramatically improves the standard Rails error page. You can even get a console in there, which is awesome/terrifying.
33% of the teams kicked IRB to the curb in favor of Pry. Have you ever wondered what it would feel like to
cd into an object? Take a walk on the wild side!
Honorable mention goes to Guard, which watches your filesystem and responds by running commands. You can make it magically re-run your tests or refresh your browser in response to a template change, for example. Neato.
Third party APIs
Let's face it. If you only have 48 hours to create an app, wouldn't it help to piggyback on someone else's business? We're all standing on the shoulders of giants. Here are the most popular third party APIs used in the contest:
Finally, I'd like to use my editor's pen to highlight some of the fantastic and fantastically quirky gems that were used for the contest. Definitely check them out:
- Annotate - decorate models with a comment showing the current schema
- Awesome Print - pretty print Ruby objects. Essential, in my opinion.
- Flutie - page_title and <body> class helpers. We've been doing this manually for a long time.
- FriendlyId - create pretty URL slugs for models
- Inherited Resources - best practice restful actions that you can inherit in your controller
- PublicActivity - mix activity tracking into your models ("newsfeed")
- Whenever - DSL for writing and deploying cron jobs
Thanks again to the Rails Rumble organizers (especially Tom Mango), the sponsors, and everyone who participated.