Raygun: Hit the Ground Running When You Start Your Next Project

We start new Rails projects all the time, for client, side and internal projects. Each time we do the dance to get things just the way we like them. You probably have a similar process: switch the view library, set the database, use rspec, tweak this and that, etc. Even when you do it all the time, it still takes a little while to get to the point where you’re cranking on features.

We want to hit the ground running when starting a new project, so we created Raygun, an opinionated app generator. There are others out there, two that come to mind are Appscrolls and Suspenders. Folks have been talking about the “prime” stack (see Primo) too. We want something that captures how we do things at Carbon Five (at least on most of our projects).

What does the stack look like?

Raygun generates a new app with these libraries, all configured and ready to use:

Tweaks, Recipes, and Best Practices

Raygun also bakes in a handful of configuration tweaks that we think are useful for most projects. Here’s a sample:

  • User model with sign in, sign up, password recovery and administration (see auth* below)
  • Ready for deploying to Heroku
  • Transactional acceptance specs
  • rake db:sample_data to load a small set of data for development
  • Pull the secret token from the environment
  • Threadsafe enabled by default (as will be the case with Rails 4)
  • Enable basic auth by setting an environment variable
  • Create .ruby-version and .rvmrc
  • Use mailcatcher if it’s listening
  • Bootstrap compatible layout and custom view generator templates
  • Custom spec generator templates that use factory girl when appropriate

Code Generation

Code generated by default is usually far enough from what I want that I don’t use generators. Raygun includes custom generator templates so that scaffold (view, controllers, and specs) includes what you would expect for use with Slim, Sorcery, Cancan, Bootstrap, Rspec, and Factory Girl. It’s not perfect, but it’s more useful than what you would get otherwise.

The templates are right in the project’s lib directory, so you can tweak them for your project and its evolution.


Raygun also includes a simple user scaffold with authentication views/controllers based on Sorcery. These may be useful and also serves as examples of how to use Cancan for authorization. Not every app needs auth and a future version of Raygun will have a flag for leaving it out.


Start with gem install raygun. Be sure to check the requirements before doing anything with your freshly generated app. Otherwise you may experience a misfire. Then, fire away…

Then explore the code to see what’s included.

What’s Next?

I created Raygun not only to have something that might be useful, but also so that it could focus discussion about the Carbon Five Stack within our organization. We don’t all share the same preferences and that’s okay. Raygun is going to evolve as our preferences and options change. In the near term, I hope to roll out Rails 4 support and add a flag for leaving out the auth bits. Submit a pull request if there’s something you think should be part of it.

We’ve used it on a couple of projects and want to let others know about it. Be kind, this is Raygun’s first exposure to the outside world. Something will probably break. Let us know and we’ll fix it up real quick. Enjoy!


  • v0.0.22 includes a fix for ubuntu users

About Christian Nelson

Christian is a software developer, technical lead and agile coach. He's passionate about helping teams find creative ways to make work fun and productive. He's a partner at Carbon Five and serves as the Director of Engineering in the San Francisco office. When not slinging code or playing agile games, you can find him trekking in the Sierras and playing with his daughters.
This entry was posted in Web and tagged , , , , , , . Bookmark the permalink.
  • pguardiario

    I’m getting a lot of these: sed: can’t read s/AppPrototype/Blogger/g: No such file or directory

    Shelling out to sed seems like a strange choice.

    • Christian Nelson

      Are you running the raygun gem or from a cloned copy of the repo?

    • Christian Nelson

      I’m assuming you’re on ubuntu. I just pushed v0.0.22 with a fix for ubuntu. Thanks!

  • http://twitter.com/MostlyHarmlessD Dom Barker

    Love it….apart from LESS – can’t live without Compass. I know, I know, omkase etc :)

    • Christian Nelson

      Dom, to be honest we’re a little torn here between less and sass. I like less because it’s simpler and has the features I need without much else. It also compiles quite a bit faster than sass. Sass has some great stuff and some folks really like compass. Like many things, it’s not an easy choice. :)

  • http://twitter.com/cs44 Chad Seeger

    Rockin! Thank you C5!

  • Jeff Emminger

    Didn’t Mythbusters disprove the “hit the ground running” concept? :P

  • Chris

    I’ve just installed this using ‘gem install raygun’ and I get this :

    raygun blogger

    Creating new app Blogger in directory /home/chris/files/code/play/blogger…

    sed: can’t read s/app_prototype/blogger/g: No such file or directory
    sed: can’t read s/app-prototype/blogger/g: No such file or directory
    sed: can’t read s/AppPrototype/Blogger/g: No such file or directory
    sed: can’t read s/App Prototype/Blogger/g: No such file or directory
    sed: can’t read s/SUPER_SECRET_TOKEN_REPLACE_ME_TODO/e7533a2491ef867eb86918d0c27412dd2de1eea02ec0455aa9da4b6c1c2773124ede1b2378f0fd78253ac17d84e91f454defe0df5b83ac7b8dbe110df5f119f05ee5bd0a0ffc79f2d570a8111e92e3de93dd2cd6d7788f0e11ae348a5abd6e72123899c09e9c7a85464879da298bb915ece1598cf4cf3149ca3dd1fdb6aa885c/: No such file or directory
    sed: can’t read s/1.9.3-p327/1.8.7-p371/g: No such file or directory
    sed: can’t read s/1.9.3/1.8.7/g: No such file or directory
    Done! Next steps…

    • Christian Nelson

      Chris, what operating system are you running? We use sed to do a bunch of search and replaces and those commands are failing. I test under mac os x, but haven’t tried windows or linux yet.

      • Chris

        Linux : Ubuntu 12.04

        • Christian Nelson

          I’ll test things out on ubuntu and work on a fix. Thanks!

        • Christian Nelson

          v0.0.22 has been pushed and should work on ubuntu. Thanks!

  • somazx

    Is that a DoTA 2 T-shirt you’re wearing? ;-)

  • http://www.davidkewal.com/ David Kewal

    Anyway to manually flag out the auth for now? I’d like to roll in Devise instead of Sorcery.

    • Christian Nelson

      No flag yet. It’s a little tedious, but pretty easy to pull the authentication stuff from the project, as a stop gap.

  • Pingback: Raygun: Generating Rails Apps for the Last Year | The Carbon Emitter