Integrity Growl Watcher

15 September 2009


If you don’t know what these two things are or why you’d want them to work together, you won’t get much from this post.

Growl notifier for remote Integrity server

I wanted to use a Growl notifier, so when I did a “git push” I didn’t have to reload the Integrity page to see if I’d broken something. David Calavera has a nice little growl notifier, but it basically assumes your Integrity server is on the same network as your local box. I wasn’t excited about figuring out how to poke a hole in my firewall just for Growl, and I’m often working remotely.

So I hacked up a little script to pro-actively check on my Integrity server every time I push to origin/master.

The details

Here’s the script: This is how it works:

  1. It’s an executable ruby script (I put it at /usr/local/src/integrity-growl-watcher).
  2. I run it just after a git push. (I’ve got an alias, named for the phrase git push integrity growl: alias gpig="git push origin master && integrity-growl-watcher").
  3. There’s an .integrity file in the root of my git project to set the feed URL (see gist).
  4. integrity-growl-watcher reads that file and starts checking my Integrity atom feed every 10 seconds. The script assumes you’re running it from the root of your git project, and fetches the most recent commit from there. It does assume you’ll be building the most recent commit.
  5. My git push of course has a post-receive hook to trigger my Integrity build.
  6. Eventually, my build is successful (of course), the Integrity feed is updated, and the script sees this and sends me a little Growl note to let me know: Integrity growl notification
  7. It doesn’t go forever — it times out after about 5 minutes, so if your build totally fails with no warning, it will let you know.

Setup should be pretty easy — just make sure you’ve got all the gems installed. I thought about packing it up as a gem but it seems too small for that.

Let me know (contact info at whatcould) if you fork and fix anything, I’ll add your changes to my version.