forked from rstudio/shiny-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy
More file actions
executable file
·35 lines (32 loc) · 1.11 KB
/
Copy pathdeploy
File metadata and controls
executable file
·35 lines (32 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/Rscript
if (FALSE) {
devtools::install_github('rstudio/shiny')
devtools::install_github('rstudio/shinyapps')
}
# first, sync shiny examples
if (file_test('-d', '../shiny/inst/examples')) {
for (app in list.dirs('../shiny/inst/examples', recursive = FALSE)) {
dir.create(app1 <- sub('^(\\d\\d)_', '0\\1-', basename(app)), showWarnings = FALSE)
file.copy(list.files(app, full.names = TRUE), app1, recursive = TRUE)
}
}
# then deploy all apps
library(methods)
library(shinyapps)
# ./deploy 001-hello 002-text ...
apps = commandArgs(TRUE)
# if not specified, use all the directories here
if (length(apps) == 0) {
apps = list.dirs(full.names = FALSE, recursive = FALSE)
apps = grep('^[0-9]{3,}', apps, value = TRUE)
}
# print the apps that were not successfully deployed
print(apps[unlist(lapply(apps, function(app) {
if (inherits(try(deployApp(app, account = 'demo')), 'try-error')) return(1)
system(paste(
'../shiny-dev-center/_scripts/import.R',
app,
sprintf('http://demo.shinyapps.io/%s', app),
sprintf('https://github.com/rstudio/shiny-examples/tree/master/%s', app)
))
})) != 0])