From 8481b83ad007a499f0c177d2f1985f900c06c45d Mon Sep 17 00:00:00 2001 From: Rich Bielby Date: Tue, 19 Nov 2024 16:05:22 +0000 Subject: [PATCH 1/5] Update to disconnect message and workflow --- .github/workflows/deploy-shiny.yaml | 5 - global.R | 2 +- renv.lock | 199 ++++++++++++---------------- renv/activate.R | 2 +- ui.R | 7 +- www/dfe_shiny_gov_style.css | 35 ----- 6 files changed, 92 insertions(+), 158 deletions(-) diff --git a/.github/workflows/deploy-shiny.yaml b/.github/workflows/deploy-shiny.yaml index f3784eb..4a7a5a2 100644 --- a/.github/workflows/deploy-shiny.yaml +++ b/.github/workflows/deploy-shiny.yaml @@ -38,11 +38,6 @@ jobs: - name: Install odbc dependencies run: sudo apt-get install unixodbc-dev - - name: Install processx - shell: Rscript {0} - run: | - install.packages("processx") - - name: restore renv uses: r-lib/actions/setup-renv@v2 diff --git a/global.R b/global.R index 65176dd..f62c48d 100644 --- a/global.R +++ b/global.R @@ -34,7 +34,7 @@ shhh(library(rsconnect)) # Set global variables -------------------------------------------------------- site_title <- "16 to 18 Transition Matrices" # name of app -parent_pub_name <- "Statistical publication" # name of source publication +parent_pub_name <- "A level and other 16 to 18 results" # name of source publication parent_publication <- # link to source publication "https://explore-education-statistics.service.gov.uk/find-statistics/a-level-and-other-16-to-18-results" diff --git a/renv.lock b/renv.lock index 76504e5..a8c7b05 100644 --- a/renv.lock +++ b/renv.lock @@ -1,6 +1,6 @@ { "R": { - "Version": "4.4.1", + "Version": "4.4.2", "Repositories": [ { "Name": "CRAN", @@ -16,13 +16,6 @@ "Repository": "CRAN", "Hash": "85bf3bd8fa58da21a22d84fd4f4ef0a8" }, - "BH": { - "Package": "BH", - "Version": "1.84.0-0", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "a8235afbcd6316e6e91433ea47661013" - }, "DBI": { "Package": "DBI", "Version": "1.2.3", @@ -53,9 +46,9 @@ }, "MASS": { "Package": "MASS", - "Version": "7.3-60.0.1", + "Version": "7.3-61", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Requirements": [ "R", "grDevices", @@ -64,11 +57,11 @@ "stats", "utils" ], - "Hash": "b765b28387acc8ec9e9c1530713cb19c" + "Hash": "0cafd6f0500e5deba33be22c46bf6055" }, "Matrix": { "Package": "Matrix", - "Version": "1.6-5", + "Version": "1.7-1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -81,7 +74,7 @@ "stats", "utils" ], - "Hash": "8c7115cd3a0e048bda2a7cd110549f7a" + "Hash": "5122bb14d8736372411f955e1b16bc8a" }, "PKI": { "Package": "PKI", @@ -122,7 +115,7 @@ }, "R.oo": { "Package": "R.oo", - "Version": "1.26.0", + "Version": "1.27.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -131,7 +124,7 @@ "methods", "utils" ], - "Hash": "4fed809e53ddb5407b3da3d0f572e591" + "Hash": "6ac79ff194202248cf946fe3a5d6d498" }, "R.utils": { "Package": "R.utils", @@ -182,36 +175,24 @@ }, "Rcpp": { "Package": "Rcpp", - "Version": "1.0.13", + "Version": "1.0.13-1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "methods", "utils" ], - "Hash": "f27411eb6d9c3dada5edd444b8416675" - }, - "anytime": { - "Package": "anytime", - "Version": "0.3.9", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "BH", - "R", - "Rcpp" - ], - "Hash": "74a64813f17b492da9c6afda6b128e3d" + "Hash": "6b868847b365672d6c1677b1608da9ed" }, "askpass": { "Package": "askpass", - "Version": "1.2.0", + "Version": "1.2.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "sys" ], - "Hash": "cad6cf7f1d5f6e906700b9d3e718c796" + "Hash": "c39f4155b3ceb1a9a2799d700fbd4b6a" }, "assertthat": { "Package": "assertthat", @@ -245,17 +226,17 @@ }, "bit": { "Package": "bit", - "Version": "4.0.5", + "Version": "4.5.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R" ], - "Hash": "d242abec29412ce988848d0294b208fd" + "Hash": "5dc7b2677d65d0e874fc4aaf0e879987" }, "bit64": { "Package": "bit64", - "Version": "4.0.5", + "Version": "4.5.2", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -265,14 +246,14 @@ "stats", "utils" ], - "Hash": "9fe98599ca456d6552421db0d6772d8f" + "Hash": "e84984bf5f12a18628d9a02322128dfd" }, "bitops": { "Package": "bitops", - "Version": "1.0-8", + "Version": "1.0-9", "Source": "Repository", "Repository": "CRAN", - "Hash": "da69e6b6f8feebec0827205aad3fdbd8" + "Hash": "d972ef991d58c19e6efa71b21f5e144b" }, "blob": { "Package": "blob", @@ -432,10 +413,10 @@ }, "commonmark": { "Package": "commonmark", - "Version": "1.9.1", + "Version": "1.9.2", "Source": "Repository", "Repository": "CRAN", - "Hash": "5d8225445acb167abf7797de48b2ee3c" + "Hash": "14eb0596f987c71535d07c3aff814742" }, "cpp11": { "Package": "cpp11", @@ -474,24 +455,24 @@ }, "curl": { "Package": "curl", - "Version": "5.2.2", + "Version": "6.0.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R" ], - "Hash": "8f27335f2bcff4d6035edcc82d7d46de" + "Hash": "e8ba62486230951fcd2b881c5be23f96" }, "data.table": { "Package": "data.table", - "Version": "1.16.0", + "Version": "1.16.2", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "methods" ], - "Hash": "fb24e05d4a91d8b1c7ff8e284bde834a" + "Hash": "2e00b378fc3be69c865120d9f313039a" }, "dbplyr": { "Package": "dbplyr", @@ -548,14 +529,14 @@ }, "dfeshiny": { "Package": "dfeshiny", - "Version": "0.4.1.9000", + "Version": "0.5.1", "Source": "GitHub", "RemoteType": "github", - "RemoteHost": "api.github.com", "RemoteUsername": "dfe-analytical-services", "RemoteRepo": "dfeshiny", "RemoteRef": "main", - "RemoteSha": "0de4922658c293ea31048a2e63a49c6111162c16", + "RemoteSha": "bff6fef6be5049c7a4a41b350244dba6320ecd7c", + "RemoteHost": "api.github.com", "Requirements": [ "R", "RCurl", @@ -569,7 +550,7 @@ "stringr", "styler" ], - "Hash": "f6a1fd4632a0a75d84b24a77cc098602" + "Hash": "f875b7df5b4b75e24fd6cf38e94bccf0" }, "diffobj": { "Package": "diffobj", @@ -622,14 +603,13 @@ }, "evaluate": { "Package": "evaluate", - "Version": "0.24.0", + "Version": "1.0.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ - "R", - "methods" + "R" ], - "Hash": "a1066cbc05caee9a4bf6d90f194ff4da" + "Hash": "3fd29944b231036ad67c3edb32e02201" }, "fansi": { "Package": "fansi", @@ -659,7 +639,7 @@ }, "fontawesome": { "Package": "fontawesome", - "Version": "0.5.2", + "Version": "0.5.3", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -667,7 +647,7 @@ "htmltools", "rlang" ], - "Hash": "c2efdd5f0bcd1ea861c2d4e2a883a67d" + "Hash": "bd1297f9b5b1fc1372d19e2c4cd82215" }, "formattable": { "Package": "formattable", @@ -686,14 +666,14 @@ }, "fs": { "Package": "fs", - "Version": "1.6.4", + "Version": "1.6.5", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "methods" ], - "Hash": "15aeb8c27f5ea5161f9f6a641fafd93a" + "Hash": "7f48af39fa27711ea5fbd183b399920d" }, "generics": { "Package": "generics", @@ -744,18 +724,18 @@ }, "glue": { "Package": "glue", - "Version": "1.7.0", + "Version": "1.8.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "methods" ], - "Hash": "e0b3a53876554bd45879e596cdb10a52" + "Hash": "5899f1eaa825580172bb56c08266f37c" }, "gtable": { "Package": "gtable", - "Version": "0.3.5", + "Version": "0.3.6", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -764,9 +744,10 @@ "glue", "grid", "lifecycle", - "rlang" + "rlang", + "stats" ], - "Hash": "e18861963cbc65a27736e02b3cd3c4a0" + "Hash": "de949855009e2d4d0e52a844e30617ae" }, "highr": { "Package": "highr", @@ -899,17 +880,17 @@ }, "jsonlite": { "Package": "jsonlite", - "Version": "1.8.8", + "Version": "1.8.9", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "methods" ], - "Hash": "e1b9c55281c5adc4dd113652d9e26768" + "Hash": "4e993b65c2c3ffbffce7bb3e2c6f832b" }, "knitr": { "Package": "knitr", - "Version": "1.48", + "Version": "1.49", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -921,7 +902,7 @@ "xfun", "yaml" ], - "Hash": "acf380f300c721da9fde7df115a5f86f" + "Hash": "9fcb189926d93c636dea94fbe4f44480" }, "labeling": { "Package": "labeling", @@ -947,7 +928,7 @@ }, "lattice": { "Package": "lattice", - "Version": "0.22-5", + "Version": "0.22-6", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -958,7 +939,7 @@ "stats", "utils" ], - "Hash": "7c5e89f04e72d6611c77451f6331a091" + "Hash": "cc5ac1ba4c238c7ca9fa6a87ca11a7e2" }, "lazyeval": { "Package": "lazyeval", @@ -1070,7 +1051,7 @@ }, "nlme": { "Package": "nlme", - "Version": "3.1-164", + "Version": "3.1-166", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1080,7 +1061,7 @@ "stats", "utils" ], - "Hash": "a623a2239e642806158bc4dc3f51565d" + "Hash": "ccbb8846be320b627e6aa2b4616a2ded" }, "odbc": { "Package": "odbc", @@ -1103,13 +1084,13 @@ }, "openssl": { "Package": "openssl", - "Version": "2.2.1", + "Version": "2.2.2", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "askpass" ], - "Hash": "c62edf62de70cadf40553e10c739049d" + "Hash": "d413e0fef796c9401a4419485f709ca1" }, "packrat": { "Package": "packrat", @@ -1149,7 +1130,7 @@ }, "pingr": { "Package": "pingr", - "Version": "2.0.3", + "Version": "2.0.4", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1157,11 +1138,11 @@ "processx", "utils" ], - "Hash": "8d2db1d13f4198a00ebf2f066bf2ab67" + "Hash": "a68ecec33211e55f957631b6163a4898" }, "pkgbuild": { "Package": "pkgbuild", - "Version": "1.4.4", + "Version": "1.4.5", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1172,7 +1153,7 @@ "desc", "processx" ], - "Hash": "a29e8e134a460a01e0ca67a4763c595b" + "Hash": "30eaaab94db72652e72e3475c1b55278" }, "pkgconfig": { "Package": "pkgconfig", @@ -1321,14 +1302,14 @@ }, "ps": { "Package": "ps", - "Version": "1.7.7", + "Version": "1.8.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "utils" ], - "Hash": "878b467580097e9c383acbb16adab57a" + "Hash": "b4404b1de13758dea1c0484ad0d48563" }, "purrr": { "Package": "purrr", @@ -1385,25 +1366,15 @@ "Repository": "CRAN", "Hash": "cbff1b666c6fa6d21202f07e2318d4f1" }, - "rematch2": { - "Package": "rematch2", - "Version": "2.1.2", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "tibble" - ], - "Hash": "76c9e04c712a05848ae7a23d2f170a40" - }, "renv": { "Package": "renv", - "Version": "1.0.7", + "Version": "1.0.11", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "utils" ], - "Hash": "397b7b2a265bc5a7a06852524dabae20" + "Hash": "47623f66b4e80b3b0587bc5d7b309888" }, "reshape2": { "Package": "reshape2", @@ -1431,7 +1402,7 @@ }, "rmarkdown": { "Package": "rmarkdown", - "Version": "2.28", + "Version": "2.29", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1450,7 +1421,7 @@ "xfun", "yaml" ], - "Hash": "062470668513dcda416927085ee9bdc7" + "Hash": "df99277f63d01c34e95e3d2f06a79736" }, "rprojroot": { "Package": "rprojroot", @@ -1464,7 +1435,7 @@ }, "rsconnect": { "Package": "rsconnect", - "Version": "1.3.1", + "Version": "1.3.3", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1483,14 +1454,14 @@ "tools", "yaml" ], - "Hash": "90dc9ac04cec50f25657b077d4aaca57" + "Hash": "d466c98fdce812325feb4ad406c6ca4b" }, "rstudioapi": { "Package": "rstudioapi", - "Version": "0.16.0", + "Version": "0.17.1", "Source": "Repository", "Repository": "CRAN", - "Hash": "96710351d642b70e8f02ddeb237c46a7" + "Hash": "5f90cd73946d706cfe26024294236113" }, "sass": { "Package": "sass", @@ -1561,26 +1532,28 @@ }, "shinyGovstyle": { "Package": "shinyGovstyle", - "Version": "0.0.8", + "Version": "0.1.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "htmltools", "jsonlite", + "magrittr", + "purrr", "shiny", - "shinyjs" + "shinyjs", + "stringr" ], - "Hash": "a593ce187f4a7830392e0843041e3ea8" + "Hash": "4a57256cf54590da8a07c53b995c42a8" }, "shinyWidgets": { "Package": "shinyWidgets", - "Version": "0.8.6", + "Version": "0.8.7", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Requirements": [ "R", - "anytime", "bslib", "grDevices", "htmltools", @@ -1589,7 +1562,7 @@ "sass", "shiny" ], - "Hash": "bc918b6911c4e928e24a9928295de834" + "Hash": "fd8239886f70daa85c36596214958451" }, "shinycssloaders": { "Package": "shinycssloaders", @@ -1757,10 +1730,10 @@ }, "sys": { "Package": "sys", - "Version": "3.4.2", + "Version": "3.4.3", "Source": "Repository", "Repository": "CRAN", - "Hash": "3a1be13d68d47a8cd0bfd74739ca1555" + "Hash": "de342ebfebdbf40477d0758d05426646" }, "testthat": { "Package": "testthat", @@ -1862,13 +1835,13 @@ }, "tinytex": { "Package": "tinytex", - "Version": "0.52", + "Version": "0.54", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "xfun" ], - "Hash": "cfbad971a71f0e27cec22e544a08bc3b" + "Hash": "3ec7e3ddcacc2d34a9046941222bf94d" }, "tzdb": { "Package": "tzdb", @@ -1943,7 +1916,7 @@ }, "waldo": { "Package": "waldo", - "Version": "0.5.3", + "Version": "0.6.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1952,11 +1925,9 @@ "diffobj", "glue", "methods", - "rematch2", - "rlang", - "tibble" + "rlang" ], - "Hash": "16aa934a49658677d8041df9017329b9" + "Hash": "52f574062a7b66e56926988c3fbdb3b7" }, "webdriver": { "Package": "webdriver", @@ -1992,7 +1963,7 @@ }, "withr": { "Package": "withr", - "Version": "3.0.1", + "Version": "3.0.2", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -2000,11 +1971,11 @@ "grDevices", "graphics" ], - "Hash": "07909200e8bbe90426fbfeb73e1e27aa" + "Hash": "cc2d62c76458d425210d1eb1478b30b4" }, "xfun": { "Package": "xfun", - "Version": "0.47", + "Version": "0.49", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -2013,7 +1984,7 @@ "stats", "tools" ], - "Hash": "36ab21660e2d095fef0d83f689e0477c" + "Hash": "8687398773806cfff9401a2feca96298" }, "xtable": { "Package": "xtable", diff --git a/renv/activate.R b/renv/activate.R index d13f993..c11525e 100644 --- a/renv/activate.R +++ b/renv/activate.R @@ -2,7 +2,7 @@ local({ # the requested version of renv - version <- "1.0.7" + version <- "1.0.11" attr(version, "sha") <- NULL # the project directory diff --git a/ui.R b/ui.R index c5a2b9e..fd251f7 100644 --- a/ui.R +++ b/ui.R @@ -64,7 +64,7 @@ ui <- function(input, output, session) { href = "dfefavicon.png" ), # Add title for browser tabs - tags$title("16 to 18 Transition Matrices") + tags$title(site_title) ), tags$html(lang = "en"), # Add meta description for search engines @@ -79,7 +79,10 @@ ui <- function(input, output, session) { referrer = "no-referrer" ), shinyjs::useShinyjs(), - customDisconnectMessage(), + dfeshiny::custom_disconnect_message( + publication_name = parent_pub_name, + publication_link = parent_publication + ), tags$head(includeHTML(("google-analytics.html"))), tags$head( tags$link( diff --git a/www/dfe_shiny_gov_style.css b/www/dfe_shiny_gov_style.css index 29d96ec..fd02d4c 100644 --- a/www/dfe_shiny_gov_style.css +++ b/www/dfe_shiny_gov_style.css @@ -196,41 +196,6 @@ a:active { color: #ffffff; } -#ss-connect-dialog { display: none !important; } -#shiny-disconnected-overlay { display: none !important; } - -#ss-overlay { - background-color: #000000 !important; - opacity: 0.6 !important; - position: fixed !important; - top: 0 !important; - left: 0 !important; - bottom: 0 !important; - right: 0 !important; - z-index: 99998 !important; - overflow: hidden !important; - cursor: not-allowed !important; - } - -#custom-disconnect-dialog { - background: #000000 !important; - color: #FFFFFF !important; - width: full !important; - transform: translateX(-50%) translateY(-50%) !important; - font-size: 16px !important; - top: 50% !important; - position: fixed !important; - bottom: auto !important; - left: 50% !important; - padding: 0.8em 1.5em !important; - text-align: center !important; - height: auto !important; - opacity: 1 !important; - z-index: 99999 !important; - border-radius: 3px !important; - box-shadow: rgba(0, 0, 0, 0.3) 3px 3px 10px !important; - } - .govuk-width-container { width: 100% !important; max-width: 100% !important; From d7e3346e4ea981e96bafdca428abe307ea0ddea1 Mon Sep 17 00:00:00 2001 From: Rich Bielby Date: Tue, 19 Nov 2024 16:12:40 +0000 Subject: [PATCH 2/5] Remvoing rsconnect --- global.R | 1 - renv.lock | 46 -------- renv/activate.R | 103 ++++++++++++++++-- .../ks5-transition-matrices.dcf | 10 -- 4 files changed, 94 insertions(+), 66 deletions(-) delete mode 100644 rsconnect/shinyapps.io/department-for-education/ks5-transition-matrices.dcf diff --git a/global.R b/global.R index f62c48d..619d775 100644 --- a/global.R +++ b/global.R @@ -27,7 +27,6 @@ shhh(library(metathis)) shhh(library(tidyr)) shhh(library(stringr)) shhh(library(reshape2)) -shhh(library(rsconnect)) # Functions --------------------------------------------------------------------------------- diff --git a/renv.lock b/renv.lock index a8c7b05..2b6bf39 100644 --- a/renv.lock +++ b/renv.lock @@ -76,17 +76,6 @@ ], "Hash": "5122bb14d8736372411f955e1b16bc8a" }, - "PKI": { - "Package": "PKI", - "Version": "0.1-14", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "base64enc" - ], - "Hash": "f5b9c6b2f62f1fa3dd53fd1ddccbb241" - }, "R.cache": { "Package": "R.cache", "Version": "0.16.0", @@ -1092,18 +1081,6 @@ ], "Hash": "d413e0fef796c9401a4419485f709ca1" }, - "packrat": { - "Package": "packrat", - "Version": "0.9.2", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "tools", - "utils" - ], - "Hash": "55ddd2d4a1959535f18393478b0c14a6" - }, "parsedate": { "Package": "parsedate", "Version": "1.3.1", @@ -1433,29 +1410,6 @@ ], "Hash": "4c8415e0ec1e29f3f4f6fc108bef0144" }, - "rsconnect": { - "Package": "rsconnect", - "Version": "1.3.3", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "PKI", - "R", - "cli", - "curl", - "digest", - "jsonlite", - "lifecycle", - "openssl", - "packrat", - "renv", - "rlang", - "rstudioapi", - "tools", - "yaml" - ], - "Hash": "d466c98fdce812325feb4ad406c6ca4b" - }, "rstudioapi": { "Package": "rstudioapi", "Version": "0.17.1", diff --git a/renv/activate.R b/renv/activate.R index c11525e..0eb5108 100644 --- a/renv/activate.R +++ b/renv/activate.R @@ -98,6 +98,66 @@ local({ unloadNamespace("renv") # load bootstrap tools + ansify <- function(text) { + if (renv_ansify_enabled()) + renv_ansify_enhanced(text) + else + renv_ansify_default(text) + } + + renv_ansify_enabled <- function() { + + override <- Sys.getenv("RENV_ANSIFY_ENABLED", unset = NA) + if (!is.na(override)) + return(as.logical(override)) + + pane <- Sys.getenv("RSTUDIO_CHILD_PROCESS_PANE", unset = NA) + if (identical(pane, "build")) + return(FALSE) + + testthat <- Sys.getenv("TESTTHAT", unset = "false") + if (tolower(testthat) %in% "true") + return(FALSE) + + iderun <- Sys.getenv("R_CLI_HAS_HYPERLINK_IDE_RUN", unset = "false") + if (tolower(iderun) %in% "false") + return(FALSE) + + TRUE + + } + + renv_ansify_default <- function(text) { + text + } + + renv_ansify_enhanced <- function(text) { + + # R help links + pattern <- "`\\?(renv::(?:[^`])+)`" + replacement <- "`\033]8;;ide:help:\\1\a?\\1\033]8;;\a`" + text <- gsub(pattern, replacement, text, perl = TRUE) + + # runnable code + pattern <- "`(renv::(?:[^`])+)`" + replacement <- "`\033]8;;ide:run:\\1\a\\1\033]8;;\a`" + text <- gsub(pattern, replacement, text, perl = TRUE) + + # return ansified text + text + + } + + renv_ansify_init <- function() { + + envir <- renv_envir_self() + if (renv_ansify_enabled()) + assign("ansify", renv_ansify_enhanced, envir = envir) + else + assign("ansify", renv_ansify_default, envir = envir) + + } + `%||%` <- function(x, y) { if (is.null(x)) y else x } @@ -142,7 +202,10 @@ local({ # compute common indent indent <- regexpr("[^[:space:]]", lines) common <- min(setdiff(indent, -1L)) - leave - paste(substring(lines, common), collapse = "\n") + text <- paste(substring(lines, common), collapse = "\n") + + # substitute in ANSI links for executable renv code + ansify(text) } @@ -305,8 +368,11 @@ local({ quiet = TRUE ) - if ("headers" %in% names(formals(utils::download.file))) - args$headers <- renv_bootstrap_download_custom_headers(url) + if ("headers" %in% names(formals(utils::download.file))) { + headers <- renv_bootstrap_download_custom_headers(url) + if (length(headers) && is.character(headers)) + args$headers <- headers + } do.call(utils::download.file, args) @@ -385,10 +451,21 @@ local({ for (type in types) { for (repos in renv_bootstrap_repos()) { + # build arguments for utils::available.packages() call + args <- list(type = type, repos = repos) + + # add custom headers if available -- note that + # utils::available.packages() will pass this to download.file() + if ("headers" %in% names(formals(utils::download.file))) { + headers <- renv_bootstrap_download_custom_headers(repos) + if (length(headers) && is.character(headers)) + args$headers <- headers + } + # retrieve package database db <- tryCatch( as.data.frame( - utils::available.packages(type = type, repos = repos), + do.call(utils::available.packages, args), stringsAsFactors = FALSE ), error = identity @@ -470,6 +547,14 @@ local({ } + renv_bootstrap_github_token <- function() { + for (envvar in c("GITHUB_TOKEN", "GITHUB_PAT", "GH_TOKEN")) { + envval <- Sys.getenv(envvar, unset = NA) + if (!is.na(envval)) + return(envval) + } + } + renv_bootstrap_download_github <- function(version) { enabled <- Sys.getenv("RENV_BOOTSTRAP_FROM_GITHUB", unset = "TRUE") @@ -477,16 +562,16 @@ local({ return(FALSE) # prepare download options - pat <- Sys.getenv("GITHUB_PAT") - if (nzchar(Sys.which("curl")) && nzchar(pat)) { + token <- renv_bootstrap_github_token() + if (nzchar(Sys.which("curl")) && nzchar(token)) { fmt <- "--location --fail --header \"Authorization: token %s\"" - extra <- sprintf(fmt, pat) + extra <- sprintf(fmt, token) saved <- options("download.file.method", "download.file.extra") options(download.file.method = "curl", download.file.extra = extra) on.exit(do.call(base::options, saved), add = TRUE) - } else if (nzchar(Sys.which("wget")) && nzchar(pat)) { + } else if (nzchar(Sys.which("wget")) && nzchar(token)) { fmt <- "--header=\"Authorization: token %s\"" - extra <- sprintf(fmt, pat) + extra <- sprintf(fmt, token) saved <- options("download.file.method", "download.file.extra") options(download.file.method = "wget", download.file.extra = extra) on.exit(do.call(base::options, saved), add = TRUE) diff --git a/rsconnect/shinyapps.io/department-for-education/ks5-transition-matrices.dcf b/rsconnect/shinyapps.io/department-for-education/ks5-transition-matrices.dcf deleted file mode 100644 index aad3844..0000000 --- a/rsconnect/shinyapps.io/department-for-education/ks5-transition-matrices.dcf +++ /dev/null @@ -1,10 +0,0 @@ -name: ks5-transition-matrices -title: -username: -account: department-for-education -server: shinyapps.io -hostUrl: https://api.shinyapps.io/v1 -appId: 3087703 -bundleId: 3778092 -url: https://department-for-education.shinyapps.io/ks5-transition-matrices/ -when: 1603561394.18688 From b040627473602be84558632ccd4991a843d7f977 Mon Sep 17 00:00:00 2001 From: Rich Bielby Date: Tue, 19 Nov 2024 16:13:11 +0000 Subject: [PATCH 3/5] Adding rsconnect entry to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 0cc43f0..6259302 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ .RData .Ruserdata /SQL_production/TM_data_issues.docx +rsconnect From 22a2cdac6cf95b3c6dbb1d7b52f0607ff859b1cf Mon Sep 17 00:00:00 2001 From: Rich Bielby Date: Tue, 19 Nov 2024 16:29:11 +0000 Subject: [PATCH 4/5] Adding processx install back into workflow as renv restore seems to be missing it despite it being in the lockfile --- .github/workflows/deploy-shiny.yaml | 5 +++++ renv/settings.dcf | 6 ------ 2 files changed, 5 insertions(+), 6 deletions(-) delete mode 100644 renv/settings.dcf diff --git a/.github/workflows/deploy-shiny.yaml b/.github/workflows/deploy-shiny.yaml index 4a7a5a2..f3784eb 100644 --- a/.github/workflows/deploy-shiny.yaml +++ b/.github/workflows/deploy-shiny.yaml @@ -38,6 +38,11 @@ jobs: - name: Install odbc dependencies run: sudo apt-get install unixodbc-dev + - name: Install processx + shell: Rscript {0} + run: | + install.packages("processx") + - name: restore renv uses: r-lib/actions/setup-renv@v2 diff --git a/renv/settings.dcf b/renv/settings.dcf deleted file mode 100644 index bba46f4..0000000 --- a/renv/settings.dcf +++ /dev/null @@ -1,6 +0,0 @@ -external.libraries: -ignored.packages: -package.dependency.fields: Imports, Depends, LinkingTo -snapshot.type: packrat -use.cache: TRUE -vcs.ignore.library: TRUE From d43dddeb2d98033068c587cfca0900890c138899 Mon Sep 17 00:00:00 2001 From: Rich Bielby Date: Tue, 19 Nov 2024 16:32:43 +0000 Subject: [PATCH 5/5] Fixing R version in deploy script to 4.4.1 --- .github/workflows/deploy-shiny.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/deploy-shiny.yaml b/.github/workflows/deploy-shiny.yaml index f3784eb..02f75d2 100644 --- a/.github/workflows/deploy-shiny.yaml +++ b/.github/workflows/deploy-shiny.yaml @@ -25,6 +25,8 @@ jobs: - uses: r-lib/actions/setup-r@v2 with: use-public-rspm: true + r-version: 4.4.1 + - name: Set env vars (dev) if: endsWith(github.ref, '/development')