Monday, October 17

OOPSLA - Scrapheap Challenge - Challenge 3 solution

For the last challenge, we built a dial that shows how far a local copy of an svn repository has diverged from a the repository.

For our solution we used

  1. a shell script:
    LIST=`svn status | awk '{print $1}' | grep '^[ADMC]' | sed 's/^[MAD]/1/g' | sed 's/^C/10/g'`
    TOTAL='0'
    for i in $LIST
    do
     TOTAL=`expr $i + $TOTAL`
    done
    TOTAL=`expr $TOTAL \* 4`
    echo "angle=$TOTAL"
    A=`svn status | grep '^A' | wc -l`
    C=`svn status | grep '^C' | wc -l`
    M=`svn status | grep '^M' | wc -l`
    D=`svn status | grep '^D' | wc -l`
    echo "added=$A"
    echo "deleted=$D"
    echo "conflicted=$C"
    echo "modified=$M"
    

    this generates .properties file that looks like so:
    angle=52
    added=9
    deleted=0
    conflicted=0
    modified=4
    
  2. This is then applied to a template which generates the xml data XML/SWF Gauge using an Ant script.
  3. Another shell script can then wrap these two together.
  4. An html file can then be deployed to a web server. Set up the aforementioned build script to drop the gauge.xml file there, and that's that.

0 comments: