lazy saunter

(personal learnings in computation)

Tuesday, March 11, 2008

build tools, like ant (2)

in the last post i introduced the idea of writing a program that would execute a batch of operations in order that a web site be updated. i mentioned three options: (1) a shell script (or a perl script), (2) the unix build tool "make", and (3) the java build tool "ant".

first, the goal was to delete a web directory and a configuration directory and then export the web and configuration files from a CVS repository back to those same two locations.

after attempting to achieve these aims through the three methods, i can report on my impressions of each:

(1) writing the shell script itself was extremely simple and extremely quick, consisting of only five lines of code:

#!/bin/sh
rm -rf /etc/includes
rm -rf /var/www/html/kepler
cvs export -D now -d /etc/includes/ kepler/incs
cvs export -D now -d /var/www/html/kepler/ kepler/web

one disadvantage is that these commands are written for linux and would not work on a windows machine. but of course, in that case, the directory names would have to be different as well and a similar script could be created for windows i reckon.

(2) researching "make", i got the impression that it is only used for C and C++ programs while i want to move php files around here. also, syntax is strict and seems confusing. i did not even try to use "make" for this project.

(3) i was able to make ant work on both a windows xp machine (relatively quickly) and on a fedora core 5 machine (after a long struggle with which java version it needed to use) and used it to work with java programs as well as with my project to export cvs files to selected locations. while it worked the same as the shell script, this process took much longer. an advantage is that the ant build script ran on both platforms and it is much more neatly packaged (in xml format) than the shell script.

final thought: while the shell script accomplished the goal most efficiently in the given context, i plan to use ant more in the future in order to familiarize myself with its simpler features so that i can learn its more complicated features more quickly later on.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home