Localbuilder on GitHub
Jan 14, 2009 · 1 minute readOne of several little projects I have up and running on GitHub at present is LocalBuilder. It’s a pretty simple little script which watches for changes in a given directory and when they occur runs a given command. I knocked it together to use to trigger the running of a test suite each time I save files in a project. It’s written in Python but you could use it to run commands in any language you like.
It’s all pretty simple Python really and is hopefully reasonably commented and tested so if you’re interested you can follow along with the code. If you just want to use the damn thing then:
<code>./localbuilder --path /path/to/watch --command /command/to/execute</code>
It turns out Ruby has a much nicer tool to do this and more in autotest, part of the ZenTest suite of testing tools. I’m finding more and more very nice bits of code written in Ruby of late, but that’s probably a whole different blog post.