Skip to content

Commit 3cbc597

Browse files
authored
[actions] update 8 packages
1 parent 984cbe6 commit 3cbc597

File tree

2 files changed

+112
-28
lines changed

2 files changed

+112
-28
lines changed

renv/activate.R

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

44
# the requested version of renv
5-
version <- "1.0.7"
5+
version <- "1.0.11"
66
attr(version, "sha") <- NULL
77

88
# the project directory
@@ -98,6 +98,66 @@ local({
9898
unloadNamespace("renv")
9999

100100
# load bootstrap tools
101+
ansify <- function(text) {
102+
if (renv_ansify_enabled())
103+
renv_ansify_enhanced(text)
104+
else
105+
renv_ansify_default(text)
106+
}
107+
108+
renv_ansify_enabled <- function() {
109+
110+
override <- Sys.getenv("RENV_ANSIFY_ENABLED", unset = NA)
111+
if (!is.na(override))
112+
return(as.logical(override))
113+
114+
pane <- Sys.getenv("RSTUDIO_CHILD_PROCESS_PANE", unset = NA)
115+
if (identical(pane, "build"))
116+
return(FALSE)
117+
118+
testthat <- Sys.getenv("TESTTHAT", unset = "false")
119+
if (tolower(testthat) %in% "true")
120+
return(FALSE)
121+
122+
iderun <- Sys.getenv("R_CLI_HAS_HYPERLINK_IDE_RUN", unset = "false")
123+
if (tolower(iderun) %in% "false")
124+
return(FALSE)
125+
126+
TRUE
127+
128+
}
129+
130+
renv_ansify_default <- function(text) {
131+
text
132+
}
133+
134+
renv_ansify_enhanced <- function(text) {
135+
136+
# R help links
137+
pattern <- "`\\?(renv::(?:[^`])+)`"
138+
replacement <- "`\033]8;;ide:help:\\1\a?\\1\033]8;;\a`"
139+
text <- gsub(pattern, replacement, text, perl = TRUE)
140+
141+
# runnable code
142+
pattern <- "`(renv::(?:[^`])+)`"
143+
replacement <- "`\033]8;;ide:run:\\1\a\\1\033]8;;\a`"
144+
text <- gsub(pattern, replacement, text, perl = TRUE)
145+
146+
# return ansified text
147+
text
148+
149+
}
150+
151+
renv_ansify_init <- function() {
152+
153+
envir <- renv_envir_self()
154+
if (renv_ansify_enabled())
155+
assign("ansify", renv_ansify_enhanced, envir = envir)
156+
else
157+
assign("ansify", renv_ansify_default, envir = envir)
158+
159+
}
160+
101161
`%||%` <- function(x, y) {
102162
if (is.null(x)) y else x
103163
}
@@ -142,7 +202,10 @@ local({
142202
# compute common indent
143203
indent <- regexpr("[^[:space:]]", lines)
144204
common <- min(setdiff(indent, -1L)) - leave
145-
paste(substring(lines, common), collapse = "\n")
205+
text <- paste(substring(lines, common), collapse = "\n")
206+
207+
# substitute in ANSI links for executable renv code
208+
ansify(text)
146209

147210
}
148211

@@ -305,8 +368,11 @@ local({
305368
quiet = TRUE
306369
)
307370

308-
if ("headers" %in% names(formals(utils::download.file)))
309-
args$headers <- renv_bootstrap_download_custom_headers(url)
371+
if ("headers" %in% names(formals(utils::download.file))) {
372+
headers <- renv_bootstrap_download_custom_headers(url)
373+
if (length(headers) && is.character(headers))
374+
args$headers <- headers
375+
}
310376

311377
do.call(utils::download.file, args)
312378

@@ -385,10 +451,21 @@ local({
385451
for (type in types) {
386452
for (repos in renv_bootstrap_repos()) {
387453

454+
# build arguments for utils::available.packages() call
455+
args <- list(type = type, repos = repos)
456+
457+
# add custom headers if available -- note that
458+
# utils::available.packages() will pass this to download.file()
459+
if ("headers" %in% names(formals(utils::download.file))) {
460+
headers <- renv_bootstrap_download_custom_headers(repos)
461+
if (length(headers) && is.character(headers))
462+
args$headers <- headers
463+
}
464+
388465
# retrieve package database
389466
db <- tryCatch(
390467
as.data.frame(
391-
utils::available.packages(type = type, repos = repos),
468+
do.call(utils::available.packages, args),
392469
stringsAsFactors = FALSE
393470
),
394471
error = identity
@@ -470,23 +547,31 @@ local({
470547

471548
}
472549

550+
renv_bootstrap_github_token <- function() {
551+
for (envvar in c("GITHUB_TOKEN", "GITHUB_PAT", "GH_TOKEN")) {
552+
envval <- Sys.getenv(envvar, unset = NA)
553+
if (!is.na(envval))
554+
return(envval)
555+
}
556+
}
557+
473558
renv_bootstrap_download_github <- function(version) {
474559

475560
enabled <- Sys.getenv("RENV_BOOTSTRAP_FROM_GITHUB", unset = "TRUE")
476561
if (!identical(enabled, "TRUE"))
477562
return(FALSE)
478563

479564
# prepare download options
480-
pat <- Sys.getenv("GITHUB_PAT")
481-
if (nzchar(Sys.which("curl")) && nzchar(pat)) {
565+
token <- renv_bootstrap_github_token()
566+
if (nzchar(Sys.which("curl")) && nzchar(token)) {
482567
fmt <- "--location --fail --header \"Authorization: token %s\""
483-
extra <- sprintf(fmt, pat)
568+
extra <- sprintf(fmt, token)
484569
saved <- options("download.file.method", "download.file.extra")
485570
options(download.file.method = "curl", download.file.extra = extra)
486571
on.exit(do.call(base::options, saved), add = TRUE)
487-
} else if (nzchar(Sys.which("wget")) && nzchar(pat)) {
572+
} else if (nzchar(Sys.which("wget")) && nzchar(token)) {
488573
fmt <- "--header=\"Authorization: token %s\""
489-
extra <- sprintf(fmt, pat)
574+
extra <- sprintf(fmt, token)
490575
saved <- options("download.file.method", "download.file.extra")
491576
options(download.file.method = "wget", download.file.extra = extra)
492577
on.exit(do.call(base::options, saved), add = TRUE)

renv/profiles/lesson-requirements/renv.lock

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,13 @@
9494
},
9595
"evaluate": {
9696
"Package": "evaluate",
97-
"Version": "0.24.0",
97+
"Version": "1.0.1",
9898
"Source": "Repository",
9999
"Repository": "CRAN",
100100
"Requirements": [
101-
"R",
102-
"methods"
101+
"R"
103102
],
104-
"Hash": "a1066cbc05caee9a4bf6d90f194ff4da"
103+
"Hash": "3fd29944b231036ad67c3edb32e02201"
105104
},
106105
"fastmap": {
107106
"Package": "fastmap",
@@ -124,25 +123,25 @@
124123
},
125124
"fs": {
126125
"Package": "fs",
127-
"Version": "1.6.4",
126+
"Version": "1.6.5",
128127
"Source": "Repository",
129128
"Repository": "CRAN",
130129
"Requirements": [
131130
"R",
132131
"methods"
133132
],
134-
"Hash": "15aeb8c27f5ea5161f9f6a641fafd93a"
133+
"Hash": "7f48af39fa27711ea5fbd183b399920d"
135134
},
136135
"glue": {
137136
"Package": "glue",
138-
"Version": "1.7.0",
137+
"Version": "1.8.0",
139138
"Source": "Repository",
140139
"Repository": "CRAN",
141140
"Requirements": [
142141
"R",
143142
"methods"
144143
],
145-
"Hash": "e0b3a53876554bd45879e596cdb10a52"
144+
"Hash": "5899f1eaa825580172bb56c08266f37c"
146145
},
147146
"highr": {
148147
"Package": "highr",
@@ -183,13 +182,13 @@
183182
},
184183
"jsonlite": {
185184
"Package": "jsonlite",
186-
"Version": "1.8.8",
185+
"Version": "1.8.9",
187186
"Source": "Repository",
188187
"Repository": "CRAN",
189188
"Requirements": [
190189
"methods"
191190
],
192-
"Hash": "e1b9c55281c5adc4dd113652d9e26768"
191+
"Hash": "4e993b65c2c3ffbffce7bb3e2c6f832b"
193192
},
194193
"knitr": {
195194
"Package": "knitr",
@@ -253,13 +252,13 @@
253252
},
254253
"renv": {
255254
"Package": "renv",
256-
"Version": "1.0.7",
255+
"Version": "1.0.11",
257256
"Source": "Repository",
258257
"Repository": "CRAN",
259258
"Requirements": [
260259
"utils"
261260
],
262-
"Hash": "397b7b2a265bc5a7a06852524dabae20"
261+
"Hash": "47623f66b4e80b3b0587bc5d7b309888"
263262
},
264263
"rlang": {
265264
"Package": "rlang",
@@ -274,7 +273,7 @@
274273
},
275274
"rmarkdown": {
276275
"Package": "rmarkdown",
277-
"Version": "2.28",
276+
"Version": "2.29",
278277
"Source": "Repository",
279278
"Repository": "CRAN",
280279
"Requirements": [
@@ -293,7 +292,7 @@
293292
"xfun",
294293
"yaml"
295294
],
296-
"Hash": "062470668513dcda416927085ee9bdc7"
295+
"Hash": "df99277f63d01c34e95e3d2f06a79736"
297296
},
298297
"sass": {
299298
"Package": "sass",
@@ -311,17 +310,17 @@
311310
},
312311
"tinytex": {
313312
"Package": "tinytex",
314-
"Version": "0.52",
313+
"Version": "0.54",
315314
"Source": "Repository",
316315
"Repository": "CRAN",
317316
"Requirements": [
318317
"xfun"
319318
],
320-
"Hash": "cfbad971a71f0e27cec22e544a08bc3b"
319+
"Hash": "3ec7e3ddcacc2d34a9046941222bf94d"
321320
},
322321
"xfun": {
323322
"Package": "xfun",
324-
"Version": "0.47",
323+
"Version": "0.49",
325324
"Source": "Repository",
326325
"Repository": "CRAN",
327326
"Requirements": [
@@ -330,7 +329,7 @@
330329
"stats",
331330
"tools"
332331
],
333-
"Hash": "36ab21660e2d095fef0d83f689e0477c"
332+
"Hash": "8687398773806cfff9401a2feca96298"
334333
},
335334
"yaml": {
336335
"Package": "yaml",

0 commit comments

Comments
 (0)