Scripting Fun Part 1: Dogfood

by Charles Miller on February 17, 2004

Today was scripting day. The aim was to throw together a quick-and-dirty shell script that would:

  1. pull the latest source out of CVS
  2. build and deploy it on a test box
  3. trigger a second Confluence server to start a suite of FatCow tests, confirming that the build did, indeed, work
  4. spam the Confluence developers with the results.

All in all, it turned out pretty well. It's a particularly nice feeling to be using your software to test itself: just a little more proof that you might indeed be working on something useful.

The unfortunate end-result, though, was that I ended up using three different scripting languages to accomplish this end -- four if you count the pre-existing Maven build system.

The bulk of the scripting was done in a bash shell-script. Then as I neared the end of the task, I found I needed to send an HTML MIME email message and found a quick Python recipe on the net that suited my purpose well. Then, when someone's mail client wasn't coping very well with multipart/mixed content, I had to munge all the results into a single document. For this sort of text processing, of course, Perl seemed the obvious choice.

I did try to go back to two languages by rewriting the mail stuff in Perl's MIME::Lite, but I stuffed something up in the process, and the mail was coming through with rather serious formatting problems.

All this is possibly a side-effect of having a casual acquaintance with several languages, rather than a deep and abiding relationship with one. If I were a Python guy, or a Perl guy, or even a dedicated shell guy, I would have been able to throw everything together in a single script, instead of mashing together my fragments of knowledge of each language.

I would have attempted to do it in one language if I could have used Ruby, but it wasn't installed on the server and I didn't want to install an entirely new language just to run one page of script.

One idea I had was to rewrite the whole thing in Groovy, but the idea scares me. I fear that if the scripts have access to Java libraries, they will begin to accrete dependencies until we need a build script to manage the build scripts.

Previously: ESR on Opening Java

Next: How to Write Perfect Software