Sinatra v0.9.1 Release Notes

Release Date: 2009-03-01 // about 15 years ago
    • Sinatra now runs under Ruby 1.9.1 [#61]

    • Route patterns (splats, :named, or Regexp captures) are now passed as arguments to the block. [#140]

    • The "helpers" method now takes a variable number of modules along with the normal block syntax. [#133]

    • New request-level #forward method for middleware components: passes the env to the downstream app and merges the response status, headers, and body into the current context. [#126]

    • Requests are now automatically forwarded to the downstream app when running as middleware and no matching route is found or all routes pass.

    • New simple API for extensions/plugins to add DSL-level and request-level methods. Use Sinatra.register(mixin) to extend the DSL with all public methods defined in the mixin module; use Sinatra.helpers(mixin) to make all public methods defined in the mixin module available at the request level. [#138] See http://www.sinatrarb.com/extensions.html for details.

    • Named parameters in routes now capture the "." character. This makes routes like "/:path/:filename" match against requests like "/foo/bar.txt"; in this case, "params[:filename]" is "bar.txt". Previously, the route would not match at all.

    • Added request-level "redirect back" to redirect to the referring URL.

    • Added a new "clean_trace" option that causes backtraces dumped to rack.errors and displayed on the development error page to omit framework and core library backtrace lines. The option is enabled by default. [#77]

    • The ERB output buffer is now available to helpers via the @_out_buf instance variable.

    • It's now much easier to test sessions in unit tests by passing a ":session" option to any of the mock request methods. e.g., get '/', {}, :session => { 'foo' => 'bar' }

    • The testing framework specific files ('sinatra/test/spec', 'sinatra/test/bacon', 'sinatra/test/rspec', etc.) have been deprecated. See http://sinatrarb.com/testing.html for instructions on setting up a testing environment with these frameworks.

    • The request-level #send_data method from Sinatra 0.3.3 has been added for compatibility but is deprecated.

    • Fix :provides causing crash on any request when request has no Accept header [#139]

    • Fix that ERB templates were evaluated twice per "erb" call.

    • Fix app-level middleware not being run when the Sinatra application is run as middleware.

    • Fixed some issues with running under Rack's CGI handler caused by writing informational stuff to stdout.

    • Fixed that reloading was sometimes enabled when starting from a rackup file [#110]

    • Fixed that "." in route patterns erroneously matched any character instead of a literal ".". [#124]