Combining IWatch With Reloader

I had written a post about how to set up reloader.erl about a year ago. Reloader.erl is an incredibly useful library included in mochiweb for automatically reloading erlang libraries if they’ve been recompiled.

I had also written a post about iWatch and phpunit to follow source directories and automatically run a unit test (or other command) when src files change. Really great for rapid development - you can code in one window and just glance over to know if things are working as expected.

Today I started using iWatch to automatically recompile my erlang files, and reloader automatically runs the tests on those files for me as well. It’s kind of awesome.

iwatch -e modify -v -c '/usr/local/bin/erlc -o ebin/ %f' src

Enjoy constant compilation and testing with the above 1 liner.