When Files Change – Simple Automation


I thought I’d share a simple utility I wrote that has saved me a lot of time in the past.

when-files-change watches your current directory, and whenever a file changes it executes a command you provide. For instance, to run my tests whenever a file changes, I could do:

when-files-change -- rake test

If you want to force it to run again, hit enter.

Tools like sass and mocha ship with their own options to watch directories, but many don’t. Installation is simple, just run:

gem install when-files-change

That’s about all there is to it.