Skip to content

Commit 525a43b

Browse files
committed
cleaning up the tests
1 parent ad1c99b commit 525a43b

File tree

7 files changed

+605
-2278
lines changed

7 files changed

+605
-2278
lines changed

Makefile

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,12 @@ prod-covid-log:
1717
prod-covid:
1818
export TAR_RUN_PROJECT=covid_hosp_prod; Rscript scripts/run.R
1919

20-
prod-covid-2:
21-
export TAR_RUN_PROJECT=covid_hosp_prod_2; Rscript scripts/run.R
22-
2320
prod-flu-log:
2421
export TAR_RUN_PROJECT=flu_hosp_prod; Rscript scripts/run.R >> cache/logs/prod_flu 2>&1
2522

2623
prod-flu:
2724
export TAR_RUN_PROJECT=flu_hosp_prod; Rscript scripts/run.R
2825

29-
prod-flu-2:
30-
export TAR_RUN_PROJECT=flu_hosp_prod2; Rscript scripts/run.R
31-
3226
prod: prod-covid prod-flu update-site netlify
3327

3428
prod-log: prod-covid-log prod-flu-log update-site-log netlify-log

_targets.yaml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,3 @@ covid_hosp_prod:
1818
store: covid_hosp_prod
1919
use_crew: yes
2020
reporter_make: timestamp
21-
covid_hosp_prod_2:
22-
script: scripts/covid_hosp_prod_2.R
23-
store: covid_hosp_prod_2
24-
use_crew: yes
25-
reporter_make: timestamp
26-
flu_hosp_prod2:
27-
script: scripts/flu_hosp_prod2.R
28-
store: flu_hosp_prod2
29-
use_crew: yes
30-
reporter_make: timestamp

flu_hosp_prod2/.gitignore

Lines changed: 0 additions & 10 deletions
This file was deleted.

renv.lock

Lines changed: 526 additions & 426 deletions
Large diffs are not rendered by default.

renv/activate.R

Lines changed: 79 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
local({
33

44
# the requested version of renv
5-
version <- "1.1.5"
5+
version <- "1.1.6"
6+
attr(version, "md5") <- "3036c4b273d882c56e8cdd660ebaf6f0"
67
attr(version, "sha") <- NULL
78

89
# the project directory
@@ -215,6 +216,16 @@ local({
215216
section <- header(sprintf("Bootstrapping renv %s", friendly))
216217
catf(section)
217218

219+
# try to install renv from cache
220+
md5 <- attr(version, "md5", exact = TRUE)
221+
if (length(md5)) {
222+
pkgpath <- renv_bootstrap_find(version)
223+
if (length(pkgpath) && file.exists(pkgpath)) {
224+
file.copy(pkgpath, library, recursive = TRUE)
225+
return(invisible())
226+
}
227+
}
228+
218229
# attempt to download renv
219230
catf("- Downloading renv ... ", appendLF = FALSE)
220231
withCallingHandlers(
@@ -240,7 +251,6 @@ local({
240251

241252
# add empty line to break up bootstrapping from normal output
242253
catf("")
243-
244254
return(invisible())
245255
}
246256

@@ -256,14 +266,22 @@ local({
256266
# check for repos override
257267
repos <- Sys.getenv("RENV_CONFIG_REPOS_OVERRIDE", unset = NA)
258268
if (!is.na(repos)) {
259-
260-
# check for RSPM; if set, use a fallback repository for renv
261-
rspm <- Sys.getenv("RSPM", unset = NA)
262-
if (identical(rspm, repos))
263-
repos <- c(RSPM = rspm, CRAN = cran)
264-
265-
return(repos)
266-
269+
270+
# split on ';' if present
271+
parts <- strsplit(repos, ";", fixed = TRUE)[[1L]]
272+
273+
# split into named repositories if present
274+
idx <- regexpr("=", parts, fixed = TRUE)
275+
keys <- substring(parts, 1L, idx - 1L)
276+
vals <- substring(parts, idx + 1L)
277+
names(vals) <- keys
278+
279+
# if we have a single unnamed repository, call it CRAN
280+
if (length(vals) == 1L && identical(keys, ""))
281+
names(vals) <- "CRAN"
282+
283+
return(vals)
284+
267285
}
268286

269287
# check for lockfile repositories
@@ -511,6 +529,45 @@ local({
511529

512530
}
513531

532+
renv_bootstrap_find <- function(version) {
533+
534+
path <- renv_bootstrap_find_cache(version)
535+
if (length(path) && file.exists(path)) {
536+
catf("- Using renv %s from global package cache", version)
537+
return(path)
538+
}
539+
540+
}
541+
542+
renv_bootstrap_find_cache <- function(version) {
543+
544+
md5 <- attr(version, "md5", exact = TRUE)
545+
if (is.null(md5))
546+
return()
547+
548+
# infer path to renv cache
549+
cache <- Sys.getenv("RENV_PATHS_CACHE", unset = "")
550+
if (!nzchar(cache)) {
551+
tools <- asNamespace("tools")
552+
if (is.function(tools$R_user_dir)) {
553+
root <- tools$R_user_dir("renv", "cache")
554+
cache <- file.path(root, "cache")
555+
}
556+
}
557+
558+
# start completing path to cache
559+
file.path(
560+
cache,
561+
renv_bootstrap_cache_version(),
562+
renv_bootstrap_platform_prefix(),
563+
"renv",
564+
version,
565+
md5,
566+
"renv"
567+
)
568+
569+
}
570+
514571
renv_bootstrap_download_tarball <- function(version) {
515572

516573
# if the user has provided the path to a tarball via
@@ -1181,6 +1238,18 @@ local({
11811238

11821239
}
11831240

1241+
renv_bootstrap_cache_version <- function() {
1242+
# NOTE: users should normally not override the cache version;
1243+
# this is provided just to make testing easier
1244+
Sys.getenv("RENV_CACHE_VERSION", unset = "v5")
1245+
}
1246+
1247+
renv_bootstrap_cache_version_previous <- function() {
1248+
version <- renv_bootstrap_cache_version()
1249+
number <- as.integer(substring(version, 2L))
1250+
paste("v", number - 1L, sep = "")
1251+
}
1252+
11841253
renv_json_read <- function(file = NULL, text = NULL) {
11851254

11861255
jlerr <- NULL

0 commit comments

Comments
 (0)