LV 2007 July 05
So, I've been playing with activetcl's teacup command for the past half year or so and found myself nearly every day performing at least three actions with it.
So, the following is a ksh script (probably will work with other unix shells as well, and also probably simple enough to convert to tcl) that automates the process.
It got its first big work out this morning - my test copy of activetcl is installed in /tmp - and they rebooted the machine (and deleted all contents of /tmp) while I was away on vacation... so brew got its chance to work through the process.
#! /bin/ksh # run 3 standard teacup commands. Evolve this script, over time, # to query the user if there are potential things to install # First, update teacup itself, so we are using the latest code teacup update-self # Now, read the results of teacup and install items found function steep { if [ "$#" -ne 1 ] ; then echo "USAGE: steep file" >&2 return -1 fi line="#" while [ x"$line" != x"" ] ; do case "$line" in entity*) ;; ---*) ;; *entities\ found*) ;; profile*) echo "not processed: $line" ;; package* | application* ) echo "process $line" cmd=$(echo "$line" | awk '{ printf "teacup install %s %s -is %s\n",$2,$3,$1}') echo $cmd $cmd ;; *) echo "unknown line: $line" ;; esac read line done < $1 return } # Next, determine whether anything already installed has been updated teacup list --only newer > /tmp/.lwv/teacup_newer.txt 2>&1 echo "0 entities found" > /tmp/.lwv/teacup_nohits.txt cmp -s /tmp/.lwv/teacup_nohits.txt /tmp/.lwv/teacup_newer.txt if [ $? -ne 0 ] ; then # something was returned from teacup cat /tmp/.lwv/teacup_newer.txt steep /tmp/.lwv/teacup_newer.txt else echo "No updated entities found" >&2 fi teacup list --only uninstalled > /tmp/.lwv/teacup_notyet.txt 2>&1 cmp -s /tmp/.lwv/teacup_nohits.txt /tmp/.lwv/teacup_notyet.txt if [ $? -ne 0 ] ; then # something was returned from teacup cat /tmp/.lwv/teacup_notyet.txt steep /tmp/.lwv/teacup_notyet.txt else echo "No new entities found" >&2 fi