diff --git a/R/cache.R b/R/cache.R index 25b3358d2..9faf256d6 100644 --- a/R/cache.R +++ b/R/cache.R @@ -295,7 +295,7 @@ setMethod( sim <- get("sim", envir = sys.frame(doEventFrameNum)) cacheRepo <- sim@paths$cachePath } else { - cacheRepo <- .getOption("spades.cachePath") + cacheRepo <- .getOption("reproducible.cachePath") #checkPath(cacheRepo, create = TRUE) #SpaDES dependency } } diff --git a/R/misc-methods.R b/R/misc-methods.R index acb6cd262..502f839cd 100644 --- a/R/misc-methods.R +++ b/R/misc-methods.R @@ -574,7 +574,7 @@ setMethod( #' \code{Paths$cachePath} for example instead of \code{getPaths()$cachePath} #' #' @param cachePath The default local directory in which to cache simulation outputs. -#' If not specified, defaults to \code{getOption("spades.cachePath")}. +#' If not specified, defaults to \code{getOption("reproducible.cachePath")}. #' #' @param inputPath The default local directory in which to look for simulation inputs #' If not specified, defaults to \code{getOption("spades.inputPath")}. @@ -613,7 +613,7 @@ setMethod( #' .paths <- function() { list( - cachePath = .getOption("spades.cachePath"), + cachePath = .getOption("reproducible.cachePath"), inputPath = getOption("spades.inputPath"), modulePath = getOption("spades.modulePath"), outputPath = getOption("spades.outputPath") diff --git a/R/simList-accessors.R b/R/simList-accessors.R index 0070ab930..e7358d5ae 100644 --- a/R/simList-accessors.R +++ b/R/simList-accessors.R @@ -1463,7 +1463,7 @@ setReplaceMethod( #' If no paths are specified, the defaults are as follows: #' #' \itemize{ -#' \item \code{cachePath}: \code{getOption("spades.cachePath")}; +#' \item \code{cachePath}: \code{getOption("reproducible.cachePath")}; #' #' \item \code{inputPath}: \code{getOption("spades.modulePath")}; #' diff --git a/R/simulation-simInit.R b/R/simulation-simInit.R index 62efcefb6..5a90c6d2a 100644 --- a/R/simulation-simInit.R +++ b/R/simulation-simInit.R @@ -64,7 +64,7 @@ if (getRversion() >= "3.1.0") { #' the defaults are as follows: #' #' \itemize{ -#' \item \code{cachePath}: \code{getOption("spades.cachePath")}; +#' \item \code{cachePath}: \code{getOption("reproducible.cachePath")}; #' #' \item \code{inputPath}: \code{getOption("spades.modulePath")}; #' diff --git a/R/spades-core-package.R b/R/spades-core-package.R index d1eef6c64..0483b4c1d 100644 --- a/R/spades-core-package.R +++ b/R/spades-core-package.R @@ -437,7 +437,7 @@ #' first time makes the error, the second time has \code{debugonce} and the third time #' is after the error is addressed. \code{TRUE} is likely somewhat slower. #' -#' \item \code{spades.cachePath}: The default local directory in which to +#' \item \code{reproducible.cachePath}: The default local directory in which to #' cache simulation outputs. #' Default is a temporary directory (typically \code{/tmp/RtmpXXX/SpaDES/cache}). #' diff --git a/man/SpaDES.core-package.Rd b/man/SpaDES.core-package.Rd index 36d01b002..22ad317b5 100644 --- a/man/SpaDES.core-package.Rd +++ b/man/SpaDES.core-package.Rd @@ -463,7 +463,7 @@ These can be found with \code{file.path(find.package("SpaDES.core"), "sampleModu first time makes the error, the second time has \code{debugonce} and the third time is after the error is addressed. \code{TRUE} is likely somewhat slower. - \item \code{spades.cachePath}: The default local directory in which to + \item \code{reproducible.cachePath}: The default local directory in which to cache simulation outputs. Default is a temporary directory (typically \code{/tmp/RtmpXXX/SpaDES/cache}). diff --git a/man/setPaths.Rd b/man/setPaths.Rd index 2d0710df4..a99ba82e9 100644 --- a/man/setPaths.Rd +++ b/man/setPaths.Rd @@ -19,7 +19,7 @@ setPaths(cachePath, inputPath, modulePath, outputPath) } \arguments{ \item{cachePath}{The default local directory in which to cache simulation outputs. -If not specified, defaults to \code{getOption("spades.cachePath")}.} +If not specified, defaults to \code{getOption("reproducible.cachePath")}.} \item{inputPath}{The default local directory in which to look for simulation inputs If not specified, defaults to \code{getOption("spades.inputPath")}.} diff --git a/man/simInit.Rd b/man/simInit.Rd index 10207ab78..1616b3dd8 100644 --- a/man/simInit.Rd +++ b/man/simInit.Rd @@ -148,7 +148,7 @@ the data input files, and the saving output files. If no paths are specified the defaults are as follows: \itemize{ - \item \code{cachePath}: \code{getOption("spades.cachePath")}; + \item \code{cachePath}: \code{getOption("reproducible.cachePath")}; \item \code{inputPath}: \code{getOption("spades.modulePath")}; diff --git a/man/simList-accessors-paths.Rd b/man/simList-accessors-paths.Rd index 659d5de13..f12a9ccbf 100644 --- a/man/simList-accessors-paths.Rd +++ b/man/simList-accessors-paths.Rd @@ -103,7 +103,7 @@ Each has a function to get or set the value in a \code{simList} object. If no paths are specified, the defaults are as follows: \itemize{ - \item \code{cachePath}: \code{getOption("spades.cachePath")}; + \item \code{cachePath}: \code{getOption("reproducible.cachePath")}; \item \code{inputPath}: \code{getOption("spades.modulePath")}; diff --git a/tests/testthat/test-multipleModulePaths.R b/tests/testthat/test-multipleModulePaths.R index f802d0f4d..f3be33e7e 100644 --- a/tests/testthat/test-multipleModulePaths.R +++ b/tests/testthat/test-multipleModulePaths.R @@ -57,7 +57,7 @@ test_that("simulation runs with simInit and spades", { init = { sim$dp <- dataPath(sim) sim$cachePath <- cachePath(sim) - sim$optionsCachePath <- getOption("spades.cachePath") + sim$optionsCachePath <- getOption("reproducible.cachePath") #sim <- scheduleEvent(sim, sim@simtimes$current+1, "test", "event1") }, event1 = { diff --git a/tests/testthat/test-paths.R b/tests/testthat/test-paths.R index a16eaa3a1..992c8b546 100644 --- a/tests/testthat/test-paths.R +++ b/tests/testthat/test-paths.R @@ -1,5 +1,6 @@ test_that("paths file does not work correctly", { testInitOut <- testInit(setPaths = FALSE) + on.exit({ testOnExit(testInitOut) }, add = TRUE) @@ -57,6 +58,20 @@ test_that("paths file does not work correctly", { modulePath = modulePath(mySim), outputPath = outputPath(mySim)), normPath)) + # missing paths + oldPaths <- getPaths() + do.call(setPaths, paths) + on.exit({do.call(setPaths, paths)}, add = TRUE) + mySim1 <- simInit(times, params, modules, objects = list()) + expect_equal(lapply(paths(mySim), normPath), + lapply(paths(mySim1), normPath)) + + # setting paths via setPaths works for changing the paths in the simInit & therefore simList + setPaths(cachePath = oldPaths$cachePath) + mySim2 <- simInit(times, params, modules, objects = list()) + expect_false(identical(lapply(paths(mySim), normPath), + lapply(paths(mySim2), normPath))) + inputPath(mySim) <- tmpdir expect_equal(inputPath(mySim), tmpdir) @@ -68,4 +83,6 @@ test_that("paths file does not work correctly", { cachePath(mySim) <- tmpdir expect_equal(cachePath(mySim), tmpdir) + + })