Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

find a way to track the most recent version of shiny server and subsequently update system command #9

Closed
AndreaCirilloAC opened this issue May 31, 2017 · 4 comments

Comments

@AndreaCirilloAC
Copy link
Owner

within ramazon_mac function a call is made to https://download3.rstudio.org/ubuntu-12.04/x86_64 in order to download a shiny server version, which is set fixed to 1.5.3.838 ( thanks to the recent update from @ScientistJake ).
We should find a way to make amazon dinamically determine the last version and subsequently redirect himself toward the right url.

we could think about something similar to what is don within updateR function to detect last r version ( https://github.com/AndreaCirilloAC/updateR/blob/master/R/updateR.R)

@ScientistJake
Copy link
Contributor

I gave a go at this one.
I haven't tested it within the ramazon function but it provides the correct link! Note that this pulls the most recent build which is not the same one advertised on the shiny server website which is a couple versions back. The latest release might be have some bugs?
Lines 69 to 87:
https://github.com/ScientistJake/ramazon/blob/master/R/ramazon_mac.R

#XML is needed for this next chunk:
#Here we parse the xml of download3.rstudio.org/
#Using the rootsize we can extract the last entry which is the latest version of shiny server
if(!require(XML)){
  install.packages("XML")
  library(XML)
}
xml.url <- 'http://download3.rstudio.org/'
xmlParsed <- xmlParse(xml.url)
rootnode <- xmlRoot(xmlParsed)
rootsize <- xmlSize(rootnode)
latest_shiny_path <- xmlValue(rootnode[[rootsize]][[1]])
shiny_version <- unlist(strsplit(latest_shiny_path,'/'))[3]

# install latest Shiny server version
command <- c("\necho 'R installed'")
command <- append(command,"sudo apt-get install -y gdebi-core")
command <- append(command,paste0("wget https://download3.rstudio.org/",latest_shiny_path))
command <- append(command,paste0("sudo gdebi --non-interactive ",shiny_version))

@AndreaCirilloAC
Copy link
Owner Author

nice and smooth, we'd better handle xml dependence within the package description, avoiding to employ require : http://r-pkgs.had.co.nz/description.html#dependencies

what do you think @ScientistJake ?

@ScientistJake
Copy link
Contributor

@AndreaCirilloAC That looks like the way to do it! I added:

    Imports: 
        XML 

To the DESCRIPTION file and changed the html parsing to call XML:

    xml.url <- 'http://download3.rstudio.org/' 
    xmlParsed <- XML::xmlParse(xml.url) 
    rootnode <- XML::xmlRoot(xmlParsed) 
    rootsize <- XML::xmlSize(rootnode) 
    latest_shiny_path <- XML::xmlValue(rootnode[[rootsize]][[1]]) 
    shiny_version <- unlist(strsplit(latest_shiny_path,'/'))[3] 

I tested the install, and it loads XML. I also tested the XML function above. If you it looks good it's ready to push https://github.com/ScientistJake/ramazon

@AndreaCirilloAC
Copy link
Owner Author

closed with #10, thank you @ScientistJake !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants