diff --git a/DESCRIPTION b/DESCRIPTION index 1ce590d4..9ed0f758 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,7 +2,7 @@ Package: packrat Type: Package Title: A Dependency Management System for Projects and their R Package Dependencies -Version: 0.4.9-15 +Version: 0.4.9-16 Author: Kevin Ushey, Jonathan McPherson, Joe Cheng, Aron Atkins, JJ Allaire Maintainer: Kevin Ushey Description: Manage the R packages your project depends @@ -21,4 +21,5 @@ Suggests: rmarkdown URL: https://github.com/rstudio/packrat/ BugReports: https://github.com/rstudio/packrat/issues -RoxygenNote: 6.1.0 +RoxygenNote: 6.1.1 +Encoding: UTF-8 diff --git a/R/external.R b/R/external.R index 4cdcd666..8beafa01 100644 --- a/R/external.R +++ b/R/external.R @@ -81,10 +81,20 @@ with_extlib <- function(packages = NULL, expr, envir = parent.frame()) { ##' @rdname packrat-external ##' @export extlib <- function(packages) { - lib.loc <- getDefaultLibPaths() - for (package in packages) { - library(package, character.only = TRUE, lib.loc = lib.loc) - } + + # place user library at front of library paths (we want to + # include both the user library and the packrat library just + # so that external packaegs can still load and depend on + # packages only installed within the private library as well) + oldLibPaths <- .libPaths() + newLibPaths <- c(getDefaultLibPaths(), .libPaths()) + + .libPaths(newLibPaths) + on.exit(.libPaths(oldLibPaths), add = TRUE) + + for (package in packages) + library(package, character.only = TRUE) + } loadExternalPackages <- function() { diff --git a/inst/resources/init-rprofile.R b/inst/resources/init-rprofile.R index 38d666b1..5d92b195 100644 --- a/inst/resources/init-rprofile.R +++ b/inst/resources/init-rprofile.R @@ -1,3 +1,3 @@ -#### -- Packrat Autoloader (version 0.4.9-15) -- #### +#### -- Packrat Autoloader (version 0.4.9-16) -- #### source("packrat/init.R") #### -- End Packrat Autoloader -- #### diff --git a/inst/resources/init.R b/inst/resources/init.R index 7a653767..b19637b3 100644 --- a/inst/resources/init.R +++ b/inst/resources/init.R @@ -186,7 +186,7 @@ local({ ## an 'installed from source' version ## -- InstallAgent -- ## - installAgent <- "InstallAgent: packrat 0.4.9-15" + installAgent <- "InstallAgent: packrat 0.4.9-16" ## -- InstallSource -- ## installSource <- "InstallSource: source" diff --git a/tests/testthat/.gitignore b/tests/testthat/.gitignore index 9b6e3511..0038e951 100644 --- a/tests/testthat/.gitignore +++ b/tests/testthat/.gitignore @@ -1,2 +1,3 @@ repo packages/packrat +packrat/lib*/ diff --git a/tests/testthat/test-with_extlib.R b/tests/testthat/test-with_extlib.R index 00dca5a6..ac4226fe 100644 --- a/tests/testthat/test-with_extlib.R +++ b/tests/testthat/test-with_extlib.R @@ -1,6 +1,7 @@ context("extlib without packages") test_that("with_extlib successfully works with no packages provided", { + skip_on_cran() ## Make sure packrat mode is off if (packrat:::isPackratModeOn())