Sinatra 1.0 FAQ
Sinatra 1.0 Frequently Asked Questions
Sinatra is going 1.0. Here are some things you should know:
Is Sinatra 1.0 a rewrite / major conceptual overhaul?
No. Sinatra 1.0 is very much the same codebase as the current stable 0.9.x release. The largest changes are internal - we're dropping the backward compatibility module and test suite that's been maintained since the 0.3 release. The majority of obsoleted features are simple class/method name changes that have been documented for some time. Very few features have been removed in their entirety.
Some new features will be introduced.
Will my existing Sinatra app work with 1.0? How can I check?
If you've kept up with deprecations and use officially documented features, your app should be fine under Sinatra 1.0.
The latest Sinatra 0.9.x release includes comprehensive deprecation warnings for all incompatibilities introduced in Sinatra 1.0. Run your test suite and app under 0.9.x and watch for warnings on standard error. When no more deprecation warnings remain, upgrade your staging environment to Sinatra 1.0 and verify that stuff works.
Can I install and run under Sinatra 1.0 today?
Sinatra 1.0 has not been officially released yet, but prerelease gems are available from gemcutter:
gem install --pre sinatra
Alternatively, you can run off of the
git clone git://github.com/sinatra/sinatra.git RUBYLIB="$(pwd)/sinatra/lib:$RUBYLIB"
What incompatibilities are being introduced in Sinatra 1.0?
The following is a comprehensive list of features obsoleted in the 1.0 release. All of these have been deprecated for some time:
sinatra/testlibrary is obsolete. This includes the
Sinatra::TestHarnessclass, and the
head_ithelper methods. The
Rack::Testlibrary should be used instead.
Test framework specific libraries (
sinatra/test/rspec, etc.) are obsolete. See http://www.sinatrarb.com/testing.html for instructions on setting up a testing environment under each of these frameworks.
Sinatra::Defaultis obsolete; use
Sinatra::Baseacts more like
Sinatra::Defaultin development mode. For example, static file serving and sexy development error pages are enabled by default.
Auto-requiring template libraries in the
sassmethods is obsolete due to thread-safety issues. You must require the template libraries explicitly in your app.
:views_directoryoption to rendering methods is obsolete; use
:sassoptions to rendering methods are obsolete. Template engine options should be passed in the second Hash argument instead.
media_typehelper method is obsolete. Use
mimemain and class method is obsolete. Use
send_datamethod is no longer supported.
Sinatra::EventContextclasses are no longer supported. This may effect extensions written for versions prior to 0.9.2. See Writing Sinatra Extensions for the officially supported extensions API.
set_optionsmethods are obsolete; use
settings.env) is obsolete; use
The request level
stopmethod is obsolete; use
The request level
entity_tagmethod is obsolete; use
The request level
headersmethod (HTTP response headers) is obsolete; use
Sinatra.applicationis obsolete; use
Sinatra.application = nilto reset an application is obsolete. This should no longer be necessary.
Sinatra.default_optionsto set base configuration items is obsolete; use
Sinatra::ServerErrorexception is obsolete. All exceptions raised within a request are now treated as internal server errors and result in a 500 response status.
What about new features?
How will versions be handled in the 1.x series?
We've adopted the Semantic Versioning Model. All 1.x releases will be backward compatible with the initial 1.0 release.
This is one of the reasons we've waited so long to do an official 1.0 release. We're required not to break anything shipped in 1.0 for a very long time, so interfaces we don't like require considerable scrutiny.
Will the 0.9.x series continue to be maintained?
Yes. There will be additional Sinatra 0.9.x releases for security issues or major defects. No new features will be added to the 0.9.x series.
The 0.9.x series will be maintained for as long as people use it.
How can I pin my app to 0.9.x to avoid upgrading to 1.0?
You shouldn't have to do anything if you bundle/vendor sinatra with your
app. Just make sure you're pulling from the
0.9.x branch or vendoring an
If you use Rubygems, there's a very real possibility that Sinatra will be upgraded to 1.0 on your system. You can force your apps to use an 0.9.x version with:
gem 'sinatra', '< 1.0'