sinatra-sinatra 0.8.9
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +40 -0
- data/CHANGES +174 -0
- data/LICENSE +22 -0
- data/README.rdoc +545 -0
- data/Rakefile +180 -0
- data/compat/app_test.rb +300 -0
- data/compat/application_test.rb +334 -0
- data/compat/builder_test.rb +101 -0
- data/compat/custom_error_test.rb +62 -0
- data/compat/erb_test.rb +136 -0
- data/compat/events_test.rb +78 -0
- data/compat/filter_test.rb +30 -0
- data/compat/haml_test.rb +233 -0
- data/compat/helper.rb +30 -0
- data/compat/mapped_error_test.rb +72 -0
- data/compat/pipeline_test.rb +71 -0
- data/compat/public/foo.xml +1 -0
- data/compat/sass_test.rb +57 -0
- data/compat/sessions_test.rb +39 -0
- data/compat/streaming_test.rb +121 -0
- data/compat/sym_params_test.rb +19 -0
- data/compat/template_test.rb +30 -0
- data/compat/use_in_file_templates_test.rb +47 -0
- data/compat/views/foo.builder +1 -0
- data/compat/views/foo.erb +1 -0
- data/compat/views/foo.haml +1 -0
- data/compat/views/foo.sass +2 -0
- data/compat/views/foo_layout.erb +2 -0
- data/compat/views/foo_layout.haml +2 -0
- data/compat/views/layout_test/foo.builder +1 -0
- data/compat/views/layout_test/foo.erb +1 -0
- data/compat/views/layout_test/foo.haml +1 -0
- data/compat/views/layout_test/foo.sass +2 -0
- data/compat/views/layout_test/layout.builder +3 -0
- data/compat/views/layout_test/layout.erb +1 -0
- data/compat/views/layout_test/layout.haml +1 -0
- data/compat/views/layout_test/layout.sass +2 -0
- data/compat/views/no_layout/no_layout.builder +1 -0
- data/compat/views/no_layout/no_layout.haml +1 -0
- data/lib/sinatra/base.rb +818 -0
- data/lib/sinatra/compat.rb +239 -0
- data/lib/sinatra/images/404.png +0 -0
- data/lib/sinatra/images/500.png +0 -0
- data/lib/sinatra/main.rb +48 -0
- data/lib/sinatra/test/bacon.rb +17 -0
- data/lib/sinatra/test/rspec.rb +9 -0
- data/lib/sinatra/test/spec.rb +9 -0
- data/lib/sinatra/test/unit.rb +11 -0
- data/lib/sinatra/test.rb +109 -0
- data/lib/sinatra.rb +4 -0
- data/sinatra.gemspec +109 -0
- data/test/base_test.rb +68 -0
- data/test/builder_test.rb +64 -0
- data/test/data/reload_app_file.rb +3 -0
- data/test/erb_test.rb +50 -0
- data/test/filter_test.rb +35 -0
- data/test/haml_test.rb +68 -0
- data/test/helper.rb +20 -0
- data/test/helpers_test.rb +361 -0
- data/test/mapped_error_test.rb +160 -0
- data/test/middleware_test.rb +58 -0
- data/test/options_test.rb +97 -0
- data/test/reload_test.rb +61 -0
- data/test/request_test.rb +9 -0
- data/test/result_test.rb +88 -0
- data/test/routing_test.rb +334 -0
- data/test/sass_test.rb +36 -0
- data/test/sinatra_test.rb +13 -0
- data/test/static_test.rb +57 -0
- data/test/templates_test.rb +88 -0
- data/test/views/hello.builder +1 -0
- data/test/views/hello.erb +1 -0
- data/test/views/hello.haml +1 -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.haml +2 -0
- data/test/views/layout2.test +1 -0
- metadata +161 -0
data/AUTHORS
ADDED
@@ -0,0 +1,40 @@
|
|
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 <heroku.com> and the emotional support
|
4
|
+
provided by Adam Wiggins (adamwiggins), Chris Wanstrath (defunkt), PJ Hyett (pjhyett), and
|
5
|
+
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
|
+
* Christopher Schneid (cschneid) for The Book, the blog (gittr.com),
|
14
|
+
irclogger.com, and a bunch of useful patches.
|
15
|
+
* Markus Prinz (cypher) for patches over the years, caring about
|
16
|
+
the README, and hanging in there when times were rough.
|
17
|
+
* Simon Rozet (sr) for a ton of doc patches, HAML options, and all that
|
18
|
+
advocacy stuff he's going to do for 1.0.
|
19
|
+
* Erik Kastner (kastner) for fixing MIME_TYPES under Rack 0.5.
|
20
|
+
* Ben Bleything (bleything) for caring about HTTP status codes and doc fixes.
|
21
|
+
* Igal Koshevoy (igal) for root path detection under Thin/Passenger.
|
22
|
+
* Jon Crosby (jcrosby) for coffee breaks, doc fixes, and just because, man.
|
23
|
+
* Karel Minarik (karmi) for screaming until the website came back up.
|
24
|
+
* Jeremy Evans (jeremyevans) for unbreaking optional path params (twice!)
|
25
|
+
* The GitHub guys for stealing Blake's table.
|
26
|
+
* Nickolas Means (nmeans) for Sass template support.
|
27
|
+
* Victor Hugo Borja (vic) for splat'n routes specs and doco.
|
28
|
+
* Avdi Grimm (avdi) for basic RSpec support.
|
29
|
+
* Jack Danger Canty for a more accurate root directory and for making me
|
30
|
+
watch this just now: http://www.youtube.com/watch?v=ueaHLHgskkw.
|
31
|
+
* Mathew Walker for making escaped paths work with static files.
|
32
|
+
* Millions of Us for having the problem that led to Sinatra's conception.
|
33
|
+
* Songbird for the problems that helped Sinatra's future become realized.
|
34
|
+
* Rick Olsen (technoweenie) for the killer plug at RailsConf '08.
|
35
|
+
* Steven Garcia for the amazing custom artwork you see on 404's and 500's
|
36
|
+
|
37
|
+
and last but not least:
|
38
|
+
|
39
|
+
* Frank Sinatra (chairman of the board) for having so much class he
|
40
|
+
deserves a web-framework named after him.
|
data/CHANGES
ADDED
@@ -0,0 +1,174 @@
|
|
1
|
+
= 0.9.0 (unreleased)
|
2
|
+
|
3
|
+
* Works with and requires Rack >= 0.9.1
|
4
|
+
|
5
|
+
* Multiple Sinatra applications can now co-exist peacefully within a
|
6
|
+
single process. The new "Sinatra::Base" class can be subclassed to
|
7
|
+
establish a blank-slate Rack application or middleware component.
|
8
|
+
Documentation on using these features is forth-coming; the following
|
9
|
+
provides the basic gist: http://gist.github.com/38605
|
10
|
+
|
11
|
+
* Regular expressions may now be used in route pattens; captures are
|
12
|
+
available at "params[:captures]".
|
13
|
+
|
14
|
+
* New ":provides" route condition takes an array of mime types and
|
15
|
+
matches only when an Accept request header is present with a
|
16
|
+
corresponding type. [cypher]
|
17
|
+
|
18
|
+
* New request-level "pass" method; immediately exits the current block
|
19
|
+
and passes control to the next matching route.
|
20
|
+
|
21
|
+
* The request-level "body" method now takes a block; evaluation is
|
22
|
+
deferred until an attempt is made to read the body. The block must
|
23
|
+
return a String or Array.
|
24
|
+
|
25
|
+
* New "route conditions" system for attaching rules for when a route
|
26
|
+
matches. The :agent and :host route options now use this system.
|
27
|
+
|
28
|
+
* New "dump_errors" option controls whether the backtrace is dumped to
|
29
|
+
rack.errors when an exception is raised from a route. The option is
|
30
|
+
enabled by default for top-level apps.
|
31
|
+
|
32
|
+
* Better default "app_file", "root", "public", and "views" location
|
33
|
+
detection; changes to "root" and "app_file" automatically cascade to
|
34
|
+
other options that depend on them.
|
35
|
+
|
36
|
+
* Error mappings are now split into two distinct layers: exception
|
37
|
+
mappings and custom error pages. Exception mappings are registered
|
38
|
+
with "error(Exception)" and are run only when the app raises an
|
39
|
+
exception. Custom error pages are registered with "error(status_code)",
|
40
|
+
where "status_code" is an integer, and are run any time the response
|
41
|
+
has the status code specified. It's also possible to register an error
|
42
|
+
page for a range of status codes: "error(500..599)".
|
43
|
+
|
44
|
+
* Added support for Bacon (test framework). The 'sinatra/test/bacon' file
|
45
|
+
can be required to setup Sinatra test helpers on Bacon::Context.
|
46
|
+
|
47
|
+
* Deprecated "set_option" and "set_options"; use "set" instead.
|
48
|
+
|
49
|
+
* Deprecated the "env" option ("options.env"); use "environment" instead.
|
50
|
+
|
51
|
+
* Deprecated the request level "stop" method; use "halt" instead.
|
52
|
+
|
53
|
+
* Deprecated the request level "entity_tag" method; use "etag" instead.
|
54
|
+
Both "entity_tag" and "etag" were previously supported.
|
55
|
+
|
56
|
+
* Deprecated the request level "headers" method (HTTP response headers);
|
57
|
+
use "response['Header-Name']" instead.
|
58
|
+
|
59
|
+
* Deprecated "Sinatra.application"; use "Sinatra::Application" instead.
|
60
|
+
|
61
|
+
* Deprecated setting Sinatra.application = nil to reset an application.
|
62
|
+
This should no longer be necessary.
|
63
|
+
|
64
|
+
* Deprecated "Sinatra.default_options"; use
|
65
|
+
"Sinatra::Default.set(key, value)" instead.
|
66
|
+
|
67
|
+
* Deprecated the "ServerError" exception. All Exceptions are now
|
68
|
+
treated as internal server errors and result in a 500 response
|
69
|
+
status.
|
70
|
+
|
71
|
+
* Deprecated the "get_it", "post_it", "put_it", "delete_it", and "head_it"
|
72
|
+
test helper methods. Use "get", "post", "put", "delete", and "head",
|
73
|
+
respectively, instead.
|
74
|
+
|
75
|
+
* Removed Event and EventContext classes. Applications are defined in a
|
76
|
+
subclass of Sinatra::Base; each request is processed within an
|
77
|
+
instance.
|
78
|
+
|
79
|
+
= 0.3.3 / 2009-01-06
|
80
|
+
|
81
|
+
* Pin to Rack 0.4.0 (this is the last release on Rack 0.4)
|
82
|
+
|
83
|
+
* Log unhandled exception backtraces to rack.errors.
|
84
|
+
|
85
|
+
* Use RACK_ENV environment variable to establish Sinatra
|
86
|
+
environment when given. Thin sets this when started with
|
87
|
+
the -e argument.
|
88
|
+
|
89
|
+
* BUG: raising Sinatra::NotFound resulted in a 500 response
|
90
|
+
code instead of 404.
|
91
|
+
|
92
|
+
* BUG: use_in_file_templates! fails with CR/LF (#45)
|
93
|
+
|
94
|
+
* BUG: Sinatra detects the app file and root path when run under
|
95
|
+
thin/passenger.
|
96
|
+
|
97
|
+
= 0.3.2
|
98
|
+
|
99
|
+
* BUG: Static and send_file read entire file into String before
|
100
|
+
sending. Updated to stream with 8K chunks instead.
|
101
|
+
|
102
|
+
* Rake tasks and assets for building basic documentation website.
|
103
|
+
See http://sinatra.rubyforge.org
|
104
|
+
|
105
|
+
* Various minor doc fixes.
|
106
|
+
|
107
|
+
= 0.3.1
|
108
|
+
|
109
|
+
* Unbreak optional path parameters [jeremyevans]
|
110
|
+
|
111
|
+
= 0.3.0
|
112
|
+
|
113
|
+
* Add sinatra.gemspec w/ support for github gem builds. Forks can now
|
114
|
+
enable the build gem option in github to get free username-sinatra.gem
|
115
|
+
builds: gem install username-sinatra.gem --source=http://gems.github.com/
|
116
|
+
|
117
|
+
* Require rack-0.4 gem; removes frozen rack dir.
|
118
|
+
|
119
|
+
* Basic RSpec support; require 'sinatra/test/rspec' instead of
|
120
|
+
'sinatra/test/spec' to use. [avdi]
|
121
|
+
|
122
|
+
* before filters can modify request environment vars used for
|
123
|
+
routing (e.g., PATH_INFO, REQUEST_METHOD, etc.) for URL rewriting
|
124
|
+
type functionality.
|
125
|
+
|
126
|
+
* In-file templates now uses @@ instead of ## as template separator.
|
127
|
+
|
128
|
+
* Top-level environment test predicates: development?, test?, production?
|
129
|
+
|
130
|
+
* Top-level "set", "enable", and "disable" methods for tweaking
|
131
|
+
app options. [rtomayko]
|
132
|
+
|
133
|
+
* Top-level "use" method for building Rack middleware pipelines
|
134
|
+
leading to app. See README for usage. [rtomayko]
|
135
|
+
|
136
|
+
* New "reload" option - set false to disable reloading in development.
|
137
|
+
|
138
|
+
* New "host" option - host/ip to bind to [cschneid]
|
139
|
+
|
140
|
+
* New "app_file" option - override the file to reload in development
|
141
|
+
mode [cschneid]
|
142
|
+
|
143
|
+
* Development error/not_found page cleanup [sr, adamwiggins]
|
144
|
+
|
145
|
+
* Remove a bunch of core extensions (String#to_param, String#from_param,
|
146
|
+
Hash#from_params, Hash#to_params, Hash#symbolize_keys, Hash#pass)
|
147
|
+
|
148
|
+
* Various grammar and formatting fixes to README; additions on
|
149
|
+
community and contributing [cypher]
|
150
|
+
|
151
|
+
* Build RDoc using Hanna template: http://sinatrarb.rubyforge.org/api
|
152
|
+
|
153
|
+
* Specs, documentation and fixes for splat'n routes [vic]
|
154
|
+
|
155
|
+
* Fix whitespace errors across all source files. [rtomayko]
|
156
|
+
|
157
|
+
* Fix streaming issues with Mongrel (body not closed). [bmizerany]
|
158
|
+
|
159
|
+
* Fix various issues with environment not being set properly (configure
|
160
|
+
blocks not running, error pages not registering, etc.) [cypher]
|
161
|
+
|
162
|
+
* Fix to allow locals to be passed to ERB templates [cschneid]
|
163
|
+
|
164
|
+
* Fix locking issues causing random errors during reload in development.
|
165
|
+
|
166
|
+
* Fix for escaped paths not resolving static files [Matthew Walker]
|
167
|
+
|
168
|
+
= 0.2.1
|
169
|
+
|
170
|
+
* File upload fix and minor tweaks.
|
171
|
+
|
172
|
+
= 0.2.0
|
173
|
+
|
174
|
+
* Initial gem release of 0.2 codebase.
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2007 Blake Mizerany
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person
|
4
|
+
obtaining a copy of this software and associated documentation
|
5
|
+
files (the "Software"), to deal in the Software without
|
6
|
+
restriction, including without limitation the rights to use,
|
7
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
copies of the Software, and to permit persons to whom the
|
9
|
+
Software is furnished to do so, subject to the following
|
10
|
+
conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
17
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
19
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
20
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
21
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22
|
+
OTHER DEALINGS IN THE SOFTWARE.
|