sinatra-base 1.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardopts +4 -0
- data/AUTHORS +15 -0
- data/CHANGES +524 -1
- data/Gemfile +82 -0
- data/LICENSE +1 -1
- data/README.de.rdoc +2093 -0
- data/README.es.rdoc +2091 -0
- data/README.fr.rdoc +2116 -0
- data/README.hu.rdoc +607 -0
- data/README.jp.rdoc +514 -23
- data/README.pt-br.rdoc +647 -0
- data/README.pt-pt.rdoc +646 -0
- data/README.rdoc +1580 -205
- data/README.ru.rdoc +2015 -0
- data/README.zh.rdoc +1816 -0
- data/Rakefile +110 -44
- data/examples/chat.rb +61 -0
- data/examples/simple.rb +3 -0
- data/examples/stream.ru +26 -0
- data/lib/sinatra.rb +0 -3
- data/lib/sinatra/base.rb +923 -393
- data/lib/sinatra/main.rb +9 -7
- data/lib/sinatra/showexceptions.rb +37 -4
- data/lib/sinatra/version.rb +3 -0
- data/sinatra-base.gemspec +15 -91
- data/test/base_test.rb +2 -2
- data/test/builder_test.rb +32 -2
- data/test/coffee_test.rb +92 -0
- data/test/contest.rb +62 -28
- data/test/creole_test.rb +65 -0
- data/test/delegator_test.rb +162 -0
- data/test/encoding_test.rb +20 -0
- data/test/erb_test.rb +25 -2
- data/test/extensions_test.rb +1 -1
- data/test/filter_test.rb +226 -8
- data/test/haml_test.rb +8 -2
- data/test/helper.rb +47 -0
- data/test/helpers_test.rb +1287 -80
- data/test/integration/app.rb +62 -0
- data/test/integration_helper.rb +208 -0
- data/test/integration_test.rb +82 -0
- data/test/less_test.rb +36 -6
- data/test/liquid_test.rb +59 -0
- data/test/mapped_error_test.rb +84 -7
- data/test/markaby_test.rb +80 -0
- data/test/markdown_test.rb +81 -0
- data/test/middleware_test.rb +1 -1
- data/test/nokogiri_test.rb +69 -0
- data/test/rack_test.rb +45 -0
- data/test/radius_test.rb +59 -0
- data/test/rdoc_test.rb +66 -0
- data/test/readme_test.rb +136 -0
- data/test/request_test.rb +13 -1
- data/test/response_test.rb +21 -2
- data/test/result_test.rb +5 -5
- data/test/route_added_hook_test.rb +1 -1
- data/test/routing_test.rb +328 -13
- data/test/sass_test.rb +48 -18
- data/test/scss_test.rb +88 -0
- data/test/server_test.rb +4 -3
- data/test/settings_test.rb +191 -21
- data/test/sinatra_test.rb +5 -1
- data/test/slim_test.rb +88 -0
- data/test/static_test.rb +89 -5
- data/test/streaming_test.rb +140 -0
- data/test/templates_test.rb +143 -4
- data/test/textile_test.rb +65 -0
- data/test/views/a/in_a.str +1 -0
- data/test/views/ascii.erb +2 -0
- data/test/views/b/in_b.str +1 -0
- data/test/views/calc.html.erb +1 -0
- data/test/views/explicitly_nested.str +1 -0
- data/test/views/hello.coffee +1 -0
- data/test/views/hello.creole +1 -0
- data/test/views/hello.liquid +1 -0
- data/test/views/hello.mab +1 -0
- data/test/views/hello.md +1 -0
- data/test/views/hello.nokogiri +1 -0
- data/test/views/hello.radius +1 -0
- data/test/views/hello.rdoc +1 -0
- data/test/views/hello.sass +1 -1
- data/test/views/hello.scss +3 -0
- data/test/views/hello.slim +1 -0
- data/test/views/hello.str +1 -0
- data/test/views/hello.textile +1 -0
- data/test/views/hello.yajl +1 -0
- data/test/views/layout2.liquid +2 -0
- data/test/views/layout2.mab +2 -0
- data/test/views/layout2.nokogiri +3 -0
- data/test/views/layout2.radius +2 -0
- data/test/views/layout2.slim +3 -0
- data/test/views/layout2.str +2 -0
- data/test/views/nested.str +1 -0
- data/test/views/utf8.erb +2 -0
- data/test/yajl_test.rb +80 -0
- metadata +126 -91
- data/lib/sinatra/tilt.rb +0 -746
- data/test/erubis_test.rb +0 -82
- data/test/views/error.erubis +0 -3
- data/test/views/hello.erubis +0 -1
- data/test/views/layout2.erubis +0 -2
data/.yardopts
ADDED
data/AUTHORS
CHANGED
@@ -36,8 +36,23 @@ Sinatra would not be possible:
|
|
36
36
|
* Rick Olson (technoweenie) for the killer plug at RailsConf '08.
|
37
37
|
* Steven Garcia for the amazing custom artwork you see on 404's and 500's
|
38
38
|
* Pat Nakajima (nakajima) for fixing non-nested params in nested params Hash's.
|
39
|
+
* Konstantin Haase for his hard work and ongoing commitment to improving
|
40
|
+
Sinatra, for 1.1.0, 1.2.0 and beyond..
|
41
|
+
* Zachary Scott for adding Konstantin to the AUTHORS file. He also did help
|
42
|
+
writing the book, but mainly for adding Konstantin.
|
43
|
+
* Gabriel Andretta for having people wonder whether our documentation is
|
44
|
+
actually in English or in Spanish.
|
45
|
+
* Vasily Polovnyov, Nickolay Schwarz, Luciano Sousa, Wu Jiang, Mickael Riga,
|
46
|
+
Bernhard Essl, Janos Hardi, Kouhei Yanagita and "burningTyger" for willingly
|
47
|
+
translating whatever ends up in the README.
|
48
|
+
* [Wordy](http://www.wordy.com/) for proofreading our README. 73e137d
|
49
|
+
* cactus for digging through code and specs, multiple times.
|
50
|
+
* Nicolás Sanguinetti (foca) for strong demand of karma and shaping
|
51
|
+
helpers/register.
|
39
52
|
|
40
53
|
and last but not least:
|
41
54
|
|
42
55
|
* Frank Sinatra (chairman of the board) for having so much class he
|
43
56
|
deserves a web-framework named after him.
|
57
|
+
|
58
|
+
For a complete list of all contributors to Sinatra itself, run `rake authors`.
|
data/CHANGES
CHANGED
@@ -1,4 +1,527 @@
|
|
1
|
-
= 1.0 /
|
1
|
+
= 1.4.0 / Not Yet Released
|
2
|
+
|
3
|
+
* Add support for Yajl templates. (Jamie Hodge)
|
4
|
+
|
5
|
+
* No longer include Sinatra::Delegator in Object, instead extend the main
|
6
|
+
object only. (Konstantin Haase)
|
7
|
+
|
8
|
+
* Add :status option support to send_file. (Konstantin Haase)
|
9
|
+
|
10
|
+
* The `provides` condition now respects an earlier set content type.
|
11
|
+
(Konstantin Haase)
|
12
|
+
|
13
|
+
* Exception#code is only used when :use_code is enabled and displays a warning.
|
14
|
+
Moreover, it will be ignored if the value is not between 400 and 599. You
|
15
|
+
should use Exception#http_status instead. (Konstantin Haase)
|
16
|
+
|
17
|
+
* Status, headers and body will be set correctly in an after filter when using
|
18
|
+
halt in a before filter or route. (Konstantin Haase)
|
19
|
+
|
20
|
+
= 1.3.3 / Not Yet Released
|
21
|
+
|
22
|
+
* When keeping a stream open, set up callback/errback correctly to deal with
|
23
|
+
clients closing the connection. (Konstantin Haase)
|
24
|
+
|
25
|
+
= 1.3.2 / 2011-12-30
|
26
|
+
|
27
|
+
* Don't automatically add `Rack::CommonLogger` if `Rack::Server` is adding it,
|
28
|
+
too. (Konstantin Haase)
|
29
|
+
|
30
|
+
* Setting `logging` to `nil` will avoid setting up `Rack::NullLogger`.
|
31
|
+
(Konstantin Haase)
|
32
|
+
|
33
|
+
* Route specific params are now available in the block passed to #stream.
|
34
|
+
(Konstantin Haase)
|
35
|
+
|
36
|
+
* Fix bug where rendering a second template in the same request, after the
|
37
|
+
first one raised an exception, skipped the default layout. (Nathan Baum)
|
38
|
+
|
39
|
+
* Fix bug where parameter escaping got enabled when disabling a different
|
40
|
+
protection. (Konstantin Haase)
|
41
|
+
|
42
|
+
* Fix regression: Filters without a pattern may now again manipulate the params
|
43
|
+
hash. (Konstantin Haase)
|
44
|
+
|
45
|
+
* Added examples directory. (Konstantin Haase)
|
46
|
+
|
47
|
+
* Improved documentation. (Gabriel Andretta, Markus Prinz, Erick Zetta, Just
|
48
|
+
Lest, Adam Vaughan, Aleksander Dąbrowski)
|
49
|
+
|
50
|
+
* Improved MagLev support. (Tim Felgentreff)
|
51
|
+
|
52
|
+
= 1.3.1 / 2011-10-05
|
53
|
+
|
54
|
+
* Support adding more than one callback to the stream object. (Konstantin
|
55
|
+
Haase)
|
56
|
+
|
57
|
+
* Fix for infinite loop when streaming on 1.9.2 with Thin from a modular
|
58
|
+
application (Konstantin Haase)
|
59
|
+
|
60
|
+
= 1.3.0 / 2011-09-30
|
61
|
+
|
62
|
+
* Added `stream` helper method for easily creating streaming APIs, Server
|
63
|
+
Sent Events or even WebSockets. See README for more on that topic.
|
64
|
+
(Konstantin Haase)
|
65
|
+
|
66
|
+
* If a HTTP 1.1 client is redirected from a different verb than GET, use 303
|
67
|
+
instead of 302 by default. You may still pass 302 explicitly. Fixes AJAX
|
68
|
+
redirects in Internet Explorer 9 (to be fair, everyone else is doing it
|
69
|
+
wrong and IE is behaving correct). (Konstantin Haase)
|
70
|
+
|
71
|
+
* Added support for HTTP PATCH requests. (Konstantin Haase)
|
72
|
+
|
73
|
+
* Use rack-protection to defend against common opportunistic attacks.
|
74
|
+
(Josh Lane, Jacob Burkhart, Konstantin Haase)
|
75
|
+
|
76
|
+
* Support for Creole templates, Creole is a standardized wiki markup,
|
77
|
+
supported by many wiki implementations. (Konstanin Haase)
|
78
|
+
|
79
|
+
* The `erubis` method has been deprecated. If Erubis is available, Sinatra
|
80
|
+
will automatically use it for rendering ERB templates. `require 'erb'`
|
81
|
+
explicitly to prevent that behavior. (Magnus Holm, Ryan Tomayko, Konstantin
|
82
|
+
Haase)
|
83
|
+
|
84
|
+
* Patterns now match against the escaped URLs rather than the unescaped
|
85
|
+
version. This makes Sinatra confirm with RFC 2396 section 2.2 and RFC 2616
|
86
|
+
section 3.2.3 (escaped reserved characters should not be treated like the
|
87
|
+
unescaped version), meaning that "/:name" will also match `/foo%2Fbar`, but
|
88
|
+
not `/foo/bar`. To avoid incompatibility, pattern matching has been
|
89
|
+
adjusted. Moreover, since we do no longer need to keep an unescaped version
|
90
|
+
of path_info around, we handle all changes to `env['PATH_INFO']` correctly.
|
91
|
+
(Konstantin Haase)
|
92
|
+
|
93
|
+
* `settings.app_file` now defaults to the file subclassing `Sinatra::Base` in
|
94
|
+
modular applications. (Konstantin Haase)
|
95
|
+
|
96
|
+
* Set up `Rack::Logger` or `Rack::NullLogger` depending on whether logging
|
97
|
+
was enabled or not. Also, expose that logger with the `logger` helper
|
98
|
+
method. (Konstantin Haase)
|
99
|
+
|
100
|
+
* The sessions setting may be an options hash now. (Konstantin Haase)
|
101
|
+
|
102
|
+
* Important: Ruby 1.8.6 support has been dropped. This version also depends
|
103
|
+
on at least Rack 1.3.0. This means that it is incompatible with Rails prior
|
104
|
+
to 3.1.0. Please use 1.2.x if you require an earlier version of Ruby or
|
105
|
+
Rack, which we will continue to supply with bug fixes. (Konstantin Haase)
|
106
|
+
|
107
|
+
* Renamed `:public` to `:public_folder` to avoid overriding Ruby's built-in
|
108
|
+
`public` method/keyword. `set(:public, ...)` is still possible but shows a
|
109
|
+
warning. (Konstantin Haase)
|
110
|
+
|
111
|
+
* It is now possible to use a different target class for the top level DSL
|
112
|
+
(aka classic style) than `Sinatra::Application` by setting
|
113
|
+
`Delegator.target`. This was mainly introduced to ease testing. (Konstantin
|
114
|
+
Haase)
|
115
|
+
|
116
|
+
* Error handlers defined for an error class will now also handle subclasses
|
117
|
+
of that class, unless more specific error handlers exist. (Konstantin
|
118
|
+
Haase)
|
119
|
+
|
120
|
+
* Error handling respects Exception#code, again. (Konstantin Haase)
|
121
|
+
|
122
|
+
* Changing a setting will merge hashes: `set(:x, :a => 1); set(:x :b => 2)`
|
123
|
+
will result in `{:a => 1, :b => 2}`. Use `set(:x, {:a => 1}, true)` to
|
124
|
+
avoid this behavior. (Konstantin Haase)
|
125
|
+
|
126
|
+
* Added `request.accept?` and `request.preferred_type` to ease dealing with
|
127
|
+
`Accept` headers. (Konstantin Haase)
|
128
|
+
|
129
|
+
* Added `:static_cache_control` setting to automatically set cache control
|
130
|
+
headers to static files. (Kenichi Nakamura)
|
131
|
+
|
132
|
+
* Added `informal?`, `success?`, `redirect?`, `client_error?`,
|
133
|
+
`server_error?` and `not_found?` helper methods to ease dealing with status
|
134
|
+
codes. (Konstantin Haase)
|
135
|
+
|
136
|
+
* Uses SecureRandom to generate default session secret. (Konstantin Haase)
|
137
|
+
|
138
|
+
* The `attachment` helper will set Content-Type (if it hasn't been set yet)
|
139
|
+
depending on the supplied file name. (Vasiliy Ermolovich)
|
140
|
+
|
141
|
+
* Conditional requests on `etag` helper now work properly for unsafe HTTP
|
142
|
+
methods. (Matthew Schinckel, Konstantin Haase)
|
143
|
+
|
144
|
+
* The `last_modified` helper does not stop execution and change the status code
|
145
|
+
if the status code is something different than 200. (Konstantin Haase)
|
146
|
+
|
147
|
+
* Added support for If-Unmodified-Since header. (Konstantin Haase)
|
148
|
+
|
149
|
+
* `Sinatra::Base.run!` now prints to stderr rather than stdout. (Andrew
|
150
|
+
Armenia)
|
151
|
+
|
152
|
+
* `Sinatra::Base.run!` takes a block allowing access to the Rack handler.
|
153
|
+
(David Waite)
|
154
|
+
|
155
|
+
* Automatic `app_file` detection now works in directories containing brackets
|
156
|
+
(Konstantin Haase)
|
157
|
+
|
158
|
+
* Exception objects are now passed to error handlers. (Konstantin Haase)
|
159
|
+
|
160
|
+
* Improved documentation. (Emanuele Vicentini, Peter Higgins, Takanori
|
161
|
+
Ishikawa, Konstantin Haase)
|
162
|
+
|
163
|
+
* Also specify charset in Content-Type header for JSON. (Konstantin Haase)
|
164
|
+
|
165
|
+
* Rack handler names will not be converted to lower case internally, this
|
166
|
+
allows you to run Sinatra with custom Rack handlers, like Kirk or Mongrel2.
|
167
|
+
Example: `ruby app.rb -s Mongrel2` (Konstantin Haase)
|
168
|
+
|
169
|
+
* Ignore `to_ary` on response bodies. Fixes compatibility to Rails 3.1.
|
170
|
+
(Konstantin Haase)
|
171
|
+
|
172
|
+
* Middleware setup is now distributed across multiple methods, allowing
|
173
|
+
Sinatra extensions to easily hook into the setup process. (Konstantin
|
174
|
+
Haase)
|
175
|
+
|
176
|
+
* Internal refactoring and minor performance improvements. (Konstantin Haase)
|
177
|
+
|
178
|
+
* Move Sinatra::VERSION to separate file, so it can be checked without
|
179
|
+
loading Sinatra. (Konstantin Haase)
|
180
|
+
|
181
|
+
* Command line options now complain if value passed to `-p` is not a valid
|
182
|
+
integer. (Konstantin Haase)
|
183
|
+
|
184
|
+
* Fix handling of broken query params when displaying exceptions. (Luke
|
185
|
+
Jahnke)
|
186
|
+
|
187
|
+
= 1.2.8 (backports release) / 2011-12-30
|
188
|
+
|
189
|
+
Backported from 1.3.2:
|
190
|
+
|
191
|
+
* Fix bug where rendering a second template in the same request after the
|
192
|
+
first one raised an exception skipped the default layout (Nathan Baum)
|
193
|
+
|
194
|
+
= 1.2.7 (backports release) / 2011-09-30
|
195
|
+
|
196
|
+
Custom changes:
|
197
|
+
|
198
|
+
* Fix Ruby 1.8.6 issue with Accept header parsing. (Konstantin Haase)
|
199
|
+
|
200
|
+
Backported from 1.3.0:
|
201
|
+
|
202
|
+
* Ignore `to_ary` on response bodies. Fixes compatibility to Rails 3.1.
|
203
|
+
(Konstantin Haase)
|
204
|
+
|
205
|
+
* `Sinatra.run!` now prints to stderr rather than stdout. (Andrew Armenia)
|
206
|
+
|
207
|
+
* Automatic `app_file` detection now works in directories containing brackets
|
208
|
+
(Konstantin Haase)
|
209
|
+
|
210
|
+
* Improved documentation. (Emanuele Vicentini, Peter Higgins, Takanori
|
211
|
+
Ishikawa, Konstantin Haase)
|
212
|
+
|
213
|
+
* Also specify charset in Content-Type header for JSON. (Konstantin Haase)
|
214
|
+
|
215
|
+
* Rack handler names will not be converted to lower case internally, this
|
216
|
+
allows you to run Sinatra with custom Rack handlers, like Kirk or Mongrel2.
|
217
|
+
Example: `ruby app.rb -s Mongrel2` (Konstantin Haase)
|
218
|
+
|
219
|
+
* Fix uninitialized instance variable warning. (David Kellum)
|
220
|
+
|
221
|
+
* Command line options now complain if value passed to `-p` is not a valid
|
222
|
+
integer. (Konstantin Haase)
|
223
|
+
|
224
|
+
* Fix handling of broken query params when displaying exceptions. (Luke
|
225
|
+
Jahnke)
|
226
|
+
|
227
|
+
= 1.2.6 / 2011-05-01
|
228
|
+
|
229
|
+
* Fix broken delegation, backport delegation tests from Sinatra 1.3.
|
230
|
+
(Konstantin Haase)
|
231
|
+
|
232
|
+
= 1.2.5 / 2011-04-30
|
233
|
+
|
234
|
+
* Restore compatibility with Ruby 1.8.6. (Konstantin Haase)
|
235
|
+
|
236
|
+
= 1.2.4 / 2011-04-30
|
237
|
+
|
238
|
+
* Sinatra::Application (classic style) does not use a session secret in
|
239
|
+
development mode, so sessions are not invalidated after every request when
|
240
|
+
using Shotgun. (Konstantin Haase)
|
241
|
+
|
242
|
+
* The request object was shared between multiple Sinatra instances in the
|
243
|
+
same middleware chain. This caused issues if any non-sinatra routing
|
244
|
+
happend in-between two of those instances, or running a request twice
|
245
|
+
against an application (described in the README). The caching was reverted.
|
246
|
+
See GH#239 and GH#256 for more infos. (Konstantin Haase)
|
247
|
+
|
248
|
+
* Fixes issues where the top level DSL was interfering with method_missing
|
249
|
+
proxies. This issue surfaced when Rails 3 was used with older Sass versions
|
250
|
+
and Sinatra >= 1.2.0. (Konstantin Haase)
|
251
|
+
|
252
|
+
* Sinatra::Delegator.delegate is now able to delegate any method names, even
|
253
|
+
those containing special characters. This allows better integration into
|
254
|
+
other programming languages on Rubinius (probably on the JVM, too), like
|
255
|
+
Fancy. (Konstantin Haase)
|
256
|
+
|
257
|
+
* Remove HEAD request logic and let Rack::Head handle it instead. (Paolo
|
258
|
+
"Nusco" Perrotta)
|
259
|
+
|
260
|
+
= 1.2.3 / 2011-04-13
|
261
|
+
|
262
|
+
* This release is compatible with Tilt 1.3, it will still work with Tilt 1.2.2,
|
263
|
+
however, if you want to use a newer Tilt version, you have to upgrade to at
|
264
|
+
least this version of Sinatra. (Konstantin Haase)
|
265
|
+
|
266
|
+
* Helpers dealing with time, like `expires`, handle objects that pretend to be
|
267
|
+
numbers, like `ActiveSupport::Duration`, better. (Konstantin Haase)
|
268
|
+
|
269
|
+
= 1.2.2 / 2011-04-08
|
270
|
+
|
271
|
+
* The `:provides => :js` condition now matches both `application/javascript`
|
272
|
+
and `text/javascript`. The `:provides => :xml` condition now matches both
|
273
|
+
`application/xml` and `text/xml`. The `Content-Type` header is set
|
274
|
+
accordingly. If the client accepts both, the `application/*` version is
|
275
|
+
preferred, since the `text/*` versions are deprecated. (Konstantin Haase)
|
276
|
+
|
277
|
+
* The `provides` condition now handles wildcards in `Accept` headers correctly.
|
278
|
+
Thus `:provides => :html` matches `text/html`, `text/*` and `*/*`.
|
279
|
+
(Konstantin Haase)
|
280
|
+
|
281
|
+
* When parsing `Accept` headers, `Content-Type` preferences are honored
|
282
|
+
according to RFC 2616 section 14.1. (Konstantin Haase)
|
283
|
+
|
284
|
+
* URIs passed to the `url` helper or `redirect` may now use any schema to be
|
285
|
+
identified as absolute URIs, not only `http` or `https`. (Konstantin Haase)
|
286
|
+
|
287
|
+
* Handles `Content-Type` strings that already contain parameters correctly in
|
288
|
+
`content_type` (example: `content_type "text/plain; charset=utf-16"`).
|
289
|
+
(Konstantin Haase)
|
290
|
+
|
291
|
+
* If a route with an empty pattern is defined (`get("") { ... }`) requests with
|
292
|
+
an empty path info match this route instead of "/". (Konstantin Haase)
|
293
|
+
|
294
|
+
* In development environment, when running under a nested path, the image URIs
|
295
|
+
on the error pages are set properly. (Konstantin Haase)
|
296
|
+
|
297
|
+
= 1.2.1 / 2011-03-17
|
298
|
+
|
299
|
+
* Use a generated session secret when using `enable :sessions`. (Konstantin
|
300
|
+
Haase)
|
301
|
+
|
302
|
+
* Fixed a bug where the wrong content type was used if no content type was set
|
303
|
+
and a template engine was used with a different engine for the layout with
|
304
|
+
different default content types, say Less embedded in Slim. (Konstantin
|
305
|
+
Haase)
|
306
|
+
|
307
|
+
* README translations improved (Gabriel Andretta, burningTyger, Sylvain Desvé,
|
308
|
+
Gregor Schmidt)
|
309
|
+
|
310
|
+
= 1.2.0 / 2011-03-03
|
311
|
+
|
312
|
+
* Added `slim` rendering method for rendering Slim templates. (Steve
|
313
|
+
Hodgkiss)
|
314
|
+
|
315
|
+
* The `markaby` rendering method now allows passing a block, making inline
|
316
|
+
usage possible. Requires Tilt 1.2 or newer. (Konstantin Haase)
|
317
|
+
|
318
|
+
* All render methods now take a `:layout_engine` option, allowing to use a
|
319
|
+
layout in a different template language. Even more useful than using this
|
320
|
+
directly (`erb :index, :layout_engine => :haml`) is setting this globally for
|
321
|
+
a template engine that otherwise does not support layouts, like Markdown or
|
322
|
+
Textile (`set :markdown, :layout_engine => :erb`). (Konstantin Haase)
|
323
|
+
|
324
|
+
* Before and after filters now support conditions, both with and without
|
325
|
+
patterns (`before '/api/*', :agent => /Songbird/`). (Konstantin Haase)
|
326
|
+
|
327
|
+
* Added a `url` helper method which constructs absolute URLs. Copes with
|
328
|
+
reverse proxies and Rack handlers correctly. Aliased to `to`, so you can
|
329
|
+
write `redirect to('/foo')`. (Konstantin Haase)
|
330
|
+
|
331
|
+
* If running on 1.9, patterns for routes and filters now support named
|
332
|
+
captures: `get(%r{/hi/(?<name>[^/?#]+)}) { "Hi #{params['name']}" }`.
|
333
|
+
(Steve Price)
|
334
|
+
|
335
|
+
* All rendering methods now take a `:scope` option, which renders them in
|
336
|
+
another context. Note that helpers and instance variables will be
|
337
|
+
unavailable if you use this feature. (Paul Walker)
|
338
|
+
|
339
|
+
* The behavior of `redirect` can now be configured with `absolute_redirects`
|
340
|
+
and `prefixed_redirects`. (Konstantin Haase)
|
341
|
+
|
342
|
+
* `send_file` now allows overriding the Last-Modified header, which defaults
|
343
|
+
to the file's mtime, by passing a `:last_modified` option. (Konstantin Haase)
|
344
|
+
|
345
|
+
* You can use your own template lookup method by defining `find_template`.
|
346
|
+
This allows, among other things, using more than one views folder.
|
347
|
+
(Konstantin Haase)
|
348
|
+
|
349
|
+
* Largely improved documentation. (burningTyger, Vasily Polovnyov, Gabriel
|
350
|
+
Andretta, Konstantin Haase)
|
351
|
+
|
352
|
+
* Improved error handling. (cactus, Konstantin Haase)
|
353
|
+
|
354
|
+
* Skip missing template engines in tests correctly. (cactus)
|
355
|
+
|
356
|
+
* Sinatra now ships with a Gemfile for development dependencies, since it eases
|
357
|
+
supporting different platforms, like JRuby. (Konstantin Haase)
|
358
|
+
|
359
|
+
= 1.1.4 (backports release) / 2011-04-13
|
360
|
+
|
361
|
+
* Compatible with Tilt 1.3. (Konstantin Haase)
|
362
|
+
|
363
|
+
= 1.1.3 / 2011-02-20
|
364
|
+
|
365
|
+
* Fixed issues with `user_agent` condition if the user agent header is missing.
|
366
|
+
(Konstantin Haase)
|
367
|
+
|
368
|
+
* Fix some routing tests that have been skipped by accident (Ross A. Baker)
|
369
|
+
|
370
|
+
* Fix rendering issues with Builder and Nokogiri (Konstantin Haase)
|
371
|
+
|
372
|
+
* Replace last_modified helper with better implementation. (cactus,
|
373
|
+
Konstantin Haase)
|
374
|
+
|
375
|
+
* Fix issue with charset not being set when using `provides` condition.
|
376
|
+
(Konstantin Haase)
|
377
|
+
|
378
|
+
* Fix issue with `render` not picking up all alternative file extensions for
|
379
|
+
a rendering engine - it was not possible to register ".html.erb" without
|
380
|
+
tricks. (Konstantin Haase)
|
381
|
+
|
382
|
+
= 1.1.2 / 2010-10-25
|
383
|
+
|
384
|
+
Like 1.1.1, but with proper CHANGES file.
|
385
|
+
|
386
|
+
= 1.1.1 / 2010-10-25
|
387
|
+
|
388
|
+
* README has been translated to Russian (Nickolay Schwarz, Vasily Polovnyov)
|
389
|
+
and Portuguese (Luciano Sousa).
|
390
|
+
|
391
|
+
* Nested templates without a `:layout` option can now be used from the layout
|
392
|
+
template without causing an infinite loop. (Konstantin Haase)
|
393
|
+
|
394
|
+
* Inline templates are now encoding aware and can therefore be used with
|
395
|
+
unicode characters on Ruby 1.9. Magic comments at the beginning of the file
|
396
|
+
will be honored. (Konstantin Haase)
|
397
|
+
|
398
|
+
* Default `app_file` is set correctly when running with bundler. Using
|
399
|
+
bundler caused Sinatra not to find the `app_file` and therefore not to find
|
400
|
+
the `views` folder on it's own. (Konstantin Haase)
|
401
|
+
|
402
|
+
* Better handling of Content-Type when using `send_file`: If file extension
|
403
|
+
is unknown, fall back to `application/octet-stream` and do not override
|
404
|
+
content type if it has already been set, except if `:type` is passed
|
405
|
+
explicitly (Konstantin Haase)
|
406
|
+
|
407
|
+
* Path is no longer cached if changed between handlers that do pattern
|
408
|
+
matching. This means you can change `request.path_info` in a pattern
|
409
|
+
matching before filter. (Konstantin Haase)
|
410
|
+
|
411
|
+
* Headers set by cache_control now always set max_age as an Integer, making
|
412
|
+
sure it is compatible with RFC2616. (Konstantin Haase)
|
413
|
+
|
414
|
+
* Further improved handling of string encodings on Ruby 1.9, templates now
|
415
|
+
honor default_encoding and URLs support unicode characters. (Konstantin
|
416
|
+
Haase)
|
417
|
+
|
418
|
+
= 1.1.0 / 2010-10-24
|
419
|
+
|
420
|
+
* Before and after filters now support pattern matching, including the
|
421
|
+
ability to use captures: "before('/user/:name') { |name| ... }". This
|
422
|
+
avoids manual path checking. No performance loss if patterns are avoided.
|
423
|
+
(Konstantin Haase)
|
424
|
+
|
425
|
+
* It is now possible to render SCSS files with the `scss` method, which
|
426
|
+
behaves exactly like `sass` except for the different file extension and
|
427
|
+
assuming the SCSS syntax. (Pedro Menezes, Konstantin Haase)
|
428
|
+
|
429
|
+
* Added `liquid`, `markdown`, `nokogiri`, `textile`, `rdoc`, `radius`,
|
430
|
+
`markaby`, and `coffee` rendering methods for rendering Liquid, Markdown,
|
431
|
+
Nokogiri, Textile, RDoc, Radius, Markaby and CoffeeScript templates.
|
432
|
+
(Konstantin Haase)
|
433
|
+
|
434
|
+
* Now supports byte-range requests (the HTTP_RANGE header) for static files.
|
435
|
+
Multi-range requests are not supported, however. (Jens Alfke)
|
436
|
+
|
437
|
+
* You can now use #settings method from class and top level for convenience.
|
438
|
+
(Konstantin Haase)
|
439
|
+
|
440
|
+
* Setting multiple values now no longer relies on #to_hash and therefore
|
441
|
+
accepts any Enumerable as parameter. (Simon Rozet)
|
442
|
+
|
443
|
+
* Nested templates default the `layout` option to `false` rather than `true`.
|
444
|
+
This eases the use of partials. If you wanted to render one haml template
|
445
|
+
embedded in another, you had to call `haml :partial, {}, :layout => false`.
|
446
|
+
As you almost never want the partial to be wrapped in the standard layout
|
447
|
+
in this situation, you now only have to call `haml :partial`. Passing in
|
448
|
+
`layout` explicitly is still possible. (Konstantin Haase)
|
449
|
+
|
450
|
+
* If a the return value of one of the render functions is used as a response
|
451
|
+
body and the content type has not been set explicitly, Sinatra chooses a
|
452
|
+
content type corresponding to the rendering engine rather than just using
|
453
|
+
"text/html". (Konstantin Haase)
|
454
|
+
|
455
|
+
* README is now available in Chinese (Wu Jiang), French (Mickael Riga),
|
456
|
+
German (Bernhard Essl, Konstantin Haase, burningTyger), Hungarian (Janos
|
457
|
+
Hardi) and Spanish (Gabriel Andretta). The extremely outdated Japanese
|
458
|
+
README has been updated (Kouhei Yanagita).
|
459
|
+
|
460
|
+
* It is now possible to access Sinatra's template_cache from the outside.
|
461
|
+
(Nick Sutterer)
|
462
|
+
|
463
|
+
* The `last_modified` method now also accepts DateTime instances and makes
|
464
|
+
sure the header will always be set to a string. (Konstantin Haase)
|
465
|
+
|
466
|
+
* 599 now is a legal status code. (Steve Shreeve)
|
467
|
+
|
468
|
+
* This release is compatible with Ruby 1.9.2. Sinatra was trying to read
|
469
|
+
non existent files Ruby added to the call stack. (Shota Fukumori,
|
470
|
+
Konstantin Haase)
|
471
|
+
|
472
|
+
* Prevents a memory leak on 1.8.6 in production mode. Note, however, that
|
473
|
+
this is due to a bug in 1.8.6 and request will have the additional overhead
|
474
|
+
of parsing templates again on that version. It is recommended to use at
|
475
|
+
least Ruby 1.8.7. (Konstantin Haase)
|
476
|
+
|
477
|
+
* Compares last modified date correctly. `last_modified` was halting only
|
478
|
+
when the 'If-Modified-Since' header date was equal to the time specified.
|
479
|
+
Now, it halts when is equal or later than the time specified (Gabriel
|
480
|
+
Andretta).
|
481
|
+
|
482
|
+
* Sinatra is now usable in combination with Rails 3. When mounting a Sinatra
|
483
|
+
application under a subpath in Rails 3, the PATH_INFO is not prefixed with
|
484
|
+
a slash and no routes did match. (José Valim)
|
485
|
+
|
486
|
+
* Better handling of encodings in 1.9, defaults params encoding to UTF-8.
|
487
|
+
(Konstantin Haase)
|
488
|
+
|
489
|
+
* `show_exeptions` handling is now triggered after custom error handlers, if
|
490
|
+
it is set to `:after_handlers`, thus not disabling those handler in
|
491
|
+
development mode. (pangel, Konstantin Haase)
|
492
|
+
|
493
|
+
* Added ability to handle weighted HTTP_ACCEPT headers. (Davide D'Agostino)
|
494
|
+
|
495
|
+
* `send_file` now always respects the `:type` option if set. Previously it
|
496
|
+
was discarded if no matching mime type was found, which made it impossible
|
497
|
+
to directly pass a mime type. (Konstantin Haase)
|
498
|
+
|
499
|
+
* `redirect` always redirects to an absolute URI, even if a relative URI was
|
500
|
+
passed. Ensures compatibility with RFC 2616 section 14.30. (Jean-Philippe
|
501
|
+
Garcia Ballester, Anthony Williams)
|
502
|
+
|
503
|
+
* Broken examples for using Erubis, Haml and Test::Unit in README have been
|
504
|
+
fixed. (Nick Sutterer, Doug Ireton, Jason Stewart, Eric Marden)
|
505
|
+
|
506
|
+
* Sinatra now handles SIGTERM correctly. (Patrick Collison)
|
507
|
+
|
508
|
+
* Fixes an issue with inline templates in modular applications that manually
|
509
|
+
call `run!`. (Konstantin Haase)
|
510
|
+
|
511
|
+
* Spaces after inline template names are now ignored (Konstantin Haase)
|
512
|
+
|
513
|
+
* It's now possible to use Sinatra with different package management
|
514
|
+
systems defining a custom require. (Konstantin Haase)
|
515
|
+
|
516
|
+
* Lighthouse has been dropped in favor of GitHub issues.
|
517
|
+
|
518
|
+
* Tilt is now a dependency and therefore no longer ships bundled with
|
519
|
+
Sinatra. (Ryan Tomayko, Konstantin Haase)
|
520
|
+
|
521
|
+
* Sinatra now depends on Rack 1.1 or higher. Rack 1.0 is no longer supported.
|
522
|
+
(Konstantin Haase)
|
523
|
+
|
524
|
+
= 1.0 / 2010-03-23
|
2
525
|
|
3
526
|
* It's now possible to register blocks to run after each request using
|
4
527
|
after filters. After filters run at the end of each request, after
|