Skip to content

Commit

Permalink
Add lib_temporary implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
jimhester committed Nov 3, 2017
1 parent 2f28545 commit 81a2ea4
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
export(lib_activate)
export(lib_create)
export(lib_deactivate)
export(lib_temporary)
export(local_pkg_install)
export(pkg_install)
export(pkg_remove)
11 changes: 11 additions & 0 deletions R/library.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,14 @@ lib_deactivate <- function(lib) {
old <- .libPaths()
.libPaths(setdiff(old, lib))
}

#' Create a session specific temporary library
#'
#' @param dir Directory to create the library in
#' @inheritParams base::tempfile
#' @export
lib_temporary <- function(dir = tempdir(), pattern = "library-") {
lib <- tempfile(pattern = pattern, tmpdir = dir)
dir.create(lib)
lib_activate(lib)
}
17 changes: 17 additions & 0 deletions man/lib_temporary.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 81a2ea4

Please sign in to comment.