-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.R
69 lines (65 loc) · 2.52 KB
/
install.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#### name:install ####
"
if on linux_os I assume you will use this from user_home (~/)
else assume windows and I assume you will use web2py from C:/Temp
remove the comments before this will work automatically, and probably safest to double check
that the download source files are safe
"
#download_web2py <- FALSE
# need to decide which download of web2py, linux(and macos) or win
#OsLinux <- TRUE
## if(linux_os()){
## if(!file.exists("~/web2py_src.zip")) download_web2py <- TRUE
## if(download_web2py){
## # I assume you will use this from ~/
## # download.file("http://web2py.com/examples/static/web2py_src.zip",
## # destfile = "~/web2py_src.zip", mode = "wb")
## unzip("~/web2py_src.zip")
## }
## setwd("~/web2py/applications/")
## } else {
## if(!file.exists("C:/Temp/web2py_win.zip")) download_web2py <- TRUE
## if(download_web2py){
## # I assume you will use web2py from the top of C
## dir.create("C:/Temp",showWarnings = F)
## download.file("http://web2py.com/examples/static/web2py_win.zip",
## destfile = "C:/Temp/web2py_win.zip", mode = "wb")
## setwd("C:/Temp/")
## unzip("web2py_win.zip")
## }
## setwd("C:/Temp/web2py/applications/")
## }
## if(file.exists("biomass_smoke_events_db")){
## file.rename("biomass_smoke_events_db",
## sprintf("biomass_smoke_events_db_%s",make.names(Sys.time()))
## )
## }
## if(!require(downloader)) install.packages("downloader");
## downloader::download("https://github.com/swish-climate-impact-assessment/biomass_smoke_events_db/archive/master.zip",
## "temp.zip", mode = "wb")
## unzip("temp.zip")
## file.rename("biomass_smoke_events_db-master", "biomass_smoke_events_db")
## #dir()
## if(linux_os()){
## setwd("~/web2py")
## sink("w2p.py")
## cat("python web2py.py -a xpassword -i 0.0.0.0 -p 8181\n")
## cat("firefox http://127.0.0.1:8181/biomass_smoke_events_db")
## sink()
## print(cat('you have a go script in ~/web2py/w2p.py\n
## bash it to run it\n'))
## # or just try to do it from R
## system("python web2py.py -a xpassword -i 0.0.0.0 -p 8181", wait = F)
## browseURL("http://127.0.0.1:8181/biomass_smoke_events_db")
## } else {
## setwd("C:/Temp/")
## sink("w2p.cmd")
## cat("cd C:/Temp/web2py\n")
## cat("start web2py.exe -a xpassword -i 0.0.0.0 -p 8181\n")
## cat("cmd /c start http://127.0.0.1:8181/biomass_smoke_events_db")
## sink()
## print(cat('you have a batch file now: C:/Temp/w2p.cmd\n
## Double click to run it\n'))
## # or just try to do it from R
## shell("w2p.cmd")
## }