Localbuilder on GitHub

One 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:

./localbuilder --path /path/to/watch --command /command/to/execute

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.

Comments

  1. Good stuff Gareth.

    Someone did something similar a couple of years back that called Nose on directory change:

    http://jeffwinkler.net/2006/04/27/keeping-your-nose-green/

    Simon Scarfe - 15th January 2009

  2. Sounds like a great setup.

    Locally building is something that hasn’t come up at CITCON before. I’d love to have someone attend and share their experience with it.

    Instead we’ve heard more about pre-flight builds which are the opposite, about running your local changes on a remote server. I suspect that people are relying on that feature instead of making their builds fast enough for this kind of local CI.

    Jeffrey Fredrick - 25th January 2009

Leave a comments