Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Tree: 79fb4d73d9
Fetching contributors…

Cannot retrieve contributors at this time

executable file 44 lines (33 sloc) 1.452 kB
#!/usr/bin/env Rscript
## this script will automatically run roxygen on cranvas; it can be used as a shell script
## e.g. 'Rscript roxygenize.R' or 'Rscript roxyenize.R update' to run 'git pull' before roxygenizing
## run roxygen and check the package: Rscript roxygenize.R check
## extract the working directory from the file you provided
## e.g. Rscript ~/pkg/cranvas/roxygenize.R
p = grep("--file=", commandArgs(), fixed = TRUE, value = TRUE)
if (length(p) == 1) {
p = dirname(sub("^--file=", "", p))
## make sure the working directory is under cranvas
if (!("cranvas" %in% list.files("../"))) stop("the cranvas package not found under ",
normalizePath(file.path(getwd(), "..")))
## update git as well; someone wants to be really lazy
if ("update" %in% commandArgs(TRUE)) system("git pull --rebase")
try(update.packages(.libPaths()[1], ask = FALSE, repos = ''))
## use Rd2roxygen to roxygenize cranvas
## go up a level
owd = setwd("..")
if (grepl('yihui', Sys.getenv('USER'))) {
pth = .libPaths()[1]
psr = file.path(pth, 'parser')
psr2 = file.path(pth, 'parser2')
file.rename(psr2, psr)
.Last = function() file.rename(psr, psr2)
options(width = 80, replace.assign = TRUE)
## run roxygen and several cleaning up steps
unlink('cranvas/man', recursive = TRUE)
try(rab("cranvas", build = TRUE, install = TRUE, check = "check" %in% commandArgs(TRUE)))
Jump to Line
Something went wrong with that request. Please try again.