roda 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +42 -0
  3. data/README.rdoc +73 -144
  4. data/doc/conventions.rdoc +10 -8
  5. data/doc/release_notes/1.3.0.txt +109 -0
  6. data/lib/roda.rb +67 -100
  7. data/lib/roda/plugins/assets.rb +4 -4
  8. data/lib/roda/plugins/chunked.rb +4 -1
  9. data/lib/roda/plugins/class_level_routing.rb +7 -1
  10. data/lib/roda/plugins/cookies.rb +34 -0
  11. data/lib/roda/plugins/default_headers.rb +7 -6
  12. data/lib/roda/plugins/delegate.rb +8 -1
  13. data/lib/roda/plugins/delete_empty_headers.rb +33 -0
  14. data/lib/roda/plugins/delete_nil_headers.rb +34 -0
  15. data/lib/roda/plugins/environments.rb +12 -4
  16. data/lib/roda/plugins/error_email.rb +6 -1
  17. data/lib/roda/plugins/error_handler.rb +7 -4
  18. data/lib/roda/plugins/hash_matcher.rb +32 -0
  19. data/lib/roda/plugins/header_matchers.rb +12 -2
  20. data/lib/roda/plugins/json.rb +9 -6
  21. data/lib/roda/plugins/module_include.rb +92 -0
  22. data/lib/roda/plugins/multi_route.rb +7 -0
  23. data/lib/roda/plugins/multi_run.rb +11 -5
  24. data/lib/roda/plugins/named_templates.rb +7 -1
  25. data/lib/roda/plugins/not_found.rb +6 -0
  26. data/lib/roda/plugins/param_matchers.rb +43 -0
  27. data/lib/roda/plugins/path_matchers.rb +51 -0
  28. data/lib/roda/plugins/render.rb +32 -14
  29. data/lib/roda/plugins/static_path_info.rb +10 -3
  30. data/lib/roda/plugins/symbol_matchers.rb +1 -1
  31. data/lib/roda/version.rb +13 -1
  32. data/spec/freeze_spec.rb +28 -0
  33. data/spec/plugin/class_level_routing_spec.rb +26 -0
  34. data/spec/plugin/content_for_spec.rb +1 -2
  35. data/spec/plugin/cookies_spec.rb +25 -0
  36. data/spec/plugin/default_headers_spec.rb +4 -7
  37. data/spec/plugin/delegate_spec.rb +4 -1
  38. data/spec/plugin/delete_empty_headers_spec.rb +15 -0
  39. data/spec/plugin/error_handler_spec.rb +31 -0
  40. data/spec/plugin/hash_matcher_spec.rb +27 -0
  41. data/spec/plugin/header_matchers_spec.rb +15 -0
  42. data/spec/plugin/json_spec.rb +1 -2
  43. data/spec/plugin/mailer_spec.rb +2 -2
  44. data/spec/plugin/module_include_spec.rb +31 -0
  45. data/spec/plugin/multi_route_spec.rb +14 -0
  46. data/spec/plugin/multi_run_spec.rb +41 -0
  47. data/spec/plugin/named_templates_spec.rb +25 -0
  48. data/spec/plugin/not_found_spec.rb +29 -0
  49. data/spec/plugin/param_matchers_spec.rb +37 -0
  50. data/spec/plugin/path_matchers_spec.rb +42 -0
  51. data/spec/plugin/render_spec.rb +33 -8
  52. data/spec/plugin/static_path_info_spec.rb +6 -0
  53. data/spec/plugin/view_subdirs_spec.rb +1 -2
  54. data/spec/response_spec.rb +12 -0
  55. data/spec/spec_helper.rb +2 -0
  56. data/spec/version_spec.rb +8 -2
  57. metadata +19 -3
@@ -35,6 +35,12 @@ describe "static_path_info plugin" do
35
35
  app(:static_path_info){|r| r.on("a"){r.run a}}
36
36
  body("/a/b").should == "/a|/b"
37
37
  end
38
+
39
+ it "restores SCRIPT_NAME/PATH_INFO before returning from run" do
40
+ a = app{|r| "#{r.script_name}|#{r.path_info}"}
41
+ app(:static_path_info){|r| s = catch(:halt){r.on("a"){r.run a}}; "#{s[2].join}%#{r.script_name}|#{r.path_info}"}
42
+ body("/a/b").should == "/a|/b%|/a/b"
43
+ end
38
44
  end
39
45
 
40
46
  describe "static_path_info request.path, .remaining_path, and .matched_path" do
@@ -8,8 +8,7 @@ else
8
8
  describe "view_subdirs plugin" do
9
9
  before do
10
10
  app(:bare) do
11
- plugin :render
12
- render_opts[:views] = "./spec"
11
+ plugin :render, :views=>"./spec"
13
12
  plugin :view_subdirs
14
13
 
15
14
  route do |r|
@@ -36,6 +36,18 @@ describe "response #[] and #[]=" do
36
36
  end
37
37
  end
38
38
 
39
+ describe "response #headers and #body" do
40
+ it "should return headers and body" do
41
+ app do |r|
42
+ response.headers['foo'] = 'bar'
43
+ response.write response.body.is_a?(Array)
44
+ end
45
+
46
+ header('foo').should == "bar"
47
+ body.should == 'true'
48
+ end
49
+ end
50
+
39
51
  describe "response #write" do
40
52
  it "should add to body" do
41
53
  app do |r|
data/spec/spec_helper.rb CHANGED
@@ -41,6 +41,8 @@ unless defined?(RSPEC_EXAMPLE_GROUP)
41
41
  end
42
42
  end
43
43
 
44
+ #def (Roda::RodaPlugins).warn(s); end
45
+
44
46
  class RSPEC_EXAMPLE_GROUP
45
47
  def app(type=nil, &block)
46
48
  case type
data/spec/version_spec.rb CHANGED
@@ -1,8 +1,14 @@
1
1
  require File.expand_path("spec_helper", File.dirname(__FILE__))
2
2
 
3
- describe "Roda::RodaVersion" do
4
- it "should be a string in x.y.z integer format" do
3
+ describe "Roda version constants" do
4
+ it "RodaVersion should be a string in x.y.z integer format" do
5
5
  Roda::RodaVersion.should =~ /\A\d+\.\d+\.\d+\z/
6
6
  end
7
+
8
+ it "Roda*Version should be integers" do
9
+ Roda::RodaMajorVersion.should be_a_kind_of(Integer)
10
+ Roda::RodaMinorVersion.should be_a_kind_of(Integer)
11
+ Roda::RodaPatchVersion.should be_a_kind_of(Integer)
12
+ end
7
13
  end
8
14
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roda
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Evans
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-17 00:00:00.000000000 Z
11
+ date: 2015-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -135,6 +135,7 @@ extra_rdoc_files:
135
135
  - doc/release_notes/1.0.0.txt
136
136
  - doc/release_notes/1.1.0.txt
137
137
  - doc/release_notes/1.2.0.txt
138
+ - doc/release_notes/1.3.0.txt
138
139
  files:
139
140
  - CHANGELOG
140
141
  - MIT-LICENSE
@@ -144,6 +145,7 @@ files:
144
145
  - doc/release_notes/1.0.0.txt
145
146
  - doc/release_notes/1.1.0.txt
146
147
  - doc/release_notes/1.2.0.txt
148
+ - doc/release_notes/1.3.0.txt
147
149
  - lib/roda.rb
148
150
  - lib/roda/plugins/_erubis_escaping.rb
149
151
  - lib/roda/plugins/all_verbs.rb
@@ -153,10 +155,13 @@ files:
153
155
  - lib/roda/plugins/chunked.rb
154
156
  - lib/roda/plugins/class_level_routing.rb
155
157
  - lib/roda/plugins/content_for.rb
158
+ - lib/roda/plugins/cookies.rb
156
159
  - lib/roda/plugins/csrf.rb
157
160
  - lib/roda/plugins/default_headers.rb
158
161
  - lib/roda/plugins/delay_build.rb
159
162
  - lib/roda/plugins/delegate.rb
163
+ - lib/roda/plugins/delete_empty_headers.rb
164
+ - lib/roda/plugins/delete_nil_headers.rb
160
165
  - lib/roda/plugins/drop_body.rb
161
166
  - lib/roda/plugins/empty_root.rb
162
167
  - lib/roda/plugins/environments.rb
@@ -165,6 +170,7 @@ files:
165
170
  - lib/roda/plugins/flash.rb
166
171
  - lib/roda/plugins/h.rb
167
172
  - lib/roda/plugins/halt.rb
173
+ - lib/roda/plugins/hash_matcher.rb
168
174
  - lib/roda/plugins/head.rb
169
175
  - lib/roda/plugins/header_matchers.rb
170
176
  - lib/roda/plugins/hooks.rb
@@ -173,13 +179,16 @@ files:
173
179
  - lib/roda/plugins/mailer.rb
174
180
  - lib/roda/plugins/match_affix.rb
175
181
  - lib/roda/plugins/middleware.rb
182
+ - lib/roda/plugins/module_include.rb
176
183
  - lib/roda/plugins/multi_route.rb
177
184
  - lib/roda/plugins/multi_run.rb
178
185
  - lib/roda/plugins/named_templates.rb
179
186
  - lib/roda/plugins/not_allowed.rb
180
187
  - lib/roda/plugins/not_found.rb
188
+ - lib/roda/plugins/param_matchers.rb
181
189
  - lib/roda/plugins/pass.rb
182
190
  - lib/roda/plugins/path.rb
191
+ - lib/roda/plugins/path_matchers.rb
183
192
  - lib/roda/plugins/per_thread_caching.rb
184
193
  - lib/roda/plugins/render.rb
185
194
  - lib/roda/plugins/render_each.rb
@@ -197,6 +206,7 @@ files:
197
206
  - spec/assets/js/head/app.js
198
207
  - spec/composition_spec.rb
199
208
  - spec/env_spec.rb
209
+ - spec/freeze_spec.rb
200
210
  - spec/integration_spec.rb
201
211
  - spec/matchers_spec.rb
202
212
  - spec/module_spec.rb
@@ -209,10 +219,12 @@ files:
209
219
  - spec/plugin/chunked_spec.rb
210
220
  - spec/plugin/class_level_routing_spec.rb
211
221
  - spec/plugin/content_for_spec.rb
222
+ - spec/plugin/cookies_spec.rb
212
223
  - spec/plugin/csrf_spec.rb
213
224
  - spec/plugin/default_headers_spec.rb
214
225
  - spec/plugin/delay_build_spec.rb
215
226
  - spec/plugin/delegate_spec.rb
227
+ - spec/plugin/delete_empty_headers_spec.rb
216
228
  - spec/plugin/drop_body_spec.rb
217
229
  - spec/plugin/empty_root_spec.rb
218
230
  - spec/plugin/environments_spec.rb
@@ -221,6 +233,7 @@ files:
221
233
  - spec/plugin/flash_spec.rb
222
234
  - spec/plugin/h_spec.rb
223
235
  - spec/plugin/halt_spec.rb
236
+ - spec/plugin/hash_matcher_spec.rb
224
237
  - spec/plugin/head_spec.rb
225
238
  - spec/plugin/header_matchers_spec.rb
226
239
  - spec/plugin/hooks_spec.rb
@@ -229,12 +242,15 @@ files:
229
242
  - spec/plugin/mailer_spec.rb
230
243
  - spec/plugin/match_affix_spec.rb
231
244
  - spec/plugin/middleware_spec.rb
245
+ - spec/plugin/module_include_spec.rb
232
246
  - spec/plugin/multi_route_spec.rb
233
247
  - spec/plugin/multi_run_spec.rb
234
248
  - spec/plugin/named_templates_spec.rb
235
249
  - spec/plugin/not_allowed_spec.rb
236
250
  - spec/plugin/not_found_spec.rb
251
+ - spec/plugin/param_matchers_spec.rb
237
252
  - spec/plugin/pass_spec.rb
253
+ - spec/plugin/path_matchers_spec.rb
238
254
  - spec/plugin/path_spec.rb
239
255
  - spec/plugin/per_thread_caching_spec.rb
240
256
  - spec/plugin/render_each_spec.rb
@@ -282,7 +298,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
282
298
  version: '0'
283
299
  requirements: []
284
300
  rubyforge_project:
285
- rubygems_version: 2.4.4
301
+ rubygems_version: 2.4.5
286
302
  signing_key:
287
303
  specification_version: 4
288
304
  summary: Routing tree web framework toolkit