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

[This article was first published on Data Driven Security, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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 about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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)