Explorar el Código

Keep check_version from failing if no internet connection

tags/v0.2.0
Garrick Aden-Buie hace 8 años
padre
commit
3b01cf267a
Se han modificado 1 ficheros con 10 adiciones y 7 borrados
  1. +10
    -7
      R/regex_gadget.R

+ 10
- 7
R/regex_gadget.R Ver fichero

@@ -381,13 +381,16 @@ check_version <- function(
ok_to_check <- getOption("regexplain.no.check.version", TRUE)
if (!ok_to_check) return(NULL)
if (!requireNamespace('jsonlite', quietly = TRUE)) return(NULL)
gh_tags <- jsonlite::fromJSON(
paste0("https://api.github.com/repos/", gh_user, "/", gh_repo, "/git/refs/tags"),
simplifyDataFrame = TRUE
)
gh_tags$tag <- sub("refs/tags/", "", gh_tags$ref, fixed = TRUE)
gh_tags$version <- sub("^v\\.?", "", gh_tags$tag)
if (any(gh_tags$version > this_version)) {
gh_tags <- NULL
try({
gh_tags <- jsonlite::fromJSON(
paste0("https://api.github.com/repos/", gh_user, "/", gh_repo, "/git/refs/tags"),
simplifyDataFrame = TRUE
)
gh_tags$tag <- sub("refs/tags/", "", gh_tags$ref, fixed = TRUE)
gh_tags$version <- sub("^v\\.?", "", gh_tags$tag)
})
if (!is.null(gh_tags) && any(gh_tags$version > this_version)) {
max_version <- max(gh_tags$version)
max_tag <- gh_tags$tag[gh_tags$version == max_version]
options(regexplain.no.check.version = FALSE)

Cargando…
Cancelar
Guardar