Added support for knitr jobs as well.

chertex.sh will use knitr instead of pgfSweave if it detects a file name ".knitme"
in the directory of the current job. Crude solution, but it should work.
master
Taha Ahmed 12 years ago
parent 724ebff898
commit 95164fa0a3

@ -60,6 +60,34 @@ if [ $# -eq 1 ]; then
simpledelay.sh 2 simpledelay.sh 2
echo "Delay completed" 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 # Tangle
echo "<cheRTeX> Tangling..." echo "<cheRTeX> Tangling..."
R CMD Stangle $jobname.$jobfiletype R CMD Stangle $jobname.$jobfiletype
@ -72,6 +100,7 @@ if [ $# -eq 1 ]; then
echo "<cheRTeX> R CMD pgfsweave completed" echo "<cheRTeX> R CMD pgfsweave completed"
echo "<cheRTeX> -------------------------" echo "<cheRTeX> -------------------------"
simpledelay.sh 4 simpledelay.sh 4
fi
# Run vc script if vc exists in working directory # Run vc script if vc exists in working directory
echo "<cheRTeX> Running vc script" echo "<cheRTeX> Running vc script"
@ -204,6 +233,11 @@ else
if [ $cssfiles != 0 ]; then if [ $cssfiles != 0 ]; then
cp /home/taha/chepec/tmp/$tmpdirname/*.css . cp /home/taha/chepec/tmp/$tmpdirname/*.css .
fi 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 fi
echo "Terminating..." echo "Terminating..."

Loading…
Cancel
Save