Skip to content

Commit

Permalink
Use package-wide options to set some preferences
Browse files Browse the repository at this point in the history
Those are things that users might what to change often:

- the path where devel packages are installed: `~/R-dev` is a 
  little intrusive

- the github user name: developer might want to use theirs
  • Loading branch information
jiho committed Jun 16, 2012
1 parent 6755514 commit 6877abd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion R/devel-mode.r
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
dev_mode <- local({
.prompt <- NULL

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

path <- normalizePath(path, winslash = "/", mustWork = FALSE)
Expand Down
2 changes: 1 addition & 1 deletion R/install-github.r
Original file line number Diff line number Diff line change
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
15 changes: 15 additions & 0 deletions R/zzz.r
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,18 @@ current_ver <- function() {
paste(version$major, ".", minor[1], sep = "")
}

.onLoad <- function(libname, pkgname)
{
op <- options()
op.devtools <- list(
dev.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 6877abd

Please sign in to comment.