-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbundle.R
40 lines (39 loc) · 1.56 KB
/
bundle.R
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
36
37
38
39
40
#This scripts prepare the calipseo-shiny code to be deployed on Shiny servers
#It creates a shiny-calipseo.zip out of the source code
#The naming "shiny-calipseo" is conserved for legacy
#-------------------------------------------------------------------------------
wd = getwd()
unlink("../deployment/shiny-calipseo.zip", recursive = TRUE, force = TRUE)
dir.create("../deployment/shiny-calipseo")
for(file in list.files()){
file.copy(
from = file,
to = file.path("../deployment/shiny-calipseo"),
recursive = TRUE,
overwrite = TRUE
)
}
setwd("../deployment")
zip::zip(
"shiny-calipseo.zip",
list.files("shiny-calipseo", full.names = T, recursive = T)
)
unlink("shiny-calipseo", recursive = TRUE, force = TRUE)
setwd(wd)
#prepare local data for a specific country (including definition of statistical indicators)
#-------------------------------------------------------------------------------
setwd(wd)
COUNTRY = "<ISO3>"
country_data_dir = "../deployment/calipseo-data"
unlink(paste0(country_data_dir, "-", COUNTRY,".zip"), recursive = TRUE, force = TRUE)
dir.create(file.path(country_data_dir, "country", COUNTRY), recursive = T)
for(file in list.files(path = sprintf("../calipseo-data/country/%s", COUNTRY), full.names = T)){
file.copy(from = file, to = file.path(country_data_dir, "country", COUNTRY), overwrite = T, recursive = T)
}
setwd("../deployment")
zip::zip(
paste0(country_data_dir, "-", COUNTRY,".zip"),
list.files(basename(country_data_dir), full.names = T, recursive = T)
)
unlink(country_data_dir, recursive = TRUE, force = TRUE)
setwd(wd)