Sinatra 1.0 Released: Major Milestone for Ruby’s Best Webapp DSL
In November 2007, we casually mentioned a new Ruby webapp library called Sinatra. It took a year to capture the imagination of the Ruby community as a whole and we eventually covered it in more depth but today we're proud to (exclusively) announce that Sinatra has today reached its landmark 1.0 release!
Impromptu release party in the official #sinatra
channel on irc.freenode.net
, anyone? :-)
Sinatra is well known in the Ruby community for providing developers with a simple way to put together Web apps big and small. The canonical ultra-simple example:
require 'rubygems'
require 'sinatra'
get '/hi' do
"Hello World!"
end
Sinatra's lead developers — Ryan Tomayko, Simon Rozet, and Blake Mizerany — have done a great job, along with about 50 other contributors, to produce a slick and powerful Web application DSL for Rubyists. Their ideas have even inspired similar frameworks in other languages (such as Sammy in JavaScript). Satish Talim put together a great piece, 20+ Rubyists are using Sinatra - Do you?, last year that got a good feel for how Sinatra's being used for Web apps both big and small by a collection of Rubyists.
What's New?
As an avid user of Sinatra 0.9, I asked Blake Mizerany what the biggest changes were going to 1.0:
I think the biggest changes are what we cleaned up. Tilt is a great new under-the-hood addition. Sinatra has matured; we're done messing around. It's super solid. The extension API has matured to something really killer. Extensions are ridiculously simple to create now - you can easily install helper methods, DSL methods, and install new routes on apps, and the user need only
require 'sinatra/your-extension'
- that's it.
Unsurprisingly, the official changelog also provides useful information to existing Sinatra developers.
A more significant longer-term change for Sinatra over the past year has been in how it integrates with Rack. In Sinatra Rack And Middleware, Ben Schwarz looks at how Sinatra interacts with Rack and how you can use Rack's middleware and multi-application features with Sinatra. A key aspect of this is the ability to produce "modular" Sinatra applications by subclassing Sinatra::Base
to separate discrete applications or application portions:
require 'rubygems'
require 'sinatra/base'
class MyApp < Sinatra::Base
get '/' do
"Hello world!"
end
end
And then, in a Rackup file:
require 'my_app'
run MyApp
Installing and Trying Sinatra
If you're not yet using Sinatra and want to give it a quick try, you can install it with RubyGems:
gem install sinatra
Put the following basic example into a file, say example.rb:
require 'rubygems'
require 'sinatra'
get '/hi' do
"Hello World!"
end
Then run the Ruby file in the usual way, and a request to http://localhost:4567/hi
should get you a "Hello World!" response.
Learn More Online and on IRC
The examples shown above are as basic as Sinatra gets, but it goes a lot deeper than that (such as embedding Sinatra apps inside Rails apps) and the Sinatra Web site has some great code examples of where you can go next. There's also solid documentation available and if you want to take a look at lots of existing Sinatra projects to get a feel for the patterns and techniques involved, there's a great list of Sinatra apps and extensions too.
Lastly, if you're interested in asking questions about Sinatra or just hanging out with Sinatra's developers and users, head along to the #sinatra
channel on irc.freenode.net
. There's usually between 50-100 people hanging out there.
March 23, 2010 at 9:35 pm
Congrats to the entire team! Sinatra is truly a piece of work (I mean that in a good way).
March 23, 2010 at 9:44 pm
Sinatra is art. Thanks for the hard work!
March 23, 2010 at 9:59 pm
Thanks for the hard-work on Sinatra - it's currently my favorite web framework!
March 23, 2010 at 10:04 pm
Congratulations to the Sinatra developers! I absolutely love Sinatra. It's a joy to work with. If you haven't tried it, you really ought to.
March 23, 2010 at 10:38 pm
Sinatra is an amazing piece of software. Thank you for all your hard work.
March 23, 2010 at 11:23 pm
Congrats to Sinatra team on their major milestone. Its simple and very addictive.
March 24, 2010 at 12:33 am
I usually don't comment on blogs, but Sinatra truly rocks. Congrats to its developers.
March 24, 2010 at 1:02 am
Sinitra kicks major ass! Can't live w/out it.
March 24, 2010 at 9:23 am
For the "inspired in Sinatra" list, from the Perl world:
- http://perldancer.org/
- http://mojolicious.org/ (well, Mojolicius::Lite though)
I've used those two, and are great. We must thank Sinatra for the inspiration!
March 24, 2010 at 12:43 pm
Congratulations, Sinatra is a great framework!
March 24, 2010 at 12:51 pm
Sinatra is a rare blend of ridiculously useful and practical code poetry. Kudos for the team and contributors!
March 24, 2010 at 8:54 pm
Just a note to say the documentation still says version 1.0 not yet out!
March 24, 2010 at 8:56 pm
Oh and another so I don't seem churlish! Thanks a bunch for great work - I am awed by the simplicity
March 24, 2010 at 10:01 pm
Your post is linked at the drink rails link blog
March 24, 2010 at 10:58 pm
wow those perl frameworks "inspired by Sinatra" actually look good. Way to go Sinatra!
April 22, 2010 at 7:33 am
To celebrate this milestone, we at RubyLearning announced a free, online "Introduction to Sinatra" course from 15t May, sponsored by 1stEasy.com. The course filled-up in 6 hours. Hopefully we shall do a repeat batch soon, provided we get a sponsor.