1212# ' @param wait Integer specifying the number of seconds to wait for service initialization.
1313# ' @param overwrite Logical scalar indicating whether to redownload the Gobbler binary.
1414# ' @param version String containing the desired version of the Gobbler binary.
15+ # ' @param admin Character vector of user names of the Gobbler administrators.
16+ # ' If \code{NULL}, this defaults to the current user.
17+ # ' @param extra.args Character vector of extra arguments to pass to the Gobbler binary.
18+ # ' If \code{NULL}, no extra arguments are added.
1519# '
1620# ' @return For \code{startGobbler}, a list containing:
1721# ' \itemize{
3640# '
3741# ' @export
3842# ' @importFrom utils download.file
39- startGobbler <- function (staging = tempfile(), registry = tempfile(), port = NULL , wait = 1 , version = " 0.5.0" , overwrite = FALSE ) {
43+ startGobbler <- function (staging = tempfile(), registry = tempfile(), port = NULL , wait = 1 , version = " 0.5.0" , overwrite = FALSE , admin = NULL , extra.args = NULL ) {
4044 if (! is.null(running $ active )) {
4145 return (list (new = FALSE , staging = running $ staging , registry = running $ registry , port = running $ port , url = assemble_url(running $ port )))
4246 }
@@ -49,7 +53,7 @@ startGobbler <- function(staging=tempfile(), registry=tempfile(), port = NULL, w
4953 cache <- tools :: R_user_dir(" gobbler" , " data" )
5054
5155 sinfo <- Sys.info()
52- sysname <- sinfo [" sysname" ]
56+ sysname <- sinfo [[ " sysname" ] ]
5357 if (sysname == " Darwin" ) {
5458 os <- " darwin"
5559 } else if (sysname == " Linux" ) {
@@ -58,7 +62,7 @@ startGobbler <- function(staging=tempfile(), registry=tempfile(), port = NULL, w
5862 stop(" unsupported operating system '" , sysname , " '" )
5963 }
6064
61- sysmachine <- sinfo [" machine" ]
65+ sysmachine <- sinfo [[ " machine" ] ]
6266 if (sysmachine == " arm64" ) {
6367 arch <- " arm64"
6468 } else if (sysmachine == " x86_64" ) {
@@ -91,10 +95,18 @@ startGobbler <- function(staging=tempfile(), registry=tempfile(), port = NULL, w
9195 if (is.null(port )) {
9296 port <- choose_port()
9397 }
98+ if (is.null(admin )) {
99+ admin <- sinfo [[" user" ]]
100+ }
94101
95- self <- sinfo [" user" ]
102+ args <- c(shQuote(exe ), " -staging" , shQuote(staging ), " -registry" , shQuote(registry ), " -port" , shQuote(port ))
103+ if (length(admin )) {
104+ args <- c(args , " -admin" , shQuote(paste(admin , collapse = " ," )))
105+ }
106+ args <- c(args , extra.args )
107+
96108 script <- system.file(" scripts" , " deploy.sh" , package = " gobbler" , mustWork = TRUE )
97- pid <- system2(script , c(shQuote( exe ), shQuote( staging ), shQuote( registry ), shQuote( self ), shQuote( port )) , stdout = TRUE )
109+ pid <- system2(script , args , stdout = TRUE )
98110 Sys.sleep(wait )
99111
100112 process <- new.env()
0 commit comments