Shell Script to Build OS X ‘Shiny Apps’ from Github Gists

December 2, 2014
By

(This article was first published on Data Driven Security, and kindly contributed to R-bloggers)

Since the previous post was fairly popular, I went ahead and built a small shell script (also below) to ease the process of building the OS X Shiny-gist application.

After copying the script to a place you can run it from in your PATH and executing a “chmod a+x shinyapp.sh” (or whatever you named it), all you have to do is enter the GitHub Gist ID and the desired app name. In the case of my example “snowfall” app, one could do something like:

$ shinyapp 95ec24c1b0cb433a76a5 "Shiny Snowfall"

which would then build the Shiny Snowfall.app executable.

You can find the GitHub Gist ID as the last part of the gist URL. For example, the “Shiny Snowfall” app is at URL https://gist.github.com/hrbrmstr/95ec24c1b0cb433a76a5, so the gist ID I’d use would be “95ec24c1b0cb433a76a5“.

The script also takes in two optional parameters. The first (-i) lets you specify an icns file which will be used in place of the generic AppleScript icon image. Apple provides a free utility in their Graphics Tools for Xcode bundle which makes creating icons as simple as drag and drop.

The second (-d) lets you specify your Apple Mac OS Developer ID (if you have one) that you want to use to sign the app. Signing the app makes it more easily runnable by users provided they have their security restrictions setup properly You can find out more about code-signing on Apple’s site.

To re-create the example “Shiny Snowfall” app just do:

$ shinyapp -i snowcloud.icns 
           -d 'Bob Rudis (CBY22P58G8)' 
           95ec24c1b0cb433a76a5 'Shiny Snowfall'

Hopefully this makes the process a bit easier for folks who want to deliver Shiny apps this way on Mac OS. A future post will show how to make a Mac OS X Shiny app from a local ui.R, server.R and any associated support/data files. Since the file is a gist, please submit all issues, enhancements and bugs as comments to this post.

shinyapp.sh Source Code:

To leave a comment for the author, please follow the link and comment on their blog: Data Driven Security.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Sponsors

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)