Making Code Speak

A weblog of tools, techniques, styles and habits for programming with fluency.

Autotest Everything with Rerun

I love continuous testing. In Ruby, I can do it easily with autotest, but other languages aren’t so fortunate – or else I’m new to them, and haven’t learned the ecosystem.

Alex Chaffee’s amazing Rerun gem solves this problem. It’s essentially Guard reimagined as a Unix utility. You tell it what files you want to monitor and what script you want it to run, and it reruns the script whenever the files change. It’ll even send Growl notifications about success or failure if you’re into that sort of thing. It’s written in Ruby, but will work with pretty much anything with no real configuration required.

In the past few months, I have used it to do continuous testing of C, Ruby, Python, and Haskell, as simply as:

rerun -x -p '**/*.{c,h}' make check
rerun -x rake spec
rerun -x -p '**/*.{py}' ./
rerun -x -p '**/*.{hs}' doctest *.hs

(By sheer coincidence, I found this tool on the same day that I met Alex at Burlington Ruby. Nice to be able to thank someone for their open source work at a time when it’s immediately relevant.).

posted by Moss on 10 January 2014