sinatra-base 1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +43 -0
- data/CHANGES +511 -0
- data/LICENSE +22 -0
- data/README.jp.rdoc +552 -0
- data/README.rdoc +636 -0
- data/Rakefile +116 -0
- data/lib/sinatra.rb +7 -0
- data/lib/sinatra/base.rb +1167 -0
- data/lib/sinatra/images/404.png +0 -0
- data/lib/sinatra/images/500.png +0 -0
- data/lib/sinatra/main.rb +28 -0
- data/lib/sinatra/showexceptions.rb +307 -0
- data/lib/sinatra/tilt.rb +746 -0
- data/sinatra-base.gemspec +94 -0
- data/test/base_test.rb +160 -0
- data/test/builder_test.rb +65 -0
- data/test/contest.rb +64 -0
- data/test/erb_test.rb +81 -0
- data/test/erubis_test.rb +82 -0
- data/test/extensions_test.rb +100 -0
- data/test/filter_test.rb +221 -0
- data/test/haml_test.rb +95 -0
- data/test/helper.rb +76 -0
- data/test/helpers_test.rb +582 -0
- data/test/less_test.rb +37 -0
- data/test/mapped_error_test.rb +197 -0
- data/test/middleware_test.rb +68 -0
- data/test/public/favicon.ico +0 -0
- data/test/request_test.rb +33 -0
- data/test/response_test.rb +42 -0
- data/test/result_test.rb +98 -0
- data/test/route_added_hook_test.rb +59 -0
- data/test/routing_test.rb +860 -0
- data/test/sass_test.rb +85 -0
- data/test/server_test.rb +47 -0
- data/test/settings_test.rb +368 -0
- data/test/sinatra_test.rb +13 -0
- data/test/static_test.rb +93 -0
- data/test/templates_test.rb +159 -0
- data/test/views/error.builder +3 -0
- data/test/views/error.erb +3 -0
- data/test/views/error.erubis +3 -0
- data/test/views/error.haml +3 -0
- data/test/views/error.sass +2 -0
- data/test/views/foo/hello.test +1 -0
- data/test/views/hello.builder +1 -0
- data/test/views/hello.erb +1 -0
- data/test/views/hello.erubis +1 -0
- data/test/views/hello.haml +1 -0
- data/test/views/hello.less +5 -0
- data/test/views/hello.sass +2 -0
- data/test/views/hello.test +1 -0
- data/test/views/layout2.builder +3 -0
- data/test/views/layout2.erb +2 -0
- data/test/views/layout2.erubis +2 -0
- data/test/views/layout2.haml +2 -0
- data/test/views/layout2.test +1 -0
- metadata +257 -0
data/AUTHORS
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
Sinatra was designed and developed by Blake Mizerany (bmizerany) in
|
2
|
+
California. Continued development would not be possible without the ongoing
|
3
|
+
financial support provided by [Heroku](http://heroku.com) and the emotional
|
4
|
+
support provided by Adam Wiggins (adamwiggins) of Heroku, Chris Wanstrath (defunkt),
|
5
|
+
PJ Hyett (pjhyett), and the rest of the GitHub crew.
|
6
|
+
|
7
|
+
Special thanks to the following extraordinary individuals, who-out which
|
8
|
+
Sinatra would not be possible:
|
9
|
+
|
10
|
+
* Ryan Tomayko (rtomayko) for constantly fixing whitespace errors 60d5006
|
11
|
+
* Ezra Zygmuntowicz (ezmobius) for initial help and letting Blake steal
|
12
|
+
some of merbs internal code.
|
13
|
+
* Ari Lerner (http://xnot.org/) for his evangelism, spirit, and gumption
|
14
|
+
that got Sinatra recognized from Day 1.
|
15
|
+
* Christopher Schneid (cschneid) for The Book, the blog (gittr.com),
|
16
|
+
irclogger.com, and a bunch of useful patches.
|
17
|
+
* Markus Prinz (cypher) for patches over the years, caring about
|
18
|
+
the README, and hanging in there when times were rough.
|
19
|
+
* Simon Rozet (sr) for a ton of doc patches, HAML options, and all that
|
20
|
+
advocacy stuff he's going to do for 1.0.
|
21
|
+
* Erik Kastner (kastner) for fixing `MIME_TYPES` under Rack 0.5.
|
22
|
+
* Ben Bleything (bleything) for caring about HTTP status codes and doc fixes.
|
23
|
+
* Igal Koshevoy (igal) for root path detection under Thin/Passenger.
|
24
|
+
* Jon Crosby (jcrosby) for coffee breaks, doc fixes, and just because, man.
|
25
|
+
* Karel Minarik (karmi) for screaming until the website came back up.
|
26
|
+
* Jeremy Evans (jeremyevans) for unbreaking optional path params (twice!)
|
27
|
+
* The GitHub guys for stealing Blake's table.
|
28
|
+
* Nickolas Means (nmeans) for Sass template support.
|
29
|
+
* Victor Hugo Borja (vic) for splat'n routes specs and doco.
|
30
|
+
* Avdi Grimm (avdi) for basic RSpec support.
|
31
|
+
* Jack Danger Canty for a more accurate root directory and for making me
|
32
|
+
watch [this](http://www.youtube.com/watch?v=ueaHLHgskkw) just now.
|
33
|
+
* Mathew Walker for making escaped paths work with static files.
|
34
|
+
* Millions of Us for having the problem that led to Sinatra's conception.
|
35
|
+
* Songbird for the problems that helped Sinatra's future become realized.
|
36
|
+
* Rick Olson (technoweenie) for the killer plug at RailsConf '08.
|
37
|
+
* Steven Garcia for the amazing custom artwork you see on 404's and 500's
|
38
|
+
* Pat Nakajima (nakajima) for fixing non-nested params in nested params Hash's.
|
39
|
+
|
40
|
+
and last but not least:
|
41
|
+
|
42
|
+
* Frank Sinatra (chairman of the board) for having so much class he
|
43
|
+
deserves a web-framework named after him.
|
data/CHANGES
ADDED
@@ -0,0 +1,511 @@
|
|
1
|
+
= 1.0 / 2010-01-28 (prerelease)
|
2
|
+
|
3
|
+
* It's now possible to register blocks to run after each request using
|
4
|
+
after filters. After filters run at the end of each request, after
|
5
|
+
routes and error handlers. (Jimmy Schementi)
|
6
|
+
|
7
|
+
* Sinatra now uses Tilt <http://github.com/rtomayko/tilt> for rendering
|
8
|
+
templates. This adds support for template caching, consistent
|
9
|
+
template backtraces, and support for new template engines, like
|
10
|
+
mustache and liquid. (Ryan Tomayko)
|
11
|
+
|
12
|
+
* ERB, Erubis, and Haml templates are now compiled the first time
|
13
|
+
they're rendered instead of being string eval'd on each invocation.
|
14
|
+
Benchmarks show a 5x-10x improvement in render time. This also
|
15
|
+
reduces the number of objects created, decreasing pressure on Ruby's
|
16
|
+
GC. (Ryan Tomayko)
|
17
|
+
|
18
|
+
* New 'settings' method gives access to options in both class and request
|
19
|
+
scopes. This replaces the 'options' method. (Chris Wanstrath)
|
20
|
+
|
21
|
+
* New boolean 'reload_templates' setting controls whether template files
|
22
|
+
are reread from disk and recompiled on each request. Template read/compile
|
23
|
+
is cached by default in all environments except development. (Ryan Tomayko)
|
24
|
+
|
25
|
+
* New 'erubis' helper method for rendering ERB template with Erubis. The
|
26
|
+
erubis gem is required. (Dylan Egan)
|
27
|
+
|
28
|
+
* New 'cache_control' helper method provides a convenient way of
|
29
|
+
setting the Cache-Control response header. Takes a variable number
|
30
|
+
of boolean directives followed by a hash of value directives, like
|
31
|
+
this: cache_control :public, :must_revalidate, :max_age => 60
|
32
|
+
(Ryan Tomayko)
|
33
|
+
|
34
|
+
* New 'expires' helper method is like cache_control but takes an
|
35
|
+
integer number of seconds or Time object:
|
36
|
+
expires 300, :public, :must_revalidate
|
37
|
+
(Ryan Tomayko)
|
38
|
+
|
39
|
+
* New request.secure? method for checking for an SSL connection.
|
40
|
+
(Adam Wiggins)
|
41
|
+
|
42
|
+
* Sinatra apps can now be run with a `-o <addr>` argument to specify
|
43
|
+
the address to bind to. (Ryan Tomayko)
|
44
|
+
|
45
|
+
* Rack::Session::Cookie is now added to the middleware pipeline when
|
46
|
+
running in test environments if the :sessions option is set.
|
47
|
+
(Simon Rozet)
|
48
|
+
|
49
|
+
* Route handlers, before filters, templates, error mappings, and
|
50
|
+
middleware are now resolved dynamically up the inheritance hierarchy
|
51
|
+
when needed instead of duplicating the superclass's version when
|
52
|
+
a new Sinatra::Base subclass is created. This should fix a variety
|
53
|
+
of issues with extensions that need to add any of these things
|
54
|
+
to the base class. (Ryan Tomayko)
|
55
|
+
|
56
|
+
* Exception error handlers always override the raise_errors option now.
|
57
|
+
Previously, all exceptions would be raised outside of the application
|
58
|
+
when the raise_errors option was enabled, even if an error handler was
|
59
|
+
defined for that exception. The raise_errors option now controls
|
60
|
+
whether unhandled exceptions are raised (enabled) or if a generic 500
|
61
|
+
error is returned (disabled). (Ryan Tomayko)
|
62
|
+
|
63
|
+
* The X-Cascade response header is set to 'pass' when no matching route
|
64
|
+
is found or all routes pass. (Josh Peek)
|
65
|
+
|
66
|
+
* Filters do not run when serving static files anymore. (Ryan Tomayko)
|
67
|
+
|
68
|
+
* pass takes an optional block to be used as the route handler if no
|
69
|
+
subsequent route matches the request. (Blake Mizerany)
|
70
|
+
|
71
|
+
The following Sinatra features have been obsoleted (removed entirely) in
|
72
|
+
the 1.0 release:
|
73
|
+
|
74
|
+
* The `sinatra/test` library is obsolete. This includes the `Sinatra::Test`
|
75
|
+
module, the `Sinatra::TestHarness` class, and the `get_it`, `post_it`,
|
76
|
+
`put_it`, `delete_it`, and `head_it` helper methods. The
|
77
|
+
[`Rack::Test` library](http://gitrdoc.com/brynary/rack-test) should
|
78
|
+
be used instead.
|
79
|
+
|
80
|
+
* Test framework specific libraries (`sinatra/test/spec`,
|
81
|
+
`sinatra/test/bacon`,`sinatra/test/rspec`, etc.) are obsolete. See
|
82
|
+
http://www.sinatrarb.com/testing.html for instructions on setting up a
|
83
|
+
testing environment under each of these frameworks.
|
84
|
+
|
85
|
+
* `Sinatra::Default` is obsolete; use `Sinatra::Base` instead.
|
86
|
+
`Sinatra::Base` acts more like `Sinatra::Default` in development mode.
|
87
|
+
For example, static file serving and sexy development error pages are
|
88
|
+
enabled by default.
|
89
|
+
|
90
|
+
* Auto-requiring template libraries in the `erb`, `builder`, `haml`,
|
91
|
+
and `sass` methods is obsolete due to thread-safety issues. You must
|
92
|
+
require the template libraries explicitly in your app.
|
93
|
+
|
94
|
+
* The `:views_directory` option to rendering methods is obsolete; use
|
95
|
+
`:views` instead.
|
96
|
+
|
97
|
+
* The `:haml` and `:sass` options to rendering methods are obsolete.
|
98
|
+
Template engine options should be passed in the second Hash argument
|
99
|
+
instead.
|
100
|
+
|
101
|
+
* The `use_in_file_templates` method is obsolete. Use
|
102
|
+
`enable :inline_templates` or `set :inline_templates, 'path/to/file'`
|
103
|
+
|
104
|
+
* The 'media_type' helper method is obsolete. Use 'mime_type' instead.
|
105
|
+
|
106
|
+
* The 'mime' main and class method is obsolete. Use 'mime_type' instead.
|
107
|
+
|
108
|
+
* The request-level `send_data` method is no longer supported.
|
109
|
+
|
110
|
+
* The `Sinatra::Event` and `Sinatra::EventContext` classes are no longer
|
111
|
+
supported. This may effect extensions written for versions prior to 0.9.2.
|
112
|
+
See [Writing Sinatra Extensions](http://www.sinatrarb.com/extensions.html)
|
113
|
+
for the officially supported extensions API.
|
114
|
+
|
115
|
+
* The `set_option` and `set_options` methods are obsolete; use `set`
|
116
|
+
instead.
|
117
|
+
|
118
|
+
* The `:env` setting (`settings.env`) is obsolete; use `:environment`
|
119
|
+
instead.
|
120
|
+
|
121
|
+
* The request level `stop` method is obsolete; use `halt` instead.
|
122
|
+
|
123
|
+
* The request level `entity_tag` method is obsolete; use `etag`
|
124
|
+
instead.
|
125
|
+
|
126
|
+
* The request level `headers` method (HTTP response headers) is obsolete;
|
127
|
+
use `response['Header-Name']` instead.
|
128
|
+
|
129
|
+
* `Sinatra.application` is obsolete; use `Sinatra::Application` instead.
|
130
|
+
|
131
|
+
* Using `Sinatra.application = nil` to reset an application is obsolete.
|
132
|
+
This should no longer be necessary.
|
133
|
+
|
134
|
+
* Using `Sinatra.default_options` to set base configuration items is
|
135
|
+
obsolete; use `Sinatra::Base.set(key, value)` instead.
|
136
|
+
|
137
|
+
* The `Sinatra::ServerError` exception is obsolete. All exceptions raised
|
138
|
+
within a request are now treated as internal server errors and result in
|
139
|
+
a 500 response status.
|
140
|
+
|
141
|
+
* The `:methodoverride' option to enable/disable the POST _method hack is
|
142
|
+
obsolete; use `:method_override` instead.
|
143
|
+
|
144
|
+
= 0.9.2 / 2009-05-18
|
145
|
+
|
146
|
+
* This version is compatible with Rack 1.0. [Rein Henrichs]
|
147
|
+
|
148
|
+
* The development-mode unhandled exception / error page has been
|
149
|
+
greatly enhanced, functionally and aesthetically. The error
|
150
|
+
page is used when the :show_exceptions option is enabled and an
|
151
|
+
exception propagates outside of a route handler or before filter.
|
152
|
+
[Simon Rozet / Matte Noble / Ryan Tomayko]
|
153
|
+
|
154
|
+
* Backtraces that move through templates now include filenames and
|
155
|
+
line numbers where possible. [#51 / S. Brent Faulkner]
|
156
|
+
|
157
|
+
* All templates now have an app-level option for setting default
|
158
|
+
template options (:haml, :sass, :erb, :builder). The app-level
|
159
|
+
option value must be a Hash if set and is merged with the
|
160
|
+
template options specified to the render method (Base#haml,
|
161
|
+
Base#erb, Base#builder). [S. Brent Faulkner, Ryan Tomayko]
|
162
|
+
|
163
|
+
* The method signature for all template rendering methods has
|
164
|
+
been unified: "def engine(template, options={}, locals={})".
|
165
|
+
The options Hash now takes the generic :views, :layout, and
|
166
|
+
:locals options but also any template-specific options. The
|
167
|
+
generic options are removed before calling the template specific
|
168
|
+
render method. Locals may be specified using either the
|
169
|
+
:locals key in the options hash or a second Hash option to the
|
170
|
+
rendering method. [#191 / Ryan Tomayko]
|
171
|
+
|
172
|
+
* The receiver is now passed to "configure" blocks. This
|
173
|
+
allows for the following idiom in top-level apps:
|
174
|
+
configure { |app| set :foo, app.root + '/foo' }
|
175
|
+
[TJ Holowaychuck / Ryan Tomayko]
|
176
|
+
|
177
|
+
* The "sinatra/test" lib is deprecated and will be removed in
|
178
|
+
Sinatra 1.0. This includes the Sinatra::Test module and
|
179
|
+
Sinatra::TestHarness class in addition to all the framework
|
180
|
+
test helpers that were deprecated in 0.9.1. The Rack::Test
|
181
|
+
lib should be used instead: http://gitrdoc.com/brynary/rack-test
|
182
|
+
[#176 / Simon Rozet]
|
183
|
+
|
184
|
+
* Development mode source file reloading has been removed. The
|
185
|
+
"shotgun" (http://rtomayko.github.com/shotgun/) program can be
|
186
|
+
used to achieve the same basic functionality in most situations.
|
187
|
+
Passenger users should use the "tmp/always_restart.txt"
|
188
|
+
file (http://tinyurl.com/c67o4h). [#166 / Ryan Tomayko]
|
189
|
+
|
190
|
+
* Auto-requiring template libs in the erb, builder, haml, and
|
191
|
+
sass methods is deprecated due to thread-safety issues. You must
|
192
|
+
require the template libs explicitly in your app file. [Simon Rozet]
|
193
|
+
|
194
|
+
* A new Sinatra::Base#route_missing method was added. route_missing
|
195
|
+
is sent when no route matches the request or all route handlers
|
196
|
+
pass. The default implementation forwards the request to the
|
197
|
+
downstream app when running as middleware (i.e., "@app" is
|
198
|
+
non-nil), or raises a NotFound exception when no downstream app
|
199
|
+
is defined. Subclasses can override this method to perform custom
|
200
|
+
route miss logic. [Jon Crosby]
|
201
|
+
|
202
|
+
* A new Sinatra::Base#route_eval method was added. The method
|
203
|
+
yields to the block and throws :halt with the result. Subclasses
|
204
|
+
can override this method to tap into the route execution logic.
|
205
|
+
[TJ Holowaychuck]
|
206
|
+
|
207
|
+
* Fix the "-x" (enable request mutex / locking) command line
|
208
|
+
argument. Passing -x now properly sets the :lock option.
|
209
|
+
[S. Brent Faulkner, Ryan Tomayko]
|
210
|
+
|
211
|
+
* Fix writer ("foo=") and predicate ("foo?") methods in extension
|
212
|
+
modules not being added to the registering class.
|
213
|
+
[#172 / Pat Nakajima]
|
214
|
+
|
215
|
+
* Fix in-file templates when running alongside activesupport and
|
216
|
+
fatal errors when requiring activesupport before sinatra
|
217
|
+
[#178 / Brian Candler]
|
218
|
+
|
219
|
+
* Fix various issues running on Google AppEngine.
|
220
|
+
[Samuel Goebert, Simon Rozet]
|
221
|
+
|
222
|
+
* Fix in-file templates __END__ detection when __END__ exists with
|
223
|
+
other stuff on a line [Yoji Shidara]
|
224
|
+
|
225
|
+
= 0.9.1.1 / 2009-03-09
|
226
|
+
|
227
|
+
* Fix directory traversal vulnerability in default static files
|
228
|
+
route. See [#177] for more info.
|
229
|
+
|
230
|
+
= 0.9.1 / 2009-03-01
|
231
|
+
|
232
|
+
* Sinatra now runs under Ruby 1.9.1 [#61]
|
233
|
+
|
234
|
+
* Route patterns (splats, :named, or Regexp captures) are now
|
235
|
+
passed as arguments to the block. [#140]
|
236
|
+
|
237
|
+
* The "helpers" method now takes a variable number of modules
|
238
|
+
along with the normal block syntax. [#133]
|
239
|
+
|
240
|
+
* New request-level #forward method for middleware components: passes
|
241
|
+
the env to the downstream app and merges the response status, headers,
|
242
|
+
and body into the current context. [#126]
|
243
|
+
|
244
|
+
* Requests are now automatically forwarded to the downstream app when
|
245
|
+
running as middleware and no matching route is found or all routes
|
246
|
+
pass.
|
247
|
+
|
248
|
+
* New simple API for extensions/plugins to add DSL-level and
|
249
|
+
request-level methods. Use Sinatra.register(mixin) to extend
|
250
|
+
the DSL with all public methods defined in the mixin module;
|
251
|
+
use Sinatra.helpers(mixin) to make all public methods defined
|
252
|
+
in the mixin module available at the request level. [#138]
|
253
|
+
See http://www.sinatrarb.com/extensions.html for details.
|
254
|
+
|
255
|
+
* Named parameters in routes now capture the "." character. This makes
|
256
|
+
routes like "/:path/:filename" match against requests like
|
257
|
+
"/foo/bar.txt"; in this case, "params[:filename]" is "bar.txt".
|
258
|
+
Previously, the route would not match at all.
|
259
|
+
|
260
|
+
* Added request-level "redirect back" to redirect to the referring
|
261
|
+
URL.
|
262
|
+
|
263
|
+
* Added a new "clean_trace" option that causes backtraces dumped
|
264
|
+
to rack.errors and displayed on the development error page to
|
265
|
+
omit framework and core library backtrace lines. The option is
|
266
|
+
enabled by default. [#77]
|
267
|
+
|
268
|
+
* The ERB output buffer is now available to helpers via the @_out_buf
|
269
|
+
instance variable.
|
270
|
+
|
271
|
+
* It's now much easier to test sessions in unit tests by passing a
|
272
|
+
":session" option to any of the mock request methods. e.g.,
|
273
|
+
get '/', {}, :session => { 'foo' => 'bar' }
|
274
|
+
|
275
|
+
* The testing framework specific files ('sinatra/test/spec',
|
276
|
+
'sinatra/test/bacon', 'sinatra/test/rspec', etc.) have been deprecated.
|
277
|
+
See http://sinatrarb.com/testing.html for instructions on setting up
|
278
|
+
a testing environment with these frameworks.
|
279
|
+
|
280
|
+
* The request-level #send_data method from Sinatra 0.3.3 has been added
|
281
|
+
for compatibility but is deprecated.
|
282
|
+
|
283
|
+
* Fix :provides causing crash on any request when request has no
|
284
|
+
Accept header [#139]
|
285
|
+
|
286
|
+
* Fix that ERB templates were evaluated twice per "erb" call.
|
287
|
+
|
288
|
+
* Fix app-level middleware not being run when the Sinatra application is
|
289
|
+
run as middleware.
|
290
|
+
|
291
|
+
* Fixed some issues with running under Rack's CGI handler caused by
|
292
|
+
writing informational stuff to stdout.
|
293
|
+
|
294
|
+
* Fixed that reloading was sometimes enabled when starting from a
|
295
|
+
rackup file [#110]
|
296
|
+
|
297
|
+
* Fixed that "." in route patterns erroneously matched any character
|
298
|
+
instead of a literal ".". [#124]
|
299
|
+
|
300
|
+
= 0.9.0.4 / 2009-01-25
|
301
|
+
|
302
|
+
* Using halt with more than 1 args causes ArgumentError [#131]
|
303
|
+
* using halt in a before filter doesn't modify response [#127]
|
304
|
+
* Add deprecated Sinatra::EventContext to unbreak plugins [#130]
|
305
|
+
* Give access to GET/POST params in filters [#129]
|
306
|
+
* Preserve non-nested params in nested params hash [#117]
|
307
|
+
* Fix backtrace dump with Rack::Lint [#116]
|
308
|
+
|
309
|
+
= 0.9.0.3 / 2009-01-21
|
310
|
+
|
311
|
+
* Fall back on mongrel then webrick when thin not found. [#75]
|
312
|
+
* Use :environment instead of :env in test helpers to
|
313
|
+
fix deprecation warnings coming from framework.
|
314
|
+
* Make sinatra/test/rspec work again [#113]
|
315
|
+
* Fix app_file detection on windows [#118]
|
316
|
+
* Fix static files with Rack::Lint in pipeline [#121]
|
317
|
+
|
318
|
+
= 0.9.0.2 / 2009-01-18
|
319
|
+
|
320
|
+
* Halting a before block should stop processing of routes [#85]
|
321
|
+
* Fix redirect/halt in before filters [#85]
|
322
|
+
|
323
|
+
= 0.9.0 / 2009-01-18
|
324
|
+
|
325
|
+
* Works with and requires Rack >= 0.9.1
|
326
|
+
|
327
|
+
* Multiple Sinatra applications can now co-exist peacefully within a
|
328
|
+
single process. The new "Sinatra::Base" class can be subclassed to
|
329
|
+
establish a blank-slate Rack application or middleware component.
|
330
|
+
Documentation on using these features is forth-coming; the following
|
331
|
+
provides the basic gist: http://gist.github.com/38605
|
332
|
+
|
333
|
+
* Parameters with subscripts are now parsed into a nested/recursive
|
334
|
+
Hash structure. e.g., "post[title]=Hello&post[body]=World" yields
|
335
|
+
params: {'post' => {'title' => 'Hello', 'body' => 'World'}}.
|
336
|
+
|
337
|
+
* Regular expressions may now be used in route pattens; captures are
|
338
|
+
available at "params[:captures]".
|
339
|
+
|
340
|
+
* New ":provides" route condition takes an array of mime types and
|
341
|
+
matches only when an Accept request header is present with a
|
342
|
+
corresponding type. [cypher]
|
343
|
+
|
344
|
+
* New request-level "pass" method; immediately exits the current block
|
345
|
+
and passes control to the next matching route.
|
346
|
+
|
347
|
+
* The request-level "body" method now takes a block; evaluation is
|
348
|
+
deferred until an attempt is made to read the body. The block must
|
349
|
+
return a String or Array.
|
350
|
+
|
351
|
+
* New "route conditions" system for attaching rules for when a route
|
352
|
+
matches. The :agent and :host route options now use this system.
|
353
|
+
|
354
|
+
* New "dump_errors" option controls whether the backtrace is dumped to
|
355
|
+
rack.errors when an exception is raised from a route. The option is
|
356
|
+
enabled by default for top-level apps.
|
357
|
+
|
358
|
+
* Better default "app_file", "root", "public", and "views" location
|
359
|
+
detection; changes to "root" and "app_file" automatically cascade to
|
360
|
+
other options that depend on them.
|
361
|
+
|
362
|
+
* Error mappings are now split into two distinct layers: exception
|
363
|
+
mappings and custom error pages. Exception mappings are registered
|
364
|
+
with "error(Exception)" and are run only when the app raises an
|
365
|
+
exception. Custom error pages are registered with "error(status_code)",
|
366
|
+
where "status_code" is an integer, and are run any time the response
|
367
|
+
has the status code specified. It's also possible to register an error
|
368
|
+
page for a range of status codes: "error(500..599)".
|
369
|
+
|
370
|
+
* In-file templates are now automatically imported from the file that
|
371
|
+
requires 'sinatra'. The use_in_file_templates! method is still available
|
372
|
+
for loading templates from other files.
|
373
|
+
|
374
|
+
* Sinatra's testing support is no longer dependent on Test::Unit. Requiring
|
375
|
+
'sinatra/test' adds the Sinatra::Test module and Sinatra::TestHarness
|
376
|
+
class, which can be used with any test framework. The 'sinatra/test/unit',
|
377
|
+
'sinatra/test/spec', 'sinatra/test/rspec', or 'sinatra/test/bacon' files
|
378
|
+
can be required to setup a framework-specific testing environment. See the
|
379
|
+
README for more information.
|
380
|
+
|
381
|
+
* Added support for Bacon (test framework). The 'sinatra/test/bacon' file
|
382
|
+
can be required to setup Sinatra test helpers on Bacon::Context.
|
383
|
+
|
384
|
+
* Deprecated "set_option" and "set_options"; use "set" instead.
|
385
|
+
|
386
|
+
* Deprecated the "env" option ("options.env"); use "environment" instead.
|
387
|
+
|
388
|
+
* Deprecated the request level "stop" method; use "halt" instead.
|
389
|
+
|
390
|
+
* Deprecated the request level "entity_tag" method; use "etag" instead.
|
391
|
+
Both "entity_tag" and "etag" were previously supported.
|
392
|
+
|
393
|
+
* Deprecated the request level "headers" method (HTTP response headers);
|
394
|
+
use "response['Header-Name']" instead.
|
395
|
+
|
396
|
+
* Deprecated "Sinatra.application"; use "Sinatra::Application" instead.
|
397
|
+
|
398
|
+
* Deprecated setting Sinatra.application = nil to reset an application.
|
399
|
+
This should no longer be necessary.
|
400
|
+
|
401
|
+
* Deprecated "Sinatra.default_options"; use
|
402
|
+
"Sinatra::Default.set(key, value)" instead.
|
403
|
+
|
404
|
+
* Deprecated the "ServerError" exception. All Exceptions are now
|
405
|
+
treated as internal server errors and result in a 500 response
|
406
|
+
status.
|
407
|
+
|
408
|
+
* Deprecated the "get_it", "post_it", "put_it", "delete_it", and "head_it"
|
409
|
+
test helper methods. Use "get", "post", "put", "delete", and "head",
|
410
|
+
respectively, instead.
|
411
|
+
|
412
|
+
* Removed Event and EventContext classes. Applications are defined in a
|
413
|
+
subclass of Sinatra::Base; each request is processed within an
|
414
|
+
instance.
|
415
|
+
|
416
|
+
= 0.3.3 / 2009-01-06
|
417
|
+
|
418
|
+
* Pin to Rack 0.4.0 (this is the last release on Rack 0.4)
|
419
|
+
|
420
|
+
* Log unhandled exception backtraces to rack.errors.
|
421
|
+
|
422
|
+
* Use RACK_ENV environment variable to establish Sinatra
|
423
|
+
environment when given. Thin sets this when started with
|
424
|
+
the -e argument.
|
425
|
+
|
426
|
+
* BUG: raising Sinatra::NotFound resulted in a 500 response
|
427
|
+
code instead of 404.
|
428
|
+
|
429
|
+
* BUG: use_in_file_templates! fails with CR/LF (#45)
|
430
|
+
|
431
|
+
* BUG: Sinatra detects the app file and root path when run under
|
432
|
+
thin/passenger.
|
433
|
+
|
434
|
+
= 0.3.2
|
435
|
+
|
436
|
+
* BUG: Static and send_file read entire file into String before
|
437
|
+
sending. Updated to stream with 8K chunks instead.
|
438
|
+
|
439
|
+
* Rake tasks and assets for building basic documentation website.
|
440
|
+
See http://sinatra.rubyforge.org
|
441
|
+
|
442
|
+
* Various minor doc fixes.
|
443
|
+
|
444
|
+
= 0.3.1
|
445
|
+
|
446
|
+
* Unbreak optional path parameters [jeremyevans]
|
447
|
+
|
448
|
+
= 0.3.0
|
449
|
+
|
450
|
+
* Add sinatra.gemspec w/ support for github gem builds. Forks can now
|
451
|
+
enable the build gem option in github to get free username-sinatra.gem
|
452
|
+
builds: gem install username-sinatra.gem --source=http://gems.github.com/
|
453
|
+
|
454
|
+
* Require rack-0.4 gem; removes frozen rack dir.
|
455
|
+
|
456
|
+
* Basic RSpec support; require 'sinatra/test/rspec' instead of
|
457
|
+
'sinatra/test/spec' to use. [avdi]
|
458
|
+
|
459
|
+
* before filters can modify request environment vars used for
|
460
|
+
routing (e.g., PATH_INFO, REQUEST_METHOD, etc.) for URL rewriting
|
461
|
+
type functionality.
|
462
|
+
|
463
|
+
* In-file templates now uses @@ instead of ## as template separator.
|
464
|
+
|
465
|
+
* Top-level environment test predicates: development?, test?, production?
|
466
|
+
|
467
|
+
* Top-level "set", "enable", and "disable" methods for tweaking
|
468
|
+
app options. [rtomayko]
|
469
|
+
|
470
|
+
* Top-level "use" method for building Rack middleware pipelines
|
471
|
+
leading to app. See README for usage. [rtomayko]
|
472
|
+
|
473
|
+
* New "reload" option - set false to disable reloading in development.
|
474
|
+
|
475
|
+
* New "host" option - host/ip to bind to [cschneid]
|
476
|
+
|
477
|
+
* New "app_file" option - override the file to reload in development
|
478
|
+
mode [cschneid]
|
479
|
+
|
480
|
+
* Development error/not_found page cleanup [sr, adamwiggins]
|
481
|
+
|
482
|
+
* Remove a bunch of core extensions (String#to_param, String#from_param,
|
483
|
+
Hash#from_params, Hash#to_params, Hash#symbolize_keys, Hash#pass)
|
484
|
+
|
485
|
+
* Various grammar and formatting fixes to README; additions on
|
486
|
+
community and contributing [cypher]
|
487
|
+
|
488
|
+
* Build RDoc using Hanna template: http://sinatrarb.rubyforge.org/api
|
489
|
+
|
490
|
+
* Specs, documentation and fixes for splat'n routes [vic]
|
491
|
+
|
492
|
+
* Fix whitespace errors across all source files. [rtomayko]
|
493
|
+
|
494
|
+
* Fix streaming issues with Mongrel (body not closed). [bmizerany]
|
495
|
+
|
496
|
+
* Fix various issues with environment not being set properly (configure
|
497
|
+
blocks not running, error pages not registering, etc.) [cypher]
|
498
|
+
|
499
|
+
* Fix to allow locals to be passed to ERB templates [cschneid]
|
500
|
+
|
501
|
+
* Fix locking issues causing random errors during reload in development.
|
502
|
+
|
503
|
+
* Fix for escaped paths not resolving static files [Matthew Walker]
|
504
|
+
|
505
|
+
= 0.2.1
|
506
|
+
|
507
|
+
* File upload fix and minor tweaks.
|
508
|
+
|
509
|
+
= 0.2.0
|
510
|
+
|
511
|
+
* Initial gem release of 0.2 codebase.
|