Rails Project Tools Setup
I thought it might be useful to aggregate the tools I put in place now when starting a new project. There are a host of services out there that provide simple, beautiful feedback on how good your code is, if it's working, help you organize your project, and let you display all that nicely on your Github repo. I'm arranging these in order from easiest to integrate to most complicate, though they're all pretty simple.Â
Waffle is a project management site, very much in the style of Trello, except that it has automatic integration with your Github issues. I find it's interface much more useful for organizing a project than Github's issues, and without the overhead you'd get with Trello, having to enter everything twice. You just sign in to Waffle via Github, tell it which repo you want it to watch, and you can even get it to send you a pull request that, when merged in, will put a badge in your Read Me showing where you are in your project.
Hound is a tool provided by Thoughtbot (and god, do they have some amazing open source stuff available to people) that barks at you every time you violate the Thoughtbot style guide. Once you tell it to watch a repo, when you make a pull request it will comment on the lines that violate the style guide, telling you what to fix. It's a huge pain at first, but it will bootcamp you into writing good code. (Though I'm not sure we'll ever see eye to eye on the single-quotes, double-quotes thing, guys)
After that, Code Climate.
Code Climate is another great tool for making you write clean code, or at least refactor. It grades files individually on things like optimal syntax, complexity of methods, and repetitiveness of code. Like Waffle, it has a badge available (though you have to manually add the markdown) for your Read Me that will update with your 'code GPA'. I highly encourage you to add it, as seeing a low mark up on your repo for all to see definitely makes you more likely to go back and refactor. Code Climate really helped me internalize the principles of DRY and OOD - it helped me see when I needed to get rid of repetition and refactor things out into their own methods and objects.
Travis will run your test suite for you, and let you know if your build is passing or not. This requires making some actual (minor!) changes to your project, but it's well worth it so that you can be sure you don't break the build, and don't have to sit there like a bump on a log while your test suite runs.
You'll want to create a .travis.yml file at the root of your app that looks like this.
Now, whenever you issue a pull request you'll see a link to your Travis build in progress, and it will go green if it passes, red if it breaks, or grey if it errors. Once again, you can get a shiny markdown badge for your Read Me.
Coveralls will let you know what percentage of your app is covered by tests, and can even show you what lines in what files aren't covered. Once again, you'll have to add a couple of things to your app.Â
They're available in a gist here.
You know the drill by now, badge with test coverage is available.
That's all folks! I found many of these cumbersome and annoying at first, but on a project of any scale (or one where you're working with multiple people) they're invaluable. Plus, they let newbie coders get continual feedback on the quality of their work, without needing someone to constantly check it for them.