att / rcloud.rcap

RCloud powered dashboards and websites
Other
8 stars 13 forks source link

Output current RCAP version #68

Closed shaneporter closed 8 years ago

shaneporter commented 8 years ago

Would be useful for RCAP to output its current version, much in the same way that the current RCloud version is visible.

image

(Emphasis mine.)

gaborcsardi commented 8 years ago

Maybe only if there is a dashboard JS asset? I am just thinking if the installation has > 5 extensions, then it'll be annoying....

But if the notebook has a dashboard, then it makes sense to be able to see it.

shaneporter commented 8 years ago

I meant on the RCAP Designer UI.

gaborcsardi commented 8 years ago

Oh, OK, sure, it makes sense.

shaneporter commented 8 years ago

Is it quite easy to add an OCAP that can return the version in the DESCRIPTION file?

paulinshek commented 8 years ago

Yes! The R code for this is:

getRCAPVersion <- function() {
  packageDescription("rcloud.rcap", fields = "Version")
}
gaborcsardi commented 8 years ago

@paulinshek While this is good most of the time, it is technically not correct, because it is not the version of the loaded package, but the version of the package on the disk. If you re-installed it, you'll get a bad result. This is how to do it for the loaded package: http://stackoverflow.com/a/37369263/604364

paulinshek commented 8 years ago

Oh! Indeed.

So better way is:

getRCAPVersion <- function() {
    asNamespace("rcap.rcloud")$`.__NAMESPACE__.`$spec[["version"]]
}
shaneporter commented 8 years ago

Can that be added to the develop branch please? Thanks!

gaborcsardi commented 8 years ago

I suppose you need an ocap for this.

Also, I would probably combine the two solutions, because the "correct" one is hackish, and might break later. So we would put it in a tryCatch and fall back to the other solution.

shaneporter commented 8 years ago

Yes please.

paulinshek commented 8 years ago

Yep, I can do this tomorrow :)