Skip to content

Commit

Permalink
Merge pull request #95 from jiho/feature/options
Browse files Browse the repository at this point in the history
Use package-wide options to set some preferences.  
Fixes #94.
  • Loading branch information
hadley committed Jun 16, 2012
2 parents 6755514 + 61560cc commit 5e6d28e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion R/devel-mode.r
Expand Up @@ -19,7 +19,7 @@
dev_mode <- local({
.prompt <- NULL

function(on = NULL, path = "~/R-dev") {
function(on = NULL, path = getOption("devtools.path")) {
lib_paths <- .libPaths()

path <- normalizePath(path, winslash = "/", mustWork = FALSE)
Expand Down
2 changes: 1 addition & 1 deletion R/install-github.r
Expand Up @@ -14,7 +14,7 @@
#' \dontrun{
#' install_github("roxygen")
#' }
install_github <- function(repo, username = "hadley", branch = "master", subdir = NULL, ...) {
install_github <- function(repo, username = getOption("github.user"), branch = "master", subdir = NULL, ...) {
message("Installing github repo(s) ",
paste(repo, branch, sep = "/", collapse = ", "),
" from ",
Expand Down
14 changes: 14 additions & 0 deletions R/zzz.r
Expand Up @@ -64,3 +64,17 @@ current_ver <- function() {
paste(version$major, ".", minor[1], sep = "")
}

.onLoad <- function(libname, pkgname) {
op <- options()
op.devtools <- list(
devtools.path="~/R-dev",
github.user="hadley"
)
toset <- !(names(op.devtools) %in% names(op))
if(any(toset)) options(op.devtools[toset])
}

on_path <- function(...) {
unname(Sys.which(c(...)) != "")
}

0 comments on commit 5e6d28e

Please sign in to comment.