Monthly Archives: February 2007

“Quick and Clean” NOVA RUG meeting tonight with Chad Fowler!

I’ve been so heads down in RoR development that I’ve been remiss in my blogging… But the February NOVA Ruby Users Group meeting is tonight! Chad Fowler is our guest speaker and here’s what he’ll be talking about:

Rails is all about speed. It has been said that Rails programmers can develop software ten times faster than those programming in technologies such as .NET or J2EE. Rails itself is evolving at the speed of light.

But, to paraphrase Martin Fowler’s RailsConf 2006 keynote, with Rails we don’t have to choose between Quick and Dirty and Slow and Clean. With Ruby, and therefore Rails, we can have both speed and maintainability.

With Rails, the speed comes naturally. As it turns out, the cleanliness often doesn’t. This talk will focus on how to make your application development both quick _and_ clean.

Since we have crazy gridlock around here in DC (no I’m not talking about the government), I’ll be picking up any ‘Rug Attendees at the East Falls Church Metro at 6pm. Email me at luis at this domainname if you want in on the shuttle. I’m already taking one fellow Rugger from Maryland and I’ve got room for two more.

Rcov

I’ve started to use rcov on all my Rails projects. A project I had started working on last year had already been doing it but it didn’t really click in my brain until recently. Rcov is a great code coverage tool for Ruby and Mike Clark has a great write-up on using rcov with Rails plus a sample rake task. It includes a command to open up the generated HTML automatically which I usually do afterwards.

I only have one small tweak to Mike’s rake task and that is to sort by coverage by adding “–sort coverage”. What this does, at least for me, is to let me know what classes really need some testing love. And isn’t that what your Ruby classes need this Valentine’s Day? :)

Here’s the patched rake task (credit again goes to Mike Clark for the original rake task):


namespace :test do

  desc 'Measures test coverage'
  task :coverage do
    rm_f "coverage"
    rm_f "coverage.data"
    rcov = "rcov --sort coverage --rails --aggregate coverage.data --text-summary -Ilib"
    system("#{rcov} --no-html test/unit/*_test.rb")
    system("#{rcov} --no-html test/functional/*_test.rb")
    system("#{rcov} --html test/integration/*_test.rb")
    system("open coverage/index.html") if PLATFORM['darwin']
  end

end