Skip to content
This repository
tree: 0229be179b
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

executable file 37 lines (26 sloc) 1.248 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
#!/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))
    setwd(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 = 'http://cran.r-project.org'))

## use Rd2roxygen to roxygenize cranvas

## go up a level
owd = setwd("..")

library(Rd2roxygen)
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)))

setwd(owd)
Something went wrong with that request. Please try again.