[Rcpp-commits] r2725 - in pkg/Rcpp: . R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Dec 5 19:27:19 CET 2010


Author: romain
Date: 2010-12-05 19:27:19 +0100 (Sun, 05 Dec 2010)
New Revision: 2725

Modified:
   pkg/Rcpp/ChangeLog
   pkg/Rcpp/R/Rcpp.package.skeleton.R
   pkg/Rcpp/man/Rcpp.package.skeleton.Rd
Log:
Rcpp.package.skeleton gains some arguments

Modified: pkg/Rcpp/ChangeLog
===================================================================
--- pkg/Rcpp/ChangeLog	2010-12-05 17:32:05 UTC (rev 2724)
+++ pkg/Rcpp/ChangeLog	2010-12-05 18:27:19 UTC (rev 2725)
@@ -5,7 +5,7 @@
     of &yes_arity<0>
     
     * R/Rcpp.package.skeleton.R: Rcpp.package.skeleton( "foo", example_code = FALSE)
-    did not work properly
+    did not work properly. Rcpp.package.skeleton gains some arguments
 
 2010-12-05  Dirk Eddelbuettel  <edd at debian.org>
 

Modified: pkg/Rcpp/R/Rcpp.package.skeleton.R
===================================================================
--- pkg/Rcpp/R/Rcpp.package.skeleton.R	2010-12-05 17:32:05 UTC (rev 2724)
+++ pkg/Rcpp/R/Rcpp.package.skeleton.R	2010-12-05 18:27:19 UTC (rev 2725)
@@ -20,7 +20,12 @@
 	path = ".", force = FALSE, namespace = TRUE, 
 	code_files = character(), 
 	example_code = TRUE, 
-	module = FALSE ){
+	module = FALSE, 
+	author = "Who wrote it", 
+	maintainer = if(missing( author)) "Who to complain to" else author, 
+	email = "yourfault at somewhere.net", 
+	license = "What Licence is it under ?"
+	){
 	
 	env <- parent.frame(1)
 	
@@ -48,19 +53,15 @@
 	call[[1]] <- as.name("package.skeleton")
 	call[["namespace"]] <- namespace
 	# remove Rcpp specific arguments
-	if( "example_code" %in% names( call ) ){
-		call[["example_code"]] <- NULL
-	}
-	if( "module" %in% names( call ) ){
-		call[["module"]] <- NULL
-	}
 	
+	call <- call[ c( 1L, which( names(call) %in% names(formals(package.skeleton)))) ]
+	
 	if( fake ){
 		call[["list"]] <- c( if( isTRUE(example_code)) "rcpp_hello_world" , "Rcpp.fake.fun" )
 	}
-	
+		
 	tryCatch( eval( call, envir = env ), error = function(e){
-		stop( "error while calling `package.skeleton`" )
+		stop( sprintf( "error while calling `package.skeleton` : %s", conditionMessage(e) ) )
 	} )
 	
 	message( "\nAdding Rcpp settings" )
@@ -79,6 +80,9 @@
 			"Depends" = paste( depends, collapse = ", ") , 
 			"LinkingTo" = "Rcpp"
 		)
+		x[, "Author" ] <- author
+		x[, "Maintainer" ] <- sprintf( "%s <%s>", maintainer, email )
+		x[, "License"] <- license
 		write.dcf( x, file = DESCRIPTION )
 		message( " >> added Depends: Rcpp" )
 		message( " >> added LinkingTo: Rcpp" )
@@ -162,6 +166,12 @@
 	
 	lines <- readLines( package.doc <- file.path( root, "man", sprintf( "%s-package.Rd", name ) ) )
 	lines <- sub( "~~ simple examples", "%% ~~ simple examples", lines )
+	
+	lines <- lines[ !grepl( "~~ package title", lines) ]
+	lines <- lines[ !grepl( "~~ The author and", lines) ]
+	lines <- sub( "Who wrote it", author, lines )
+	lines <- sub( "Who to complain to.*", sprintf( "%s <%s>", maintainer, email), lines )
+	
 	writeLines( lines, package.doc )
 	
 	if( fake ){

Modified: pkg/Rcpp/man/Rcpp.package.skeleton.Rd
===================================================================
--- pkg/Rcpp/man/Rcpp.package.skeleton.Rd	2010-12-05 17:32:05 UTC (rev 2724)
+++ pkg/Rcpp/man/Rcpp.package.skeleton.Rd	2010-12-05 18:27:19 UTC (rev 2725)
@@ -14,7 +14,12 @@
 Rcpp.package.skeleton(name = "anRpackage", list = character(), 
 	environment = .GlobalEnv, path = ".", force = FALSE, 
 	namespace = TRUE, code_files = character(), 
-	example_code = TRUE, module = FALSE )
+	example_code = TRUE, module = FALSE, 
+	author = "Who wrote it", 
+	maintainer = if(missing( author)) "Who to complain to" else author, 
+	email = "yourfault at somewhere.net", 
+	license = "What Licence is it under ?"
+	)
 }
 \arguments{
 	\item{name}{See \link[utils]{package.skeleton}}
@@ -26,6 +31,10 @@
 	\item{code_files}{See \link[utils]{package.skeleton}}
 	\item{example_code}{If TRUE, example c++ code using Rcpp is added to the package. }
 	\item{module}{If TRUE, an example \code{\link{Module}} is added to the skeleton. }
+	\item{author}{Author of the package.}
+	\item{maintainer}{Maintainer of the package.}
+	\item{email}{Email of the package maintainer.}
+	\item{license}{License of the package.}
 }
 \details{
 	In addition to \link[utils]{package.skeleton} : 



More information about the Rcpp-commits mailing list