[Rcpp-commits] r4364 - in pkg/RcppGSL: . vignettes

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Jun 22 22:49:12 CEST 2013


Author: edd
Date: 2013-06-22 22:49:12 +0200 (Sat, 22 Jun 2013)
New Revision: 4364

Modified:
   pkg/RcppGSL/ChangeLog
   pkg/RcppGSL/vignettes/RcppGSL-unitTests.Rnw
   pkg/RcppGSL/vignettes/buildVignette.R
Log:
some minor tweaks for the vignette process


Modified: pkg/RcppGSL/ChangeLog
===================================================================
--- pkg/RcppGSL/ChangeLog	2013-06-22 20:23:33 UTC (rev 4363)
+++ pkg/RcppGSL/ChangeLog	2013-06-22 20:49:12 UTC (rev 4364)
@@ -1,9 +1,13 @@
 2013-06-22  Dirk Eddelbuettel  <edd at debian.org>
 
-	* inst/unitTests/runit.gsl.R: Rewritten to use sourceCpp() 
+	* inst/unitTests/runit.gsl.R: Rewritten to use sourceCpp()
 
 	* inst/unitTests/cpp/gsl.cpp: New C++ file with unit tests
 
+ 	* vignettes/RcppGSL-unitTests.Rnw: Minor tweaking
+
+	* vignettes/buildVignette.R: Default to all .Rnw files in directory
+
 2013-06-21  Dirk Eddelbuettel  <edd at debian.org>
 
 	* vignettes/buildVignette.R: Added simple helper script to build

Modified: pkg/RcppGSL/vignettes/RcppGSL-unitTests.Rnw
===================================================================
--- pkg/RcppGSL/vignettes/RcppGSL-unitTests.Rnw	2013-06-22 20:23:33 UTC (rev 4363)
+++ pkg/RcppGSL/vignettes/RcppGSL-unitTests.Rnw	2013-06-22 20:49:12 UTC (rev 4364)
@@ -13,6 +13,7 @@
 require(RcppGSL)
 prettyVersion <- packageDescription("RcppGSL")$Version
 prettyDate <- format(Sys.Date(), "%B %e, %Y")
+library(RUnit)
 @
 
 \usepackage[colorlinks]{hyperref}
@@ -23,35 +24,30 @@
 \begin{document}
 \maketitle
 
+\section*{Test Execution}
 
 <<unitTesting,echo=FALSE,print=FALSE>>=
-library(inline)
-library(RUnit)
-
 pkg <- "RcppGSL"
-cppfunction <- function(...) cxxfunction(..., plugin=pkg)
-
 if (file.exists("unitTests-results")) unlink("unitTests-results", recursive = TRUE)
 dir.create("unitTests-results")
-
 path <- system.file("unitTests", package=pkg)
-
 testSuite <- defineTestSuite(name=paste(pkg, "unit testing"), dirs=path)
-tests <- runTestSuite(testSuite, verbose=FALSE)
+tests <- runTestSuite(testSuite)
 err <- getErrors(tests)
-
 if (err$nFail > 0) stop(sprintf("unit test problems: %d failures", err$nFail))
 if (err$nErr > 0) stop( sprintf("unit test problems: %d errors", err$nErr))
-
 printHTMLProtocol(tests, fileName= sprintf("unitTests-results/%s-unitTests.html", pkg))
 printTextProtocol(tests, fileName= sprintf("unitTests-results/%s-unitTests.txt" , pkg))
 
 if (file.exists("/tmp")) {
-    invisible(file.copy(sprintf("unitTests-results/%s-unitTests.txt", pkg), "/tmp", overwrite=TRUE))
-    invisible(file.copy(sprintf("unitTests-results/%s-unitTests.html", pkg), "/tmp", overwrite=TRUE))
+    invisible(sapply(c("txt", "html"), function(ext) {
+        fname <- sprintf("unitTests-results/%s-unitTests.%s", pkg, ext)
+        file.copy(fname, "/tmp", overwrite=TRUE)
+    }))
 }
 @
 
+\section*{Test Results}
 
 \begin{verbatim}
 <<importResults,echo=FALSE,results=tex>>=

Modified: pkg/RcppGSL/vignettes/buildVignette.R
===================================================================
--- pkg/RcppGSL/vignettes/buildVignette.R	2013-06-22 20:23:33 UTC (rev 4363)
+++ pkg/RcppGSL/vignettes/buildVignette.R	2013-06-22 20:49:12 UTC (rev 4364)
@@ -1,15 +1,10 @@
 #!/usr/bin/Rscript
 
-args <- commandArgs(TRUE)
-if (length(args) == 0) {
-    cat("No argument given, using 'RcppGSL-intro.Rnw'\n")
-    srcfile <- "RcppGSL-intro.Rnw"
-} else {
-    srcfile <- args[1]
-}
+## use given argument(s) as target files, or else default to .Rnw files in directory
+files <- if (length(commandArgs(TRUE)) == 0) dir(pattern="*.Rnw") else commandArgs(TRUE)
 
-texfile <- gsub(".Rnw", ".tex", srcfile)
-
-Sweave(srcfile, driver=highlight::HighlightWeaveLatex())
-tools::texi2pdf(texfile)
-
+## convert all files from Rnw to pdf using the highlight driver
+invisible(sapply(files, function(srcfile) {
+    Sweave(srcfile, driver=highlight::HighlightWeaveLatex())
+    tools::texi2pdf(gsub(".Rnw", ".tex", srcfile))
+}))



More information about the Rcpp-commits mailing list