diff --git a/R/run.R b/R/run.R index 1d1d7945..f31506d8 100644 --- a/R/run.R +++ b/R/run.R @@ -159,15 +159,14 @@ ##' orderly2::orderly_metadata_extract(name = "data", root = path) orderly_run <- function(name, parameters = NULL, envir = NULL, echo = TRUE, search_options = NULL, root = NULL, locate = TRUE) { - env_src <- Sys.getenv("ORDERLY_REPORT_SRC") - is_env_src_empty <- !nzchar(env_src) - root <- root_open(root, locate, require_orderly = is_env_src_empty, + env_root_src <- Sys.getenv("ORDERLY_SRC_ROOT", NA_character_) + root <- root_open(root, locate, require_orderly = is.na(env_root_src), call = environment()) - if (is_env_src_empty) { + if (is.na(env_root_src)) { root_src <- root$path } else { - root_src <- orderly_src_root(env_src, locate, call = environment()) + root_src <- orderly_src_root(env_root_src, locate, call = environment()) } name <- validate_orderly_directory(name, root_src, environment()) diff --git a/tests/testthat/test-run-separate.R b/tests/testthat/test-run-separate.R index 2283b4f1..051eda59 100644 --- a/tests/testthat/test-run-separate.R +++ b/tests/testthat/test-run-separate.R @@ -1,7 +1,7 @@ test_that("can run simple case in separate directory", { info <- test_prepare_orderly_example_separate("explicit") id <- withr::with_envvar( - c(ORDERLY_REPORT_SRC = info$src), + c(ORDERLY_SRC_ROOT = info$src), orderly_run_quietly("explicit", envir = new.env(), root = info$outpack) ) expect_type(id, "character") @@ -19,7 +19,7 @@ test_that("can run shared resources case in separate directory", { ## root. info <- test_prepare_orderly_example_separate("shared") id <- withr::with_envvar( - c(ORDERLY_REPORT_SRC = info$src), + c(ORDERLY_SRC_ROOT = info$src), orderly_run_quietly("shared", envir = new.env(), root = info$outpack) ) expect_setequal( @@ -32,11 +32,11 @@ test_that("can use dependencies in separate directory", { ## Ensures that we hit the outpack root for pulling deps in info <- test_prepare_orderly_example_separate(c("data", "depends")) id1 <- withr::with_envvar( - c(ORDERLY_REPORT_SRC = info$src), + c(ORDERLY_SRC_ROOT = info$src), orderly_run_quietly("data", envir = new.env(), root = info$outpack) ) id2 <- withr::with_envvar( - c(ORDERLY_REPORT_SRC = info$src), + c(ORDERLY_SRC_ROOT = info$src), orderly_run_quietly("depends", envir = new.env(), root = info$outpack) ) path1 <- file.path(info$outpack, "archive", "data", id1) @@ -53,7 +53,7 @@ test_that("can get git information in separate directory", { info <- test_prepare_orderly_example_separate("explicit") info$git <- helper_add_git(info$src) id <- withr::with_envvar( - c(ORDERLY_REPORT_SRC = info$src), + c(ORDERLY_SRC_ROOT = info$src), orderly_run_quietly("explicit", envir = new.env(), root = info$outpack) ) meta <- orderly_metadata(id, root = info$outpack) @@ -66,7 +66,7 @@ test_that("can't run interactively in separate directory", { ## root info <- test_prepare_orderly_example_separate(c("data", "depends")) id1 <- withr::with_envvar( - c(ORDERLY_REPORT_SRC = info$src), + c(ORDERLY_SRC_ROOT = info$src), orderly_run_quietly("data", envir = new.env(), root = info$outpack) ) path_src <- file.path(info$src, "src", "depends")