[ANN] Sinatra 1.0.a pre-release

4 views
Skip to first unread message

Ryan Tomayko

unread,
Jan 29, 2010, 6:19:25 PM1/29/10
to sina...@googlegroups.com
Sinatra 1.0 is very close. We still need to tidy up some documentation
and cut one more 0.9.x release to introduce some deprecation warnings.
In the meantime, we're making a 1.0 pre-release available so that
people can start testing their apps under the 1.0 codebase. If you
vendor or have a local git clone, fetch the latest and use the 1.0.a
tag. Or, install the pre-release gem with:

gem install --pre sinatra

Sinatra 1.0 is NOT backward compatible with any prior release. This is
the first time we've broken backward compatibility since Sinatra was
introduced. Please see the Sinatra 1.0 FAQ for more information on the
goals and implications of the 1.0 release:

http://www.sinatrarb.com/one-oh-faq

A list of all commits with a diff of changes made between the the
current 0.9.4 release and the 1.0.a release can be found here:

http://github.com/sinatra/sinatra/compare/0.9.4...1.0.a

Please test your apps with the 1.0 code and report any issues right
here on this thread or to the issue tracker. If everything goes well,
we should be able to cut the official 1.0 release within the next week
or two.

From the CHANGES file <http://www.sinatrarb.com/changes>:

= 1.0 / 2010-01-28 (prerelease)

* It's now possible to register blocks to run after each request using
after filters. After filters run at the end of each request, after
routes and error handlers. (Jimmy Schementi)

* Sinatra now uses Tilt <http://github.com/rtomayko/tilt> for
rendering templates. This adds support for template caching,
consistent template backtraces, and support for new template engines,
like mustache and liquid. (Ryan Tomayko)

* New 'settings' method gives access to options in both class and
request scopes. This replaces the 'options' method. (Chris Wanstrath)

* New boolean 'reload_templates' setting controls whether template
files are reread from disk and recompiled on each request. Template
read/compile is cached by default in all environments except
development. (Ryan Tomayko)

* New 'erubis' helper method for rendering ERB template with Erubis.
The erubis gem is required. (Dylan Egan)

* New 'cache_control' helper method provides a convenient way of
setting the Cache-Control response header. Takes a variable number of
boolean directives followed by a hash of value directives (Ryan
Tomayko), like this:

cache_control :public, :must_revalidate, :max_age => 60

* New 'expires' helper method is like cache_control but takes an
integer number of seconds or Time object (Ryan Tomayko), like this:

expires 300, :public, :must_revalidate

* New 'request.secure?' method for checking for an SSL connection.
(Adam Wiggins)

* Sinatra apps can now be run with a '-h ADDR' argument to specify the
address to bind to. (Ryan Tomayko)

* Rack::Session::Cookie is now added to the middleware pipeline when
running in test environments if the :sessions option is set. (Simon
Rozet)

* Route handlers, before filters, templates, error mappings, and
middleware are now resolved dynamically up the inheritance hierarchy
when needed instead of duplicating the superclass's version when a new
Sinatra::Base subclass is created. This should fix a variety of issues
with extensions that need to add any of these things to the base
class. (Ryan Tomayko)

* The X-Cascade response header is set to 'pass' when no matching
route is found or all routes pass. (Josh Peek)

The following Sinatra features have been obsoleted (removed entirely)
in the 1.0 release:

* The 'sinatra/test' library is obsolete. This includes the
Sinatra::Test module, the Sinatra::TestHarness class, and the get_it,
post_it, put_it, delete_it, and head_it helper methods. The Rack::Test
library should be used instead.

* Test framework specific libraries ('sinatra/test/spec',
'sinatra/test/bacon','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::Default is obsolete; use Sinatra::Base instead.
Sinatra::Base acts more like Sinatra::Default in development mode.
For example, static file serving and sexy development error pages are
enabled by default.

* Auto-requiring template libraries in the 'erb', 'builder', 'haml',
and 'sass' methods is obsolete due to thread-safety issues. You must
require the template libraries explicitly in your app.

* The ':views_directory' option to rendering methods is obsolete; use
':views' instead.

* The ':haml' and ':sass' options to rendering methods are obsolete.
Template engine options should be passed in the second Hash argument
instead.

* The use_in_file_templates method is obsolete. Use 'enable
:inline_templates' or 'set :inline_templates, 'path/to/file''

* The 'media_type' helper method is obsolete. Use 'mime_type' instead.

* The 'mime' main and class method is obsolete. Use 'mime_type' instead.

* The request-level 'send_data' method is no longer supported.

* The Sinatra::Event and Sinatra::EventContext classes are no longer
supported. This may effect extensions written for versions prior to
0.9.2. See [Writing Sinatra
Extensions](http://www.sinatrarb.com/extensions.html) for the
officially supported extensions API.

* The 'set_option' and 'set_options' methods are obsolete; use 'set' instead.

* The ':env' setting ('settings.env') is obsolete; use ':environment' instead.

* The request level 'stop' method is obsolete; use 'halt' instead.

* The request level 'entity_tag' method is obsolete; use 'etag' instead.

* The request level 'headers' method (HTTP response headers) is
obsolete; use response['Header-Name'] instead.

* Sinatra.application is obsolete; use Sinatra::Application instead.

* Using 'Sinatra.application = nil' to reset an application is
obsolete. This should no longer be necessary.

* Using 'Sinatra.default_options' to set base configuration items is
obsolete; use 'Sinatra::Base.set(key, value)' instead.

* The Sinatra::ServerError exception is obsolete. All exceptions
raised within a request are now treated as internal server errors and
result in a 500 response status.

---

Thanks,
Ryan

http://tomayko.com/about

Blake Mizerany

unread,
Jan 29, 2010, 6:50:38 PM1/29/10
to sina...@googlegroups.com
Also:

Using `pass` with a block will execute the block as the route handler if no
subsequent route matches.

http://github.com/sinatra/sinatra/blob/master/test/routing_test.rb#L491-504

> --
> You received this message because you are subscribed to the Google Groups "sinatrarb" group.
> To post to this group, send email to sina...@googlegroups.com.
> To unsubscribe from this group, send email to sinatrarb+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/sinatrarb?hl=en.
>
>

--
Blake Mizerany
blake.m...@gmail.com

Blake Mizerany

unread,
Jan 29, 2010, 6:52:13 PM1/29/10
to sina...@googlegroups.com
This is so exciting. I'm looking forward to 1.0.

You guys are rocking it!

-blake

--
Blake Mizerany
blake.m...@gmail.com

Paul Walker

unread,
Jan 29, 2010, 6:55:34 PM1/29/10
to sina...@googlegroups.com
Awesome work guys!

Question re: * New 'erubis' helper method for rendering ERB template with Erubis

Erubis can be configured in Tilt as well correct?

~paul

Ryan Tomayko

unread,
Jan 29, 2010, 7:17:27 PM1/29/10
to sina...@googlegroups.com
On Fri, Jan 29, 2010 at 3:55 PM, Paul Walker <pjwa...@gmail.com> wrote:
> Awesome work guys!
>
> Question re: * New 'erubis' helper method for rendering ERB template with Erubis
>
> Erubis can be configured in Tilt as well correct?

The erubis helper is a very light wrapper on top of Tilt's erubis
support. It's worth calling it out here as an example of just how easy
it is to add new template helpers once they're supported in Tilt:

def erubis(template, options={}, locals={})
render :erubis, template, options, locals
end

http://github.com/sinatra/sinatra/blob/1.0.a/lib/sinatra/base.rb#L295-297

Eventually, these template helpers will probably be generated
dynamically, so template helper methods will appear for all template
engines supported by Tilt.

Ryan

Chris Wanstrath

unread,
Jan 29, 2010, 7:45:04 PM1/29/10
to sina...@googlegroups.com
Booyah.

On Fri, Jan 29, 2010 at 3:19 PM, Ryan Tomayko <r...@tomayko.com> wrote:

> --
> You received this message because you are subscribed to the Google Groups "sinatrarb" group.
> To post to this group, send email to sina...@googlegroups.com.
> To unsubscribe from this group, send email to sinatrarb+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/sinatrarb?hl=en.
>
>

--
Chris Wanstrath
http://github.com/defunkt

Paul Walker

unread,
Jan 29, 2010, 7:52:36 PM1/29/10
to sina...@googlegroups.com
Gotcha, so the helpers are a layer on top of tilt, but I wonder if there is value to unifying to one helper for client code as well allowing developers to easily switch the underlying template engine? (not that this wouldn't isn't easy enough already) and save helpers for any value adds the specific engines may have (like passing self reference).

render template, options, locals #uses erubis because of initializaion: Tilt.register 'html', Tilt::ErubisTemplate

Mislav

unread,
Jan 31, 2010, 3:25:08 PM1/31/10
to sinatrarb
… GitHub compare feature …!
**faints**

Nicolás Sanguinetti

unread,
Jan 31, 2010, 3:34:27 PM1/31/10
to sina...@googlegroups.com
Yay, this is awesome :D

On Sun, Jan 31, 2010 at 6:25 PM, Mislav <mislav....@gmail.com> wrote:
> … GitHub compare feature …!
> **faints**
>

Travis Bell

unread,
Jan 31, 2010, 3:43:50 PM1/31/10
to sina...@googlegroups.com
Totally wicked.

I've been keeping up with the releases on GitHub and had previously been running a version from Jan. 2 (or so). I grabbed the 1.0 alpha and while everything runs fine with Thin, Unicorn keeps segfault-ing (the version from early January runs fine).

I'll have to do some more digging as to why this is happening but I was just wondering if anyone has seen this or probably knows why this might be happening. If not, no worries, I'll spend some time in a bit here tracking it down.

Thanks guys, awesome work as always!


Cheers,

--
Travis Bell






Ryan Tomayko

unread,
Feb 1, 2010, 2:56:47 AM2/1/10
to sina...@googlegroups.com
On Sun, Jan 31, 2010 at 12:43 PM, Travis Bell <travi...@gmail.com> wrote:
> Totally wicked.
> I've been keeping up with the releases on GitHub and had previously been
> running a version from Jan. 2 (or so). I grabbed the 1.0 alpha and while
> everything runs fine with Thin, Unicorn keeps segfault-ing (the version from
> early January runs fine).

segfault ouch.

> I'll have to do some more digging as to why this is happening but I was just
> wondering if anyone has seen this or probably knows why this might be
> happening. If not, no worries, I'll spend some time in a bit here tracking
> it down.

I have not tested with Unicorn yet but definitely plan on giving it a shot.

Thanks,
Ryan

Reply all
Reply to author
Forward
0 new messages