Skip to content

Commit 5c364c1

Browse files
committed
further improvements to Rcpp.package.skeleton
1 parent 47df44a commit 5c364c1

File tree

4 files changed

+69
-13
lines changed

4 files changed

+69
-13
lines changed

ChangeLog

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
2016-05-11 Dirk Eddelbuettel <[email protected]>
2+
3+
* R/Rcpp.package.skeleton.R: Modified to create a package without notes,
4+
warnings, or error even pkgKitten is not available
5+
6+
* R/Rcpp.package.skeleton.R (.playWithPerPackageHelpPage): Added new
7+
helper function to be used when pkgKitten is not available
8+
* inst/skeleton/manual-page-stub.Rd: Stub for per-package help page used
9+
when pkgKitten is not available
10+
111
2016-05-10 Dirk Eddelbuettel <[email protected]>
212

313
* R/Rcpp.package.skeleton.R: Also correct Title: and Description: to

R/Rcpp.package.skeleton.R

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Rcpp.package.skeleton <- function(name = "anRpackage", list = character(),
2828

2929
havePkgKitten <- requireNamespace("pkgKitten", quietly=TRUE)
3030

31+
3132
call <- match.call()
3233
call[[1]] <- as.name("package.skeleton")
3334
env <- parent.frame(1)
@@ -118,16 +119,7 @@ Rcpp.package.skeleton <- function(name = "anRpackage", list = character(),
118119
if (havePkgKitten) { # if pkgKitten is available, use it
119120
pkgKitten::playWithPerPackageHelpPage(name, path, maintainer, email)
120121
} else {
121-
package_help_page <- file.path(root, "man", sprintf( "%s-package.Rd", name))
122-
if (file.exists(package_help_page)) {
123-
lines <- readLines(package_help_page)
124-
lines <- gsub("What license is it under?", license, lines, fixed = TRUE)
125-
lines <- gsub("Who to complain to <[email protected]>",
126-
sprintf( "%s <%s>", maintainer, email),
127-
lines, fixed = TRUE)
128-
lines <- gsub( "Who wrote it", author, lines, fixed = TRUE)
129-
writeLines(lines, package_help_page)
130-
}
122+
.playWithPerPackageHelpPage(name, path, maintainer, email)
131123
}
132124

133125
## lay things out in the src directory
@@ -209,3 +201,23 @@ Rcpp.package.skeleton <- function(name = "anRpackage", list = character(),
209201

210202
invisible(NULL)
211203
}
204+
205+
## Borrowed with love from pkgKitten, and modified slightly
206+
.playWithPerPackageHelpPage <- function(name = "anRpackage",
207+
path = ".",
208+
maintainer = "Your Name",
209+
email = "[email protected]") {
210+
root <- file.path(path, name)
211+
helptgt <- file.path(root, "man", sprintf( "%s-package.Rd", name))
212+
helpsrc <- system.file("skeleton", "manual-page-stub.Rd", package="Rcpp")
213+
## update the package description help page
214+
if (file.exists(helpsrc)) {
215+
lines <- readLines(helpsrc)
216+
lines <- gsub("__placeholder__", name, lines, fixed = TRUE)
217+
lines <- gsub("Who to complain to <[email protected]>",
218+
sprintf( "%s <%s>", maintainer, email),
219+
lines, fixed = TRUE)
220+
writeLines(lines, helptgt)
221+
}
222+
invisible(NULL)
223+
}

inst/NEWS.Rd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
}
2626
\item Changes in Rcpp support functions:
2727
\itemize{
28-
\item The \code{Rcpp.package.skeleton()} function was once again updated
29-
in order to create a \code{DESCRIPTION} file which passes
30-
\code{R CMD check} without warnings under R-release and R-devel.
28+
\item The \code{Rcpp.package.skeleton()} function was again updated in
29+
order to create a \code{DESCRIPTION} file which passes \code{R CMD check}
30+
without notes. warnings, or error under R-release and R-devel.
3131
}
3232
}
3333
}

inst/skeleton/manual-page-stub.Rd

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
\name{__placeholder__-package}
2+
\alias{__placeholder__-package}
3+
\alias{__placeholder__}
4+
\docType{package}
5+
\title{
6+
A short title line describing what the package does
7+
}
8+
\description{
9+
A more detailed description of what the package does. A length
10+
of about one to five lines is recommended.
11+
}
12+
\details{
13+
This section should provide a more detailed overview of how to use the
14+
package, including the most important functions.
15+
}
16+
\author{
17+
Who wrote it, email optional.
18+
19+
Maintainer: Who to complain to <yourfault@somewhere.net>
20+
}
21+
\references{
22+
This optional section can contain literature or other references for
23+
background information.
24+
}
25+
\keyword{ package }
26+
\seealso{
27+
Optional links to other man pages
28+
}
29+
\examples{
30+
\dontrun{
31+
## Optional simple examples of the most important functions
32+
## These can be in \dontrun{} and \donttest{} blocks.
33+
}
34+
}

0 commit comments

Comments
 (0)