Skip to content

Commit

Permalink
add option to change directory prior to check in check.r
Browse files Browse the repository at this point in the history
  • Loading branch information
eddelbuettel committed Jan 18, 2015
1 parent a945c4e commit 52e3698
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2015-01-18 Dirk Eddelbuettel <[email protected]>

* examples/check.r: Add --setwd dir option to change directories

2015-01-17 Dirk Eddelbuettel <[email protected]>

* examples/check.r: Add a script which wrap R CMD check; with
Expand Down
6 changes: 5 additions & 1 deletion examples/check.r
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@
suppressMessages(library(docopt)) # we need docopt (>= 0.3) as on CRAN

## configuration for docopt
doc <- "Usage: check.r [-h] [--as-cran] [--repo REPO] [--install-deps] [--library LIB] [TARGZ ...]
doc <- "Usage: check.r [-h] [--as-cran] [--repo REPO] [--install-deps] [--library LIB] [--setwd DIR] [TARGZ ...]
-a --as-cran customization similar to CRAN's incoming [default: FALSE]
-r --repo REPO repository to use, or NULL for file [default: http://cran.rstudio.com]
-i --install-deps also install packages along with their dependencies [default: FALSE]
-l --library LIB when installing use this library [default: /usr/local/lib/R/site-library]
-s --setwd DIR change to this directoru before undertaking the test [default: ]
-h --help show this help text"

## docopt parsing
Expand Down Expand Up @@ -48,5 +49,8 @@ installArg <- function(p, lib, rep) {
## if dependencies are to be installed first:
if (opt$`install-deps`) sapply(opt$TARGZ, installArg, opt$lib, opt$repo)

## change directory if a target directory was given
if (opt$setwd != "") setwd(opt$setwd)

## installation given selected options and arguments
sapply(opt$TARGZ, checkArg, args)

0 comments on commit 52e3698

Please sign in to comment.