Fork me on GitHub

Sinatra: The Framework Within


Sinatra has been getting a lot of hype lately as the next great (micro)-framework. In writing apps, diving in, and contributing the reasons for its existence have become more clear. Sinatra is not just a toy or a neat trick, its the best way to create simple and non-obtrusive web interfaces to sit on top of a new or existing ruby project.

Sinatra is less then a framework – it’s a web library. This isn’t a slap in the face – it’s truly a compliment. Sinatra’s size and portability make it extremely easy to incorporate to existing Ruby apps. I’m talking BEYOND Rails. I’m talking about command line tools, complex C bindings, you name it. Sinatra can be required and a script can be fashioned to give a dusty ol’ code-base new life in a browser.

I decided not to just preach and tried to take my own advice. What came out of my first attempt is gembox. Gembox is a very light interface built on top of Ruby Gems. Download it, start it with:

$ gembox

That’s it. Ruby Gems is great starting point because it has a well defined API and a huge user-base (rubygems users === ruby users). What it doens’t have is a great web interface. Just booting up this little app gives you a pretty (albiet currently shallow) interface to your gems. This app is tiny. I chose to split it out over multiple files, but with your app could have put this all in a single file and included it in your library’s name-space. It’s that easy.

So here’s my pitch: Give your gems/libraries/code bundles beautiful web interfaces with minimal effort using Sinatra.

I think gembox was a successful little experiment and over the next weeks I’ll be updating my gems with simple interfaces.


Currently, I’m in the running for a spot to speak at GoGaRuCo. I like the idea of the attendee’s being able to vote for what presentations to have at the conference, but I think having a truncated synopsis listed might not give me the best chance. So I’d like to try to explain what I plan to talk about a little further. If you like what you hear please vote!

Photo Credit: http://flickr.com/photos/rnyk/2493099076/

3 Responses to “Sinatra: The Framework Within”

Aaron, this seems to me like an *awesome idea*.

This “Sinatra-based, embeddable frontend” stuff could be pushed even further, let’s imagine: you can make your own Git-based issue-tracking/ticketing system for a piece of software, storing data in separate branch. The same applies for eg. specification. If you would “embed” a web GUI for this stuff inside, you could manage it not only from command line, but in a GUI as well.

This is something I’ve been thinking about a lot lately, following the trail of Ticgit or Github pages ideas. This is another piece of the puzzle. Great idea.

–karmi

cs Says: #

sorry, it took me some time to figure out the install, i’ll copy here the steps:

1. install dependencies:
* rubygems >= 1.3.1
* haml >= 2.0.9
* sinatra >= 0.9.1
* activesupport >= 2.2.2
* mislav-will_paginate >=2.3.7
* hoe

2. sudo gem install quirkey-static_model
3. download gembox from http://github.com/quirkey/gembox/tree/master
4. untar && ./bin/gembox

http://localhost:5678/

I totally agree. Sinatra opens up a bunch of possibilities, just by making it easy and lightweight to expose your functionality via http.

Exciting stuff!

Leave a Reply