Monday, January 11, 2010
Self executing watchr script
watchr monitors a directory tree, and triggers a user defined action whenever an observed file is modified.
Example test.watchr:
This script executes
To start watchr run
In order to execute this script itself insert a shebang and do
Now you execute that script with
Nice, uh? :)
Example test.watchr:
watch("lib/(.*)") { system "rake" }
Signal.trap("INT") { run_tests }
This script executes
rake test
whenever a file in lib/
changes.To start watchr run
watchr test.watchr
on command line.In order to execute this script itself insert a shebang and do
chmod a+x test.watchr
:#!/usr/bin/env watchr
watch("lib/(.*)") { system "rake" }
Signal.trap("INT") { run_tests }
Now you execute that script with
./test.watchr
.Nice, uh? :)