Skip to content

Commit

Permalink
Merge pull request #65 from rstudio/feature/restart-app
Browse files Browse the repository at this point in the history
add restartApp function
  • Loading branch information
jjallaire committed Jun 26, 2014
2 parents eb9a491 + 0fea98a commit cfd5422
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 7 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Expand Up @@ -32,3 +32,4 @@ Collate:
'terminateApp.R'
'configureApp.R'
'tasks.R'
'restartApp.R'
1 change: 1 addition & 0 deletions NAMESPACE
Expand Up @@ -10,6 +10,7 @@ export(deployments)
export(hr)
export(removeAccount)
export(removeAuthorizedUser)
export(restartApp)
export(scaleApp)
export(setAccountInfo)
export(taskLog)
Expand Down
2 changes: 1 addition & 1 deletion R/deployApp.R
Expand Up @@ -50,7 +50,7 @@
#' deployApp(launch.browser = FALSE)
#' }
#' @seealso \code{\link{applications}}, \code{\link{terminateApp}}, and
#' \code{\link{scaleApp}}
#' \code{\link{restartApp}
#' @export
deployApp <- function(appDir = getwd(),
appName = NULL,
Expand Down
2 changes: 1 addition & 1 deletion R/lucid.R
Expand Up @@ -52,7 +52,7 @@ lucidClient <- function(authInfo) {
handleResponse(POST(authInfo, path, "application/x-gzip", bundlePath))
},

deployApplication = function(applicationId, bundleId) {
deployApplication = function(applicationId, bundleId=NULL) {
path <- paste("/applications/", applicationId, "/deploy", sep="")
json <- list()
json$bundle <- as.numeric(bundleId)
Expand Down
31 changes: 31 additions & 0 deletions R/restartApp.R
@@ -0,0 +1,31 @@
#' Restart an Application
#'
#' Restart an application currently running on ShinyApps.
#' @param appName Name of application to restart
#' @param account Account name. If a single account is registered on the
#' system then this parameter can be omitted.
#' @param quiet Request that no status information be printed to the console
#' during the operation.
#' @examples
#' \dontrun{
#'
#' # restart an application
#' restartApp("myapp")
#' }
#' @seealso \code{\link{applications}}, \code{\link{deployApp}}, and
#' \code{\link{terminateApp}}
#' @export
restartApp <- function(appName, account = NULL, quiet = FALSE) {

# define deploy task
taskDef <- list()
taskDef$beginStatus <- "Restarting application"
taskDef$endStatus <- "Application successfully restarted"
taskDef$action <- function(lucid, application) {
lucid$deployApplication(application$id)
}

# perform it
applicationTask(taskDef, appName, account, quiet)
}

2 changes: 1 addition & 1 deletion R/terminateApp.R
Expand Up @@ -13,7 +13,7 @@
#' terminateApp("myapp")
#' }
#' @seealso \code{\link{applications}}, \code{\link{deployApp}}, and
#' \code{\link{scaleApp}}
#' \code{\link{restartApp}}
#' @export
terminateApp <- function(appName, account = NULL, quiet = FALSE) {

Expand Down
4 changes: 2 additions & 2 deletions man/deployApp.Rd
Expand Up @@ -75,7 +75,7 @@ deployApp(launch.browser = FALSE)
}
}
\seealso{
\code{\link{applications}}, \code{\link{terminateApp}},
and \code{\link{scaleApp}}
\code{\link{applications}}, \code{\link{terminateApp}}, and
\code{\link{restartApp}
}

31 changes: 31 additions & 0 deletions man/restartApp.Rd
@@ -0,0 +1,31 @@
\name{restartApp}
\alias{restartApp}
\title{Restart an Application}
\usage{
restartApp(appName, account = NULL, quiet = FALSE)
}
\arguments{
\item{appName}{Name of application to restart}

\item{account}{Account name. If a single account is
registered on the system then this parameter can be
omitted.}

\item{quiet}{Request that no status information be
printed to the console during the operation.}
}
\description{
Restart an application currently running on ShinyApps.
}
\examples{
\dontrun{

# restart an application
restartApp("myapp")
}
}
\seealso{
\code{\link{applications}}, \code{\link{deployApp}}, and
\code{\link{terminateApp}}
}

4 changes: 2 additions & 2 deletions man/terminateApp.Rd
Expand Up @@ -25,7 +25,7 @@ terminateApp("myapp")
}
}
\seealso{
\code{\link{applications}}, \code{\link{deployApp}}, and
\code{\link{scaleApp}}
\code{\link{applications}}, \code{\link{deployApp}}, and
\code{\link{restartApp}}
}

0 comments on commit cfd5422

Please sign in to comment.