Skip to content

Commit

Permalink
[actions] update 3 packages
Browse files Browse the repository at this point in the history
  • Loading branch information
zkamvar committed Mar 9, 2023
1 parent 66ae728 commit f18ca57
Show file tree
Hide file tree
Showing 2 changed files with 164 additions and 80 deletions.
46 changes: 36 additions & 10 deletions renv/activate.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
local({

# the requested version of renv
version <- "0.16.0"
version <- "0.17.0-38"

# the project directory
project <- getwd()
Expand Down Expand Up @@ -94,8 +94,11 @@ local({
return(repos)

# if we're testing, re-use the test repositories
if (renv_bootstrap_tests_running())
return(getOption("renv.tests.repos"))
if (renv_bootstrap_tests_running()) {
repos <- getOption("renv.tests.repos")
if (!is.null(repos))
return(repos)
}

# retrieve current repos
repos <- getOption("repos")
Expand Down Expand Up @@ -344,8 +347,7 @@ local({
return()

# allow directories
info <- file.info(tarball, extra_cols = FALSE)
if (identical(info$isdir, TRUE)) {
if (dir.exists(tarball)) {
name <- sprintf("renv_%s.tar.gz", version)
tarball <- file.path(tarball, name)
}
Expand Down Expand Up @@ -659,8 +661,8 @@ local({
if (version == loadedversion)
return(TRUE)

# assume four-component versions are from GitHub; three-component
# versions are from CRAN
# assume four-component versions are from GitHub;
# three-component versions are from CRAN
components <- strsplit(loadedversion, "[.-]")[[1]]
remote <- if (length(components) == 4L)
paste("rstudio/renv", loadedversion, sep = "@")
Expand Down Expand Up @@ -700,6 +702,12 @@ local({
# warn if the version of renv loaded does not match
renv_bootstrap_validate_version(version)

# execute renv load hooks, if any
hooks <- getHook("renv::autoload")
for (hook in hooks)
if (is.function(hook))
tryCatch(hook(), error = warning)

# load the project
renv::load(project)

Expand Down Expand Up @@ -842,11 +850,29 @@ local({

renv_json_read <- function(file = NULL, text = NULL) {

jlerr <- NULL

# if jsonlite is loaded, use that instead
if ("jsonlite" %in% loadedNamespaces())
renv_json_read_jsonlite(file, text)
if ("jsonlite" %in% loadedNamespaces()) {

json <- catch(renv_json_read_jsonlite(file, text))
if (!inherits(json, "error"))
return(json)

jlerr <- json

}

# otherwise, fall back to the default JSON reader
json <- catch(renv_json_read_default(file, text))
if (!inherits(json, "error"))
return(json)

# report an error
if (!is.null(jlerr))
stop(jlerr)
else
renv_json_read_default(file, text)
stop(json)

}

Expand Down
Loading

0 comments on commit f18ca57

Please sign in to comment.