@ -60,6 +60,34 @@ if [ $# -eq 1 ]; then
simpledelay.sh 2
echo "Delay completed"
## Handle knitr or pgfSweave jobs separately
## But how should we tell the difference between them?
## There is no obvious way to tell the difference (apart from reading the *.Rnw file)
## IN ALL KNITR DIRECTORIES, CREATE A FILE NAMED: .knitme
# If the file .knitme exists in the current directory,
# run knitr commands, otherwise run pgfsweave commands
echo "--- Looking for .knitme"
if [ -e .knitme ] ; then
# Run knitr commands for this job
echo "<cheRTeX> -----------------------"
echo "<cheRTeX> This is a job for knitr"
echo "<cheRTeX> -----------------------"
# Knit
echo "<cheRTeX> Knitting..."
Rscript -e " library(knitr); library(methods); knit(' $jobname . $jobfiletype ') "
# Introduce delay to give time to read Rscript exit status
echo "<cheRTeX> -----------------------"
echo "<cheRTeX> Rscript knitr completed"
echo "<cheRTeX> -----------------------"
simpledelay.sh 4
else
# Run pgfSweave commands
echo "<cheRTeX> ---------------------------"
echo "<cheRTeX> This is a job for pgfSweave"
echo "<cheRTeX> ---------------------------"
# Tangle
echo "<cheRTeX> Tangling..."
R CMD Stangle $jobname .$jobfiletype
@ -72,6 +100,7 @@ if [ $# -eq 1 ]; then
echo "<cheRTeX> R CMD pgfsweave completed"
echo "<cheRTeX> -------------------------"
simpledelay.sh 4
fi
# Run vc script if vc exists in working directory
echo "<cheRTeX> Running vc script"
@ -204,6 +233,11 @@ else
if [ $cssfiles != 0 ] ; then
cp /home/taha/chepec/tmp/$tmpdirname /*.css .
fi
# Return .knitme file [empty file used to indicate knitr jobs]
knitmefile = ` ls -1 /home/taha/chepec/tmp/$tmpdirname /.knitme 2>/dev/null | wc -l`
if [ $knitmefile != 0 ] ; then
cp /home/taha/chepec/tmp/$tmpdirname /.knitme .
fi
fi
echo "Terminating..."