From 5f0c58236713c74caebc9ede0e93812ab984b848 Mon Sep 17 00:00:00 2001 From: Peter Hurford Date: Fri, 22 Jan 2016 22:49:16 -0600 Subject: [PATCH 1/3] Started require_package --- DESCRIPTION | 2 +- NEWS.md | 4 ++++ R/load_package.r | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index fb9767f..294d534 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -4,7 +4,7 @@ Description: A "define" function is provided that allows for inclusion of external scripts without polluting the global namespace and makes it easier to write modular R code. -Version: 0.3 +Version: 0.3.1 Author: Robert Krzyzanowski Maintainer: Robert Krzyzanowski Depends: diff --git a/NEWS.md b/NEWS.md index 6436bd0..fc8538e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# Version 0.3.1 + + * `pacakges` now brings the package into memory using `require`, which was the pre-0.3 functionality. + # Version 0.3 * `packages` will now install from GitHub when the package name contains a '/'. diff --git a/R/load_package.r b/R/load_package.r index 1eee147..543d837 100644 --- a/R/load_package.r +++ b/R/load_package.r @@ -34,7 +34,7 @@ load_package <- function(name, verbose = FALSE) { if (!package_is_installed(name)) { stop(paste("Package", name, "not found on", remote, ".")) } - TRUE + require(name, character.only = TRUE) } handle_version_mismatches <- function(name, verbose) { From 2848ec3a4a8c27a9bc65e9751744eff531648d19 Mon Sep 17 00:00:00 2001 From: Peter Hurford Date: Fri, 22 Jan 2016 22:50:44 -0600 Subject: [PATCH 2/3] Patch tests --- tests/testthat/test-load_pacakge.r | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/testthat/test-load_pacakge.r b/tests/testthat/test-load_pacakge.r index ebe9dcf..a042abf 100644 --- a/tests/testthat/test-load_pacakge.r +++ b/tests/testthat/test-load_pacakge.r @@ -100,6 +100,7 @@ describe("it can install from CRAN", { with_mock( `devtools::install_github` = function(...) { stop("Wrong installer!") }, `stop` = function(...) { TRUE }, #Avoid crashing since we aren't really installing + `require` = function(...) { TRUE }, `utils::install.packages` = function(...) { "correct installer!" }, { test_that("it installs", { expect_true(load_package("glmnet")) @@ -131,6 +132,7 @@ describe("it can install from GitHub", { `devtools::install_github` = function(...) { "Correct installer!" }, `Ramd:::package_is_installed` = function(...) { FALSE }, `stop` = function(...) { TRUE }, #Avoid crashing since we aren't really installing + `require` = function(...) { TRUE }, `utils::install.packages` = function(...) { stop("Wrong installer!") }, { test_that("it installs", { expect_true(load_package("robertzk/Ramd")) From 58af4768ce49bb9100362032b023a80726b9635c Mon Sep 17 00:00:00 2001 From: Peter Hurford Date: Fri, 22 Jan 2016 23:17:16 -0600 Subject: [PATCH 3/3] typofix --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index fc8538e..9f0c424 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,6 @@ # Version 0.3.1 - * `pacakges` now brings the package into memory using `require`, which was the pre-0.3 functionality. + * `packages` now brings the package into memory using `require`, which was the pre-0.3 functionality. # Version 0.3