diff --git a/R/devel-mode.r b/R/devel-mode.r index 2de60348e..4ab7ce042 100644 --- a/R/devel-mode.r +++ b/R/devel-mode.r @@ -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) diff --git a/R/install-github.r b/R/install-github.r index e3297adb4..568c8fda9 100644 --- a/R/install-github.r +++ b/R/install-github.r @@ -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 ", diff --git a/R/zzz.r b/R/zzz.r index 5fb21e54f..8b15fa507 100644 --- a/R/zzz.r +++ b/R/zzz.r @@ -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(...)) != "") +} +