Syd-sinatra 0.3.2 → 0.9.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. data/AUTHORS +40 -0
  2. data/CHANGES +189 -0
  3. data/README.rdoc +148 -119
  4. data/Rakefile +34 -10
  5. data/{test → compat}/app_test.rb +11 -10
  6. data/{test → compat}/application_test.rb +21 -5
  7. data/compat/builder_test.rb +101 -0
  8. data/compat/erb_test.rb +136 -0
  9. data/{test → compat}/events_test.rb +16 -3
  10. data/compat/filter_test.rb +30 -0
  11. data/compat/haml_test.rb +233 -0
  12. data/compat/helper.rb +30 -0
  13. data/compat/mapped_error_test.rb +72 -0
  14. data/{test → compat}/pipeline_test.rb +9 -4
  15. data/compat/sass_test.rb +57 -0
  16. data/{test → compat}/streaming_test.rb +4 -1
  17. data/lib/sinatra/base.rb +843 -0
  18. data/lib/sinatra/compat.rb +239 -0
  19. data/lib/sinatra/main.rb +48 -0
  20. data/lib/sinatra/test/bacon.rb +17 -0
  21. data/lib/sinatra/test/rspec.rb +7 -8
  22. data/lib/sinatra/test/spec.rb +3 -4
  23. data/lib/sinatra/test/unit.rb +3 -5
  24. data/lib/sinatra/test.rb +114 -0
  25. data/lib/sinatra.rb +6 -1468
  26. data/sinatra.gemspec +68 -35
  27. data/test/base_test.rb +68 -0
  28. data/test/builder_test.rb +50 -87
  29. data/test/data/reload_app_file.rb +3 -0
  30. data/test/erb_test.rb +38 -124
  31. data/test/filter_test.rb +65 -20
  32. data/test/haml_test.rb +51 -216
  33. data/test/helper.rb +23 -5
  34. data/test/helpers_test.rb +361 -0
  35. data/test/mapped_error_test.rb +137 -49
  36. data/test/middleware_test.rb +58 -0
  37. data/test/options_test.rb +97 -0
  38. data/test/reload_test.rb +61 -0
  39. data/test/request_test.rb +18 -0
  40. data/test/result_test.rb +88 -0
  41. data/test/routing_test.rb +391 -0
  42. data/test/sass_test.rb +27 -48
  43. data/test/sinatra_test.rb +13 -0
  44. data/test/static_test.rb +57 -0
  45. data/test/templates_test.rb +88 -0
  46. data/test/views/hello.builder +1 -0
  47. data/test/views/hello.erb +1 -0
  48. data/test/views/hello.haml +1 -0
  49. data/test/views/hello.sass +2 -0
  50. data/test/views/hello.test +1 -0
  51. data/test/views/layout2.builder +3 -0
  52. data/test/views/layout2.erb +2 -0
  53. data/test/views/layout2.haml +2 -0
  54. data/test/views/layout2.test +1 -0
  55. metadata +79 -47
  56. data/ChangeLog +0 -78
  57. data/lib/sinatra/test/methods.rb +0 -76
  58. data/test/event_context_test.rb +0 -15
  59. /data/{test → compat}/custom_error_test.rb +0 -0
  60. /data/{test → compat}/public/foo.xml +0 -0
  61. /data/{test → compat}/sessions_test.rb +0 -0
  62. /data/{test → compat}/sym_params_test.rb +0 -0
  63. /data/{test → compat}/template_test.rb +0 -0
  64. /data/{test → compat}/use_in_file_templates_test.rb +0 -0
  65. /data/{test → compat}/views/foo.builder +0 -0
  66. /data/{test → compat}/views/foo.erb +0 -0
  67. /data/{test → compat}/views/foo.haml +0 -0
  68. /data/{test → compat}/views/foo.sass +0 -0
  69. /data/{test → compat}/views/foo_layout.erb +0 -0
  70. /data/{test → compat}/views/foo_layout.haml +0 -0
  71. /data/{test → compat}/views/layout_test/foo.builder +0 -0
  72. /data/{test → compat}/views/layout_test/foo.erb +0 -0
  73. /data/{test → compat}/views/layout_test/foo.haml +0 -0
  74. /data/{test → compat}/views/layout_test/foo.sass +0 -0
  75. /data/{test → compat}/views/layout_test/layout.builder +0 -0
  76. /data/{test → compat}/views/layout_test/layout.erb +0 -0
  77. /data/{test → compat}/views/layout_test/layout.haml +0 -0
  78. /data/{test → compat}/views/layout_test/layout.sass +0 -0
  79. /data/{test → compat}/views/no_layout/no_layout.builder +0 -0
  80. /data/{test → compat}/views/no_layout/no_layout.haml +0 -0
  81. /data/{images → lib/sinatra/images}/404.png +0 -0
  82. /data/{images → lib/sinatra/images}/500.png +0 -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,189 @@
1
+ = 0.9.0 / 2009-01-18
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
+ * Parameters with subscripts are now parsed into a nested/recursive
12
+ Hash structure. e.g., "post[title]=Hello&post[body]=World" yields
13
+ params: {'post' => {'title' => 'Hello', 'body' => 'World'}}.
14
+
15
+ * Regular expressions may now be used in route pattens; captures are
16
+ available at "params[:captures]".
17
+
18
+ * New ":provides" route condition takes an array of mime types and
19
+ matches only when an Accept request header is present with a
20
+ corresponding type. [cypher]
21
+
22
+ * New request-level "pass" method; immediately exits the current block
23
+ and passes control to the next matching route.
24
+
25
+ * The request-level "body" method now takes a block; evaluation is
26
+ deferred until an attempt is made to read the body. The block must
27
+ return a String or Array.
28
+
29
+ * New "route conditions" system for attaching rules for when a route
30
+ matches. The :agent and :host route options now use this system.
31
+
32
+ * New "dump_errors" option controls whether the backtrace is dumped to
33
+ rack.errors when an exception is raised from a route. The option is
34
+ enabled by default for top-level apps.
35
+
36
+ * Better default "app_file", "root", "public", and "views" location
37
+ detection; changes to "root" and "app_file" automatically cascade to
38
+ other options that depend on them.
39
+
40
+ * Error mappings are now split into two distinct layers: exception
41
+ mappings and custom error pages. Exception mappings are registered
42
+ with "error(Exception)" and are run only when the app raises an
43
+ exception. Custom error pages are registered with "error(status_code)",
44
+ where "status_code" is an integer, and are run any time the response
45
+ has the status code specified. It's also possible to register an error
46
+ page for a range of status codes: "error(500..599)".
47
+
48
+ * In-file templates are now automatically imported from the file that
49
+ requires 'sinatra'. The use_in_file_templates! method is still available
50
+ for loading templates from other files.
51
+
52
+ * Sinatra's testing support is no longer dependent on Test::Unit. Requiring
53
+ 'sinatra/test' adds the Sinatra::Test module and Sinatra::TestHarness
54
+ class, which can be used with any test framework. The 'sinatra/test/unit',
55
+ 'sinatra/test/spec', 'sinatra/test/rspec', or 'sinatra/test/bacon' files
56
+ can be required to setup a framework-specific testing environment. See the
57
+ README for more information.
58
+
59
+ * Added support for Bacon (test framework). The 'sinatra/test/bacon' file
60
+ can be required to setup Sinatra test helpers on Bacon::Context.
61
+
62
+ * Deprecated "set_option" and "set_options"; use "set" instead.
63
+
64
+ * Deprecated the "env" option ("options.env"); use "environment" instead.
65
+
66
+ * Deprecated the request level "stop" method; use "halt" instead.
67
+
68
+ * Deprecated the request level "entity_tag" method; use "etag" instead.
69
+ Both "entity_tag" and "etag" were previously supported.
70
+
71
+ * Deprecated the request level "headers" method (HTTP response headers);
72
+ use "response['Header-Name']" instead.
73
+
74
+ * Deprecated "Sinatra.application"; use "Sinatra::Application" instead.
75
+
76
+ * Deprecated setting Sinatra.application = nil to reset an application.
77
+ This should no longer be necessary.
78
+
79
+ * Deprecated "Sinatra.default_options"; use
80
+ "Sinatra::Default.set(key, value)" instead.
81
+
82
+ * Deprecated the "ServerError" exception. All Exceptions are now
83
+ treated as internal server errors and result in a 500 response
84
+ status.
85
+
86
+ * Deprecated the "get_it", "post_it", "put_it", "delete_it", and "head_it"
87
+ test helper methods. Use "get", "post", "put", "delete", and "head",
88
+ respectively, instead.
89
+
90
+ * Removed Event and EventContext classes. Applications are defined in a
91
+ subclass of Sinatra::Base; each request is processed within an
92
+ instance.
93
+
94
+ = 0.3.3 / 2009-01-06
95
+
96
+ * Pin to Rack 0.4.0 (this is the last release on Rack 0.4)
97
+
98
+ * Log unhandled exception backtraces to rack.errors.
99
+
100
+ * Use RACK_ENV environment variable to establish Sinatra
101
+ environment when given. Thin sets this when started with
102
+ the -e argument.
103
+
104
+ * BUG: raising Sinatra::NotFound resulted in a 500 response
105
+ code instead of 404.
106
+
107
+ * BUG: use_in_file_templates! fails with CR/LF (#45)
108
+
109
+ * BUG: Sinatra detects the app file and root path when run under
110
+ thin/passenger.
111
+
112
+ = 0.3.2
113
+
114
+ * BUG: Static and send_file read entire file into String before
115
+ sending. Updated to stream with 8K chunks instead.
116
+
117
+ * Rake tasks and assets for building basic documentation website.
118
+ See http://sinatra.rubyforge.org
119
+
120
+ * Various minor doc fixes.
121
+
122
+ = 0.3.1
123
+
124
+ * Unbreak optional path parameters [jeremyevans]
125
+
126
+ = 0.3.0
127
+
128
+ * Add sinatra.gemspec w/ support for github gem builds. Forks can now
129
+ enable the build gem option in github to get free username-sinatra.gem
130
+ builds: gem install username-sinatra.gem --source=http://gems.github.com/
131
+
132
+ * Require rack-0.4 gem; removes frozen rack dir.
133
+
134
+ * Basic RSpec support; require 'sinatra/test/rspec' instead of
135
+ 'sinatra/test/spec' to use. [avdi]
136
+
137
+ * before filters can modify request environment vars used for
138
+ routing (e.g., PATH_INFO, REQUEST_METHOD, etc.) for URL rewriting
139
+ type functionality.
140
+
141
+ * In-file templates now uses @@ instead of ## as template separator.
142
+
143
+ * Top-level environment test predicates: development?, test?, production?
144
+
145
+ * Top-level "set", "enable", and "disable" methods for tweaking
146
+ app options. [rtomayko]
147
+
148
+ * Top-level "use" method for building Rack middleware pipelines
149
+ leading to app. See README for usage. [rtomayko]
150
+
151
+ * New "reload" option - set false to disable reloading in development.
152
+
153
+ * New "host" option - host/ip to bind to [cschneid]
154
+
155
+ * New "app_file" option - override the file to reload in development
156
+ mode [cschneid]
157
+
158
+ * Development error/not_found page cleanup [sr, adamwiggins]
159
+
160
+ * Remove a bunch of core extensions (String#to_param, String#from_param,
161
+ Hash#from_params, Hash#to_params, Hash#symbolize_keys, Hash#pass)
162
+
163
+ * Various grammar and formatting fixes to README; additions on
164
+ community and contributing [cypher]
165
+
166
+ * Build RDoc using Hanna template: http://sinatrarb.rubyforge.org/api
167
+
168
+ * Specs, documentation and fixes for splat'n routes [vic]
169
+
170
+ * Fix whitespace errors across all source files. [rtomayko]
171
+
172
+ * Fix streaming issues with Mongrel (body not closed). [bmizerany]
173
+
174
+ * Fix various issues with environment not being set properly (configure
175
+ blocks not running, error pages not registering, etc.) [cypher]
176
+
177
+ * Fix to allow locals to be passed to ERB templates [cschneid]
178
+
179
+ * Fix locking issues causing random errors during reload in development.
180
+
181
+ * Fix for escaped paths not resolving static files [Matthew Walker]
182
+
183
+ = 0.2.1
184
+
185
+ * File upload fix and minor tweaks.
186
+
187
+ = 0.2.0
188
+
189
+ * Initial gem release of 0.2 codebase.