From 8c004a15e44dc28fde6b5a524df704ebf638ff27 Mon Sep 17 00:00:00 2001 From: Julia Silge Date: Wed, 4 Sep 2024 14:34:23 -0700 Subject: [PATCH] Add attribute to `repos`, for renv users (#502) * Add attribute to `repos`, for renv users * Fix doubled up `options()` * Only attribute if we detect `@CRAN@`, use "IDE" for attribute --- crates/ark/src/modules/positron/options.R | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/crates/ark/src/modules/positron/options.R b/crates/ark/src/modules/positron/options.R index e475c0e38..69478dbc9 100644 --- a/crates/ark/src/modules/positron/options.R +++ b/crates/ark/src/modules/positron/options.R @@ -29,20 +29,19 @@ options(device = function() { # Set cran mirror repos <- getOption("repos") rstudio_cran <- "https://cran.rstudio.com/" - if (is.null(repos) || !is.character(repos)) { - options(repos = c(CRAN = rstudio_cran)) + repos <- c(CRAN = rstudio_cran) } else { if ("CRAN" %in% names(repos)) { if (identical(repos[["CRAN"]], "@CRAN@")) { repos[["CRAN"]] <- rstudio_cran - options(repos = repos) + attr(repos, "IDE") <- TRUE } } else { repos <- c(CRAN = rstudio_cran, repos) - options(repos = repos) } } +options(repos = repos) # Show Plumber apps in the viewer options(plumber.docs.callback = function(url) {