#!/bin/sh -e
oname=biovizBase
pkg=r-bioc-`echo $oname | tr '[A-Z]' '[a-z]'`

if [ "$ADTTMP" = "" ] ; then
  ADTTMP=`mktemp -d /tmp/${pkg}-test.XXXXXX`
fi
cd $ADTTMP
cp /usr/share/doc/$pkg/examples/vignettes/* $ADTTMP
find . -name "*.gz" -exec gunzip \{\} \;
for rnw in `ls *.[rRS]nw` ; do
rfile=`echo $rnw | sed 's/\.[rRS]nw/.R/'`
R --no-save <<EOT
  Stangle("$rnw")
  source("$rfile", echo=TRUE)
EOT
done
rm -rf *
