Skip to content

Commit

Permalink
Added option to force re-download of a specified binary version.
Browse files Browse the repository at this point in the history
This makes it easier to test new versions of the backend.
  • Loading branch information
LTLA committed Apr 11, 2024
1 parent d2ce920 commit 6186021
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
7 changes: 4 additions & 3 deletions R/startGobbler.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#' @param port Integer specifying the port to use for hosting the service.
#' If \code{NULL}, a free port is randomly selected.
#' @param wait Integer specifying the number of seconds to wait for service initialization.
#' @param overwrite Logical scalar indicating whether to redownload the Gobbler binary.
#' @param version String containing the desired version of the Gobbler binary.
#'
#' @return For \code{startGobbler}, a list containing:
#' \itemize{
Expand All @@ -34,7 +36,7 @@
#'
#' @export
#' @importFrom utils download.file
startGobbler <- function(staging=tempfile(), registry=tempfile(), port = NULL, wait = 1) {
startGobbler <- function(staging=tempfile(), registry=tempfile(), port = NULL, wait = 1, version = "0.3.0", overwrite = FALSE) {
if (!is.null(running$active)) {
return(list(new=FALSE, staging=running$staging, registry=running$registry, port=running$port, url=assemble_url(running$port)))
}
Expand Down Expand Up @@ -65,12 +67,11 @@ startGobbler <- function(staging=tempfile(), registry=tempfile(), port = NULL, w
stop("unsupported architecture '", sysmachine, "'")
}

version <- "0.3.0"
binary <- sprintf("gobbler-%s-%s", os, arch)
desired <- paste0(binary, "-", version)
exe <- file.path(cache, desired)

if (!file.exists(exe)) {
if (!file.exists(exe) || overwrite) {
url <- paste0("https://github.com/ArtifactDB/gobbler/releases/download/", version, "/", binary)
tmp <- tempfile()
if (download.file(url, tmp)) {
Expand Down
8 changes: 7 additions & 1 deletion man/startGobbler.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6186021

Please sign in to comment.