[Remoterengine-commits] r148 - pkg/RemoteREngine.test/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Sep 17 14:52:55 CEST 2009


Author: romain
Date: 2009-09-17 14:52:55 +0200 (Thu, 17 Sep 2009)
New Revision: 148

Modified:
   pkg/RemoteREngine.test/R/zzz.R
Log:
added run fucntion

Modified: pkg/RemoteREngine.test/R/zzz.R
===================================================================
--- pkg/RemoteREngine.test/R/zzz.R	2009-09-17 12:52:17 UTC (rev 147)
+++ pkg/RemoteREngine.test/R/zzz.R	2009-09-17 12:52:55 UTC (rev 148)
@@ -1,2 +1,24 @@
 .onAttach <- function(libname, pkgname){}
 
+run <- function(){
+	rscript( "RemoteREngine.test", "runtests" , run = TRUE, arguments = commandArgs(TRUE) )
+}
+
+rscript <- function( package, script, arguments = commandArgs(TRUE), run = TRUE, dir = "exec" ){
+	
+	Rscript <- file.path( R.home(), "bin", "Rscript" )
+	script  <- system.file( dir, script, package = package )
+	if( !file.exists( script ) ){
+		stop( sprintf( "script '%s' does not exist", script) )
+	}
+	
+	arguments <- if( length( arguments ) == 0 ) "" else paste( arguments, collapse = " " )
+	cmd <- sprintf( '"%s" "%s" %s', Rscript, script, arguments )
+	
+	if( run ){
+		system( cmd )
+	} else {
+		cat( cmd )
+	}
+}
+



More information about the Remoterengine-commits mailing list