roda 3.28.0 → 3.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (208) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +40 -0
  3. data/README.rdoc +15 -1
  4. data/doc/conventions.rdoc +17 -8
  5. data/doc/release_notes/3.29.0.txt +15 -0
  6. data/doc/release_notes/3.30.0.txt +14 -0
  7. data/doc/release_notes/3.31.0.txt +11 -0
  8. data/doc/release_notes/3.32.0.txt +42 -0
  9. data/doc/release_notes/3.33.0.txt +8 -0
  10. data/lib/roda.rb +3 -0
  11. data/lib/roda/plugins/_symbol_regexp_matchers.rb +2 -0
  12. data/lib/roda/plugins/assets.rb +26 -5
  13. data/lib/roda/plugins/caching.rb +2 -0
  14. data/lib/roda/plugins/common_logger.rb +1 -1
  15. data/lib/roda/plugins/content_security_policy.rb +2 -0
  16. data/lib/roda/plugins/default_headers.rb +2 -0
  17. data/lib/roda/plugins/exception_page.rb +9 -5
  18. data/lib/roda/plugins/hash_matcher.rb +1 -1
  19. data/lib/roda/plugins/header_matchers.rb +5 -1
  20. data/lib/roda/plugins/indifferent_params.rb +4 -0
  21. data/lib/roda/plugins/partials.rb +33 -6
  22. data/lib/roda/plugins/path.rb +42 -15
  23. data/lib/roda/plugins/placeholder_string_matchers.rb +2 -0
  24. data/lib/roda/plugins/public.rb +25 -17
  25. data/lib/roda/plugins/relative_path.rb +73 -0
  26. data/lib/roda/plugins/render.rb +17 -5
  27. data/lib/roda/plugins/render_each.rb +11 -3
  28. data/lib/roda/plugins/run_append_slash.rb +1 -1
  29. data/lib/roda/plugins/symbol_matchers.rb +2 -2
  30. data/lib/roda/version.rb +1 -1
  31. metadata +13 -214
  32. data/Rakefile +0 -108
  33. data/doc/release_notes/1.0.0.txt +0 -329
  34. data/doc/release_notes/1.1.0.txt +0 -226
  35. data/doc/release_notes/1.2.0.txt +0 -406
  36. data/doc/release_notes/1.3.0.txt +0 -109
  37. data/doc/release_notes/2.0.0.txt +0 -75
  38. data/doc/release_notes/2.1.0.txt +0 -124
  39. data/doc/release_notes/2.10.0.txt +0 -27
  40. data/doc/release_notes/2.11.0.txt +0 -70
  41. data/doc/release_notes/2.12.0.txt +0 -40
  42. data/doc/release_notes/2.13.0.txt +0 -10
  43. data/doc/release_notes/2.14.0.txt +0 -44
  44. data/doc/release_notes/2.15.0.txt +0 -53
  45. data/doc/release_notes/2.16.0.txt +0 -48
  46. data/doc/release_notes/2.17.0.txt +0 -62
  47. data/doc/release_notes/2.18.0.txt +0 -69
  48. data/doc/release_notes/2.19.0.txt +0 -30
  49. data/doc/release_notes/2.2.0.txt +0 -97
  50. data/doc/release_notes/2.20.0.txt +0 -5
  51. data/doc/release_notes/2.21.0.txt +0 -17
  52. data/doc/release_notes/2.22.0.txt +0 -41
  53. data/doc/release_notes/2.23.0.txt +0 -29
  54. data/doc/release_notes/2.24.0.txt +0 -65
  55. data/doc/release_notes/2.25.0.txt +0 -14
  56. data/doc/release_notes/2.26.0.txt +0 -13
  57. data/doc/release_notes/2.27.0.txt +0 -56
  58. data/doc/release_notes/2.28.0.txt +0 -17
  59. data/doc/release_notes/2.29.0.txt +0 -156
  60. data/doc/release_notes/2.3.0.txt +0 -109
  61. data/doc/release_notes/2.4.0.txt +0 -55
  62. data/doc/release_notes/2.5.0.txt +0 -23
  63. data/doc/release_notes/2.5.1.txt +0 -4
  64. data/doc/release_notes/2.6.0.txt +0 -21
  65. data/doc/release_notes/2.7.0.txt +0 -75
  66. data/doc/release_notes/2.8.0.txt +0 -44
  67. data/doc/release_notes/2.9.0.txt +0 -6
  68. data/spec/all.rb +0 -1
  69. data/spec/assets/css/app.scss +0 -1
  70. data/spec/assets/css/no_access.css +0 -1
  71. data/spec/assets/css/raw.css +0 -1
  72. data/spec/assets/js/head/app.js +0 -1
  73. data/spec/composition_spec.rb +0 -31
  74. data/spec/define_roda_method_spec.rb +0 -274
  75. data/spec/env_spec.rb +0 -11
  76. data/spec/freeze_spec.rb +0 -37
  77. data/spec/integration_spec.rb +0 -209
  78. data/spec/matchers_spec.rb +0 -832
  79. data/spec/opts_spec.rb +0 -42
  80. data/spec/plugin/_after_hook_spec.rb +0 -19
  81. data/spec/plugin/all_verbs_spec.rb +0 -29
  82. data/spec/plugin/assets_preloading_spec.rb +0 -98
  83. data/spec/plugin/assets_spec.rb +0 -745
  84. data/spec/plugin/backtracking_array_spec.rb +0 -42
  85. data/spec/plugin/branch_locals_spec.rb +0 -106
  86. data/spec/plugin/caching_spec.rb +0 -337
  87. data/spec/plugin/chunked_spec.rb +0 -201
  88. data/spec/plugin/class_level_routing_spec.rb +0 -164
  89. data/spec/plugin/class_matchers_spec.rb +0 -40
  90. data/spec/plugin/common_logger_spec.rb +0 -85
  91. data/spec/plugin/content_for_spec.rb +0 -162
  92. data/spec/plugin/content_security_policy_spec.rb +0 -175
  93. data/spec/plugin/cookies_spec.rb +0 -51
  94. data/spec/plugin/csrf_spec.rb +0 -111
  95. data/spec/plugin/default_headers_spec.rb +0 -82
  96. data/spec/plugin/default_status_spec.rb +0 -95
  97. data/spec/plugin/delay_build_spec.rb +0 -23
  98. data/spec/plugin/delegate_spec.rb +0 -23
  99. data/spec/plugin/delete_empty_headers_spec.rb +0 -27
  100. data/spec/plugin/direct_call_spec.rb +0 -28
  101. data/spec/plugin/disallow_file_uploads_spec.rb +0 -25
  102. data/spec/plugin/drop_body_spec.rb +0 -24
  103. data/spec/plugin/early_hints_spec.rb +0 -19
  104. data/spec/plugin/empty_root_spec.rb +0 -14
  105. data/spec/plugin/environments_spec.rb +0 -42
  106. data/spec/plugin/error_email_spec.rb +0 -97
  107. data/spec/plugin/error_handler_spec.rb +0 -216
  108. data/spec/plugin/error_mail_spec.rb +0 -93
  109. data/spec/plugin/exception_page_spec.rb +0 -168
  110. data/spec/plugin/flash_spec.rb +0 -121
  111. data/spec/plugin/h_spec.rb +0 -11
  112. data/spec/plugin/halt_spec.rb +0 -119
  113. data/spec/plugin/hash_matcher_spec.rb +0 -27
  114. data/spec/plugin/hash_routes_spec.rb +0 -535
  115. data/spec/plugin/head_spec.rb +0 -52
  116. data/spec/plugin/header_matchers_spec.rb +0 -98
  117. data/spec/plugin/heartbeat_spec.rb +0 -74
  118. data/spec/plugin/hooks_spec.rb +0 -152
  119. data/spec/plugin/indifferent_params_spec.rb +0 -14
  120. data/spec/plugin/json_parser_spec.rb +0 -141
  121. data/spec/plugin/json_spec.rb +0 -83
  122. data/spec/plugin/mail_processor_spec.rb +0 -451
  123. data/spec/plugin/mailer_spec.rb +0 -282
  124. data/spec/plugin/match_affix_spec.rb +0 -43
  125. data/spec/plugin/match_hook_spec.rb +0 -79
  126. data/spec/plugin/middleware_spec.rb +0 -237
  127. data/spec/plugin/middleware_stack_spec.rb +0 -81
  128. data/spec/plugin/module_include_spec.rb +0 -48
  129. data/spec/plugin/multi_route_spec.rb +0 -268
  130. data/spec/plugin/multi_run_spec.rb +0 -87
  131. data/spec/plugin/multi_view_spec.rb +0 -50
  132. data/spec/plugin/multibyte_string_matcher_spec.rb +0 -44
  133. data/spec/plugin/named_templates_spec.rb +0 -96
  134. data/spec/plugin/not_allowed_spec.rb +0 -69
  135. data/spec/plugin/not_found_spec.rb +0 -128
  136. data/spec/plugin/optimized_string_matchers_spec.rb +0 -43
  137. data/spec/plugin/padrino_render_spec.rb +0 -34
  138. data/spec/plugin/param_matchers_spec.rb +0 -69
  139. data/spec/plugin/params_capturing_spec.rb +0 -33
  140. data/spec/plugin/partials_spec.rb +0 -43
  141. data/spec/plugin/pass_spec.rb +0 -29
  142. data/spec/plugin/path_matchers_spec.rb +0 -42
  143. data/spec/plugin/path_rewriter_spec.rb +0 -45
  144. data/spec/plugin/path_spec.rb +0 -222
  145. data/spec/plugin/placeholder_string_matchers_spec.rb +0 -126
  146. data/spec/plugin/precompile_templates_spec.rb +0 -61
  147. data/spec/plugin/public_spec.rb +0 -85
  148. data/spec/plugin/render_each_spec.rb +0 -82
  149. data/spec/plugin/render_locals_spec.rb +0 -114
  150. data/spec/plugin/render_spec.rb +0 -912
  151. data/spec/plugin/request_aref_spec.rb +0 -51
  152. data/spec/plugin/request_headers_spec.rb +0 -39
  153. data/spec/plugin/response_request_spec.rb +0 -43
  154. data/spec/plugin/route_block_args_spec.rb +0 -86
  155. data/spec/plugin/route_csrf_spec.rb +0 -305
  156. data/spec/plugin/run_append_slash_spec.rb +0 -77
  157. data/spec/plugin/run_handler_spec.rb +0 -53
  158. data/spec/plugin/sessions_spec.rb +0 -452
  159. data/spec/plugin/shared_vars_spec.rb +0 -45
  160. data/spec/plugin/sinatra_helpers_spec.rb +0 -537
  161. data/spec/plugin/slash_path_empty_spec.rb +0 -22
  162. data/spec/plugin/static_routing_spec.rb +0 -192
  163. data/spec/plugin/static_spec.rb +0 -30
  164. data/spec/plugin/status_303_spec.rb +0 -28
  165. data/spec/plugin/status_handler_spec.rb +0 -158
  166. data/spec/plugin/streaming_spec.rb +0 -246
  167. data/spec/plugin/strip_path_prefix_spec.rb +0 -24
  168. data/spec/plugin/symbol_matchers_spec.rb +0 -51
  169. data/spec/plugin/symbol_status_spec.rb +0 -25
  170. data/spec/plugin/symbol_views_spec.rb +0 -32
  171. data/spec/plugin/timestamp_public_spec.rb +0 -85
  172. data/spec/plugin/type_routing_spec.rb +0 -348
  173. data/spec/plugin/typecast_params_spec.rb +0 -1370
  174. data/spec/plugin/unescape_path_spec.rb +0 -22
  175. data/spec/plugin/view_options_spec.rb +0 -170
  176. data/spec/plugin_spec.rb +0 -71
  177. data/spec/redirect_spec.rb +0 -41
  178. data/spec/request_spec.rb +0 -97
  179. data/spec/response_spec.rb +0 -199
  180. data/spec/route_spec.rb +0 -39
  181. data/spec/session_middleware_spec.rb +0 -129
  182. data/spec/session_spec.rb +0 -37
  183. data/spec/spec_helper.rb +0 -137
  184. data/spec/version_spec.rb +0 -14
  185. data/spec/views/_test.erb +0 -1
  186. data/spec/views/a.erb +0 -1
  187. data/spec/views/a.rdoc +0 -2
  188. data/spec/views/about.erb +0 -1
  189. data/spec/views/about.str +0 -1
  190. data/spec/views/about/_test.css.gz +0 -0
  191. data/spec/views/about/_test.erb +0 -1
  192. data/spec/views/about/_test.erb.gz +0 -0
  193. data/spec/views/about/comp_test.erb +0 -1
  194. data/spec/views/b.erb +0 -1
  195. data/spec/views/c.erb +0 -1
  196. data/spec/views/comp_layout.erb +0 -1
  197. data/spec/views/comp_test.erb +0 -1
  198. data/spec/views/content-yield.erb +0 -1
  199. data/spec/views/each.str +0 -1
  200. data/spec/views/home.erb +0 -2
  201. data/spec/views/home.str +0 -2
  202. data/spec/views/iv.erb +0 -1
  203. data/spec/views/layout-alternative.erb +0 -2
  204. data/spec/views/layout-yield.erb +0 -3
  205. data/spec/views/layout.erb +0 -2
  206. data/spec/views/layout.str +0 -2
  207. data/spec/views/multiple-layout.erb +0 -1
  208. data/spec/views/multiple.erb +0 -1
@@ -33,7 +33,7 @@ class Roda
33
33
  # does not contain a trailing slash, a trailing slash is appended to the
34
34
  # path internally, or a redirect is issued when configured with
35
35
  # <tt>use_redirects: true</tt>.
36
- def run(app)
36
+ def run(*)
37
37
  if remaining_path.empty?
38
38
  if scope.opts[:run_append_slash_redirect]
39
39
  redirect("#{path}/")
@@ -6,7 +6,7 @@ class Roda
6
6
  # The symbol_matchers plugin allows you do define custom regexps to use
7
7
  # for specific symbols. For example, if you have a route such as:
8
8
  #
9
- # r.on :username do
9
+ # r.on :username do |username|
10
10
  # # ...
11
11
  # end
12
12
  #
@@ -28,7 +28,7 @@ class Roda
28
28
  # If the placeholder_string_matchers plugin is loaded, this feature also applies to
29
29
  # placeholders in strings, so the following:
30
30
  #
31
- # r.on "users/:username" do
31
+ # r.on "users/:username" do |username|
32
32
  # # ...
33
33
  # end
34
34
  #
@@ -4,7 +4,7 @@ class Roda
4
4
  RodaMajorVersion = 3
5
5
 
6
6
  # The minor version of Roda, updated for new feature releases of Roda.
7
- RodaMinorVersion = 28
7
+ RodaMinorVersion = 33
8
8
 
9
9
  # The patch version of Roda, updated only for bug fixes from the last
10
10
  # feature release.
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: 3.28.0
4
+ version: 3.33.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: 2020-01-15 00:00:00.000000000 Z
11
+ date: 2020-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -175,41 +175,6 @@ extra_rdoc_files:
175
175
  - CHANGELOG
176
176
  - doc/conventions.rdoc
177
177
  - doc/release_notes/3.7.0.txt
178
- - doc/release_notes/1.0.0.txt
179
- - doc/release_notes/1.1.0.txt
180
- - doc/release_notes/1.2.0.txt
181
- - doc/release_notes/1.3.0.txt
182
- - doc/release_notes/2.0.0.txt
183
- - doc/release_notes/2.1.0.txt
184
- - doc/release_notes/2.10.0.txt
185
- - doc/release_notes/2.11.0.txt
186
- - doc/release_notes/2.12.0.txt
187
- - doc/release_notes/2.13.0.txt
188
- - doc/release_notes/2.14.0.txt
189
- - doc/release_notes/2.15.0.txt
190
- - doc/release_notes/2.16.0.txt
191
- - doc/release_notes/2.17.0.txt
192
- - doc/release_notes/2.18.0.txt
193
- - doc/release_notes/2.19.0.txt
194
- - doc/release_notes/2.2.0.txt
195
- - doc/release_notes/2.20.0.txt
196
- - doc/release_notes/2.21.0.txt
197
- - doc/release_notes/2.22.0.txt
198
- - doc/release_notes/2.23.0.txt
199
- - doc/release_notes/2.24.0.txt
200
- - doc/release_notes/2.25.0.txt
201
- - doc/release_notes/2.26.0.txt
202
- - doc/release_notes/2.27.0.txt
203
- - doc/release_notes/2.28.0.txt
204
- - doc/release_notes/2.29.0.txt
205
- - doc/release_notes/2.3.0.txt
206
- - doc/release_notes/2.4.0.txt
207
- - doc/release_notes/2.5.0.txt
208
- - doc/release_notes/2.5.1.txt
209
- - doc/release_notes/2.6.0.txt
210
- - doc/release_notes/2.7.0.txt
211
- - doc/release_notes/2.8.0.txt
212
- - doc/release_notes/2.9.0.txt
213
178
  - doc/release_notes/3.0.0.txt
214
179
  - doc/release_notes/3.1.0.txt
215
180
  - doc/release_notes/3.2.0.txt
@@ -239,47 +204,16 @@ extra_rdoc_files:
239
204
  - doc/release_notes/3.26.0.txt
240
205
  - doc/release_notes/3.27.0.txt
241
206
  - doc/release_notes/3.28.0.txt
207
+ - doc/release_notes/3.29.0.txt
208
+ - doc/release_notes/3.30.0.txt
209
+ - doc/release_notes/3.31.0.txt
210
+ - doc/release_notes/3.32.0.txt
211
+ - doc/release_notes/3.33.0.txt
242
212
  files:
243
213
  - CHANGELOG
244
214
  - MIT-LICENSE
245
215
  - README.rdoc
246
- - Rakefile
247
216
  - doc/conventions.rdoc
248
- - doc/release_notes/1.0.0.txt
249
- - doc/release_notes/1.1.0.txt
250
- - doc/release_notes/1.2.0.txt
251
- - doc/release_notes/1.3.0.txt
252
- - doc/release_notes/2.0.0.txt
253
- - doc/release_notes/2.1.0.txt
254
- - doc/release_notes/2.10.0.txt
255
- - doc/release_notes/2.11.0.txt
256
- - doc/release_notes/2.12.0.txt
257
- - doc/release_notes/2.13.0.txt
258
- - doc/release_notes/2.14.0.txt
259
- - doc/release_notes/2.15.0.txt
260
- - doc/release_notes/2.16.0.txt
261
- - doc/release_notes/2.17.0.txt
262
- - doc/release_notes/2.18.0.txt
263
- - doc/release_notes/2.19.0.txt
264
- - doc/release_notes/2.2.0.txt
265
- - doc/release_notes/2.20.0.txt
266
- - doc/release_notes/2.21.0.txt
267
- - doc/release_notes/2.22.0.txt
268
- - doc/release_notes/2.23.0.txt
269
- - doc/release_notes/2.24.0.txt
270
- - doc/release_notes/2.25.0.txt
271
- - doc/release_notes/2.26.0.txt
272
- - doc/release_notes/2.27.0.txt
273
- - doc/release_notes/2.28.0.txt
274
- - doc/release_notes/2.29.0.txt
275
- - doc/release_notes/2.3.0.txt
276
- - doc/release_notes/2.4.0.txt
277
- - doc/release_notes/2.5.0.txt
278
- - doc/release_notes/2.5.1.txt
279
- - doc/release_notes/2.6.0.txt
280
- - doc/release_notes/2.7.0.txt
281
- - doc/release_notes/2.8.0.txt
282
- - doc/release_notes/2.9.0.txt
283
217
  - doc/release_notes/3.0.0.txt
284
218
  - doc/release_notes/3.1.0.txt
285
219
  - doc/release_notes/3.10.0.txt
@@ -303,7 +237,12 @@ files:
303
237
  - doc/release_notes/3.26.0.txt
304
238
  - doc/release_notes/3.27.0.txt
305
239
  - doc/release_notes/3.28.0.txt
240
+ - doc/release_notes/3.29.0.txt
306
241
  - doc/release_notes/3.3.0.txt
242
+ - doc/release_notes/3.30.0.txt
243
+ - doc/release_notes/3.31.0.txt
244
+ - doc/release_notes/3.32.0.txt
245
+ - doc/release_notes/3.33.0.txt
307
246
  - doc/release_notes/3.4.0.txt
308
247
  - doc/release_notes/3.5.0.txt
309
248
  - doc/release_notes/3.6.0.txt
@@ -383,6 +322,7 @@ files:
383
322
  - lib/roda/plugins/placeholder_string_matchers.rb
384
323
  - lib/roda/plugins/precompile_templates.rb
385
324
  - lib/roda/plugins/public.rb
325
+ - lib/roda/plugins/relative_path.rb
386
326
  - lib/roda/plugins/render.rb
387
327
  - lib/roda/plugins/render_each.rb
388
328
  - lib/roda/plugins/render_locals.rb
@@ -415,147 +355,6 @@ files:
415
355
  - lib/roda/response.rb
416
356
  - lib/roda/session_middleware.rb
417
357
  - lib/roda/version.rb
418
- - spec/all.rb
419
- - spec/assets/css/app.scss
420
- - spec/assets/css/no_access.css
421
- - spec/assets/css/raw.css
422
- - spec/assets/js/head/app.js
423
- - spec/composition_spec.rb
424
- - spec/define_roda_method_spec.rb
425
- - spec/env_spec.rb
426
- - spec/freeze_spec.rb
427
- - spec/integration_spec.rb
428
- - spec/matchers_spec.rb
429
- - spec/opts_spec.rb
430
- - spec/plugin/_after_hook_spec.rb
431
- - spec/plugin/all_verbs_spec.rb
432
- - spec/plugin/assets_preloading_spec.rb
433
- - spec/plugin/assets_spec.rb
434
- - spec/plugin/backtracking_array_spec.rb
435
- - spec/plugin/branch_locals_spec.rb
436
- - spec/plugin/caching_spec.rb
437
- - spec/plugin/chunked_spec.rb
438
- - spec/plugin/class_level_routing_spec.rb
439
- - spec/plugin/class_matchers_spec.rb
440
- - spec/plugin/common_logger_spec.rb
441
- - spec/plugin/content_for_spec.rb
442
- - spec/plugin/content_security_policy_spec.rb
443
- - spec/plugin/cookies_spec.rb
444
- - spec/plugin/csrf_spec.rb
445
- - spec/plugin/default_headers_spec.rb
446
- - spec/plugin/default_status_spec.rb
447
- - spec/plugin/delay_build_spec.rb
448
- - spec/plugin/delegate_spec.rb
449
- - spec/plugin/delete_empty_headers_spec.rb
450
- - spec/plugin/direct_call_spec.rb
451
- - spec/plugin/disallow_file_uploads_spec.rb
452
- - spec/plugin/drop_body_spec.rb
453
- - spec/plugin/early_hints_spec.rb
454
- - spec/plugin/empty_root_spec.rb
455
- - spec/plugin/environments_spec.rb
456
- - spec/plugin/error_email_spec.rb
457
- - spec/plugin/error_handler_spec.rb
458
- - spec/plugin/error_mail_spec.rb
459
- - spec/plugin/exception_page_spec.rb
460
- - spec/plugin/flash_spec.rb
461
- - spec/plugin/h_spec.rb
462
- - spec/plugin/halt_spec.rb
463
- - spec/plugin/hash_matcher_spec.rb
464
- - spec/plugin/hash_routes_spec.rb
465
- - spec/plugin/head_spec.rb
466
- - spec/plugin/header_matchers_spec.rb
467
- - spec/plugin/heartbeat_spec.rb
468
- - spec/plugin/hooks_spec.rb
469
- - spec/plugin/indifferent_params_spec.rb
470
- - spec/plugin/json_parser_spec.rb
471
- - spec/plugin/json_spec.rb
472
- - spec/plugin/mail_processor_spec.rb
473
- - spec/plugin/mailer_spec.rb
474
- - spec/plugin/match_affix_spec.rb
475
- - spec/plugin/match_hook_spec.rb
476
- - spec/plugin/middleware_spec.rb
477
- - spec/plugin/middleware_stack_spec.rb
478
- - spec/plugin/module_include_spec.rb
479
- - spec/plugin/multi_route_spec.rb
480
- - spec/plugin/multi_run_spec.rb
481
- - spec/plugin/multi_view_spec.rb
482
- - spec/plugin/multibyte_string_matcher_spec.rb
483
- - spec/plugin/named_templates_spec.rb
484
- - spec/plugin/not_allowed_spec.rb
485
- - spec/plugin/not_found_spec.rb
486
- - spec/plugin/optimized_string_matchers_spec.rb
487
- - spec/plugin/padrino_render_spec.rb
488
- - spec/plugin/param_matchers_spec.rb
489
- - spec/plugin/params_capturing_spec.rb
490
- - spec/plugin/partials_spec.rb
491
- - spec/plugin/pass_spec.rb
492
- - spec/plugin/path_matchers_spec.rb
493
- - spec/plugin/path_rewriter_spec.rb
494
- - spec/plugin/path_spec.rb
495
- - spec/plugin/placeholder_string_matchers_spec.rb
496
- - spec/plugin/precompile_templates_spec.rb
497
- - spec/plugin/public_spec.rb
498
- - spec/plugin/render_each_spec.rb
499
- - spec/plugin/render_locals_spec.rb
500
- - spec/plugin/render_spec.rb
501
- - spec/plugin/request_aref_spec.rb
502
- - spec/plugin/request_headers_spec.rb
503
- - spec/plugin/response_request_spec.rb
504
- - spec/plugin/route_block_args_spec.rb
505
- - spec/plugin/route_csrf_spec.rb
506
- - spec/plugin/run_append_slash_spec.rb
507
- - spec/plugin/run_handler_spec.rb
508
- - spec/plugin/sessions_spec.rb
509
- - spec/plugin/shared_vars_spec.rb
510
- - spec/plugin/sinatra_helpers_spec.rb
511
- - spec/plugin/slash_path_empty_spec.rb
512
- - spec/plugin/static_routing_spec.rb
513
- - spec/plugin/static_spec.rb
514
- - spec/plugin/status_303_spec.rb
515
- - spec/plugin/status_handler_spec.rb
516
- - spec/plugin/streaming_spec.rb
517
- - spec/plugin/strip_path_prefix_spec.rb
518
- - spec/plugin/symbol_matchers_spec.rb
519
- - spec/plugin/symbol_status_spec.rb
520
- - spec/plugin/symbol_views_spec.rb
521
- - spec/plugin/timestamp_public_spec.rb
522
- - spec/plugin/type_routing_spec.rb
523
- - spec/plugin/typecast_params_spec.rb
524
- - spec/plugin/unescape_path_spec.rb
525
- - spec/plugin/view_options_spec.rb
526
- - spec/plugin_spec.rb
527
- - spec/redirect_spec.rb
528
- - spec/request_spec.rb
529
- - spec/response_spec.rb
530
- - spec/route_spec.rb
531
- - spec/session_middleware_spec.rb
532
- - spec/session_spec.rb
533
- - spec/spec_helper.rb
534
- - spec/version_spec.rb
535
- - spec/views/_test.erb
536
- - spec/views/a.erb
537
- - spec/views/a.rdoc
538
- - spec/views/about.erb
539
- - spec/views/about.str
540
- - spec/views/about/_test.css.gz
541
- - spec/views/about/_test.erb
542
- - spec/views/about/_test.erb.gz
543
- - spec/views/about/comp_test.erb
544
- - spec/views/b.erb
545
- - spec/views/c.erb
546
- - spec/views/comp_layout.erb
547
- - spec/views/comp_test.erb
548
- - spec/views/content-yield.erb
549
- - spec/views/each.str
550
- - spec/views/home.erb
551
- - spec/views/home.str
552
- - spec/views/iv.erb
553
- - spec/views/layout-alternative.erb
554
- - spec/views/layout-yield.erb
555
- - spec/views/layout.erb
556
- - spec/views/layout.str
557
- - spec/views/multiple-layout.erb
558
- - spec/views/multiple.erb
559
358
  homepage: http://roda.jeremyevans.net
560
359
  licenses:
561
360
  - MIT
data/Rakefile DELETED
@@ -1,108 +0,0 @@
1
- require "rake"
2
- require "rake/clean"
3
- require "rdoc/task"
4
-
5
- NAME = 'roda'
6
- VERS = lambda do
7
- require_relative 'lib/roda/version'
8
- Roda::RodaVersion
9
- end
10
- CLEAN.include ["#{NAME}-*.gem", "rdoc", "coverage", "www/public/*.html", "www/public/rdoc", "spec/assets/app.*.css", "spec/assets/app.*.js", "spec/assets/app.*.css.gz", "spec/assets/app.*.js.gz", "spec/iv.erb"]
11
-
12
- # Gem Packaging and Release
13
-
14
- desc "Packages #{NAME}"
15
- task :package=>[:clean] do |p|
16
- sh %{gem build #{NAME}.gemspec}
17
- end
18
-
19
- ### RDoc
20
-
21
- RDOC_OPTS = ["--line-numbers", "--inline-source", '--title', 'Roda: Routing tree web toolkit']
22
-
23
- begin
24
- gem 'hanna-nouveau'
25
- RDOC_OPTS.concat(['-f', 'hanna'])
26
- rescue Gem::LoadError
27
- end
28
-
29
- RDOC_OPTS.concat(['--main', 'README.rdoc'])
30
- RDOC_FILES = %w"README.rdoc CHANGELOG MIT-LICENSE lib/**/*.rb" + Dir["doc/*.rdoc"] + Dir['doc/release_notes/*.txt']
31
-
32
- RDoc::Task.new do |rdoc|
33
- rdoc.rdoc_dir = "rdoc"
34
- rdoc.options += RDOC_OPTS
35
- rdoc.rdoc_files.add RDOC_FILES
36
- end
37
-
38
- RDoc::Task.new(:website_rdoc) do |rdoc|
39
- rdoc.rdoc_dir = "www/public/rdoc"
40
- rdoc.options += RDOC_OPTS
41
- rdoc.rdoc_files.add RDOC_FILES
42
- end
43
-
44
- ### Website
45
-
46
- desc "Make local version of website"
47
- task :website_base do
48
- sh %{#{FileUtils::RUBY} -I lib www/make_www.rb}
49
- end
50
-
51
- desc "Make local version of website, with rdoc"
52
- task :website => [:website_base, :website_rdoc]
53
-
54
- desc "Serve local version of website via rackup"
55
- task :serve => :website do
56
- sh %{#{FileUtils::RUBY} -C www -S rackup}
57
- end
58
-
59
-
60
- ### Specs
61
-
62
- spec = proc do |env|
63
- env.each{|k,v| ENV[k] = v}
64
- sh "#{FileUtils::RUBY} spec/all.rb"
65
- env.each{|k,v| ENV.delete(k)}
66
- end
67
-
68
- desc "Run specs"
69
- task "spec" do
70
- spec.call({})
71
- end
72
-
73
- task :default=>:spec
74
-
75
- desc "Run specs with coverage"
76
- task "spec_cov" do
77
- spec.call('COVERAGE'=>'1')
78
- end
79
-
80
- desc "Run specs with branch coverage"
81
- task "spec_branch_cov" do
82
- spec.call('COVERAGE'=>'1', 'BRANCH_COVERAGE'=>'1')
83
- end
84
-
85
- desc "Run specs with -w, some warnings filtered"
86
- task "spec_w" do
87
- rubyopt = ENV['RUBYOPT']
88
- ENV['RUBYOPT'] = "#{rubyopt} -w"
89
- spec.call('WARNING'=>'1')
90
- ENV['RUBYOPT'] = rubyopt
91
- end
92
-
93
- ### Other
94
-
95
- desc "Print #{NAME} version"
96
- task :version do
97
- puts VERS.call
98
- end
99
-
100
- desc "Start an IRB shell using the extension"
101
- task :irb do
102
- require 'rbconfig'
103
- ruby = ENV['RUBY'] || File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'])
104
- irb = ENV['IRB'] || File.join(RbConfig::CONFIG['bindir'], File.basename(ruby).sub('ruby', 'irb'))
105
- sh %{#{irb} -I lib -r #{NAME}}
106
- end
107
-
108
-
@@ -1,329 +0,0 @@
1
- = New Plugins
2
-
3
- * A csrf plugin has been added for CSRF prevention, using
4
- Rack::Csrf. It also adds helper methods for views such as
5
- csrf_tag.
6
-
7
- * A symbol_matchers plugin has been added, for customizing
8
- the regexps used per symbol. This also affects the use
9
- of embedded colons in strings. This supports the following
10
- symbol regexps by default:
11
-
12
- :d :: (\d+), a decimal segment
13
- :format :: (?:\.(\w+))?, an optional format/extension
14
- :opt :: (?:\/([^\/]+))?, an optional segment
15
- :optd :: (?:\/(\d+))?, an optional decimal segment
16
- :rest :: (.*), all remaining characters, if any
17
- :w :: (\w+), a alphanumeric segment
18
-
19
- This allows you to write code such as:
20
-
21
- plugin :symbol_matchers
22
-
23
- route do |r|
24
- r.is "track/:d" do
25
- end
26
- end
27
-
28
- And have it only match routes such as /track/123, not
29
- /track/abc.
30
-
31
- Note that :opt, :optd, and :format are only going to make sense
32
- when used as embedded colons in strings, due to how segment matching
33
- works.
34
-
35
- You can add your own symbol matchers using the symbol_matcher
36
- class method:
37
-
38
- plugin :symbol_matchers
39
- symbol_matcher :slug, /([\w-]+)/
40
-
41
- route do |r|
42
- r.on :slug do
43
- end
44
- end
45
-
46
- * A symbol_views plugin has been added, which allows match blocks to
47
- return symbols, which are interpreted as template names:
48
-
49
- plugin :symbol_views
50
-
51
- route do |r|
52
- :template_name # same as view :template_name
53
- end
54
-
55
- * A json plugin has been added, which allows match blocks to return
56
- arrays or hashes, and uses a JSON version of them as the response
57
- body:
58
-
59
- plugin :json
60
-
61
- route do |r|
62
- {'a'=>[1,2,3]} # response: {"a":[1,2,3]}
63
- end
64
-
65
- This also sets the Content-Type of the response to application/json.
66
-
67
- To convert additional object types to JSON, you can modify
68
- json_response_classes:
69
-
70
- plugin :json
71
- json_response_classes << Sequel::Model
72
-
73
- * A view_subdirs plugin has been added for setting a default
74
- subdirectory to use for views:
75
-
76
- Roda.route do |r|
77
- r.on "admin" do
78
- set_view_subdir "admin"
79
-
80
- r.is do
81
- view "index" # uses admin/index view
82
- end
83
- end
84
- end
85
-
86
- * A render_each plugin has been added, for rendering the same
87
- template for multiple objects, and returning the concatenation
88
- of all of the output:
89
-
90
- <%= render_each([1,2,3], 'number') %>
91
-
92
- This renders the number template 3 times. Each time the template
93
- is rendered, a local variable named number will be present with
94
- the current entry in the enumerable. You can control the name of
95
- the local variable using the :local option:
96
-
97
- <%= render_each([1,2,3], 'number', :local=>:n) %>
98
-
99
- * A content_for plugin has been added, for storing content in one
100
- template and retrieving that content in a different template (such
101
- as the layout). To set content, you call content_for with a block:
102
-
103
- <% content_for :foo do %>
104
- content for foo
105
- <% end %>
106
-
107
- To retrieve content, you call content_for without a block:
108
-
109
- <%= content_for :foo %>
110
-
111
- This plugin probably only works when using erb templates.
112
-
113
- * A not_allowed plugin has been added, for automatically returning 405
114
- Method Not Allowed responses when a route is handled for a different
115
- request method than the one used. For this routing tree:
116
-
117
- plugin :not_allowed
118
-
119
- route do |r|
120
- r.get "foo" do
121
- end
122
- end
123
-
124
- If you submit a POST /foo request, it will return a 405 error
125
- instead of a 404 error.
126
-
127
- This also handles cases when multiple methods are supported for
128
- a single path, so for this routing tree:
129
-
130
- route do |r|
131
- r.is "foo" do
132
- r.get do
133
- end
134
- r.post do
135
- end
136
- end
137
- end
138
-
139
- If you submit a DELETE /foo request, it will return a 405 error
140
- instead of a 404 error.
141
-
142
- * A head plugin has been added, automatically handling HEAD requests
143
- the same as GET requests, except returning an empty body. So for
144
- this routing tree:
145
-
146
- plugin :head
147
-
148
- route do |r|
149
- r.get "foo" do
150
- end
151
- end
152
-
153
- A request for HEAD /foo will return a 200 result instead of a 404
154
- error.
155
-
156
- * A backtracking_array plugin has been added, which makes matching
157
- backtrack to the next entry in an array if a later matcher fails.
158
- For example, the following code does not match /foo/bar by
159
- default in Roda:
160
-
161
- r.is ['foo', 'foo/bar'] do
162
- end
163
-
164
- This is because the 'foo' entry in the array matches, so the
165
- array matches. However, after the array is matched, the terminal
166
- matcher added by r.is fails to match. That causes the routing
167
- method not to match the request, so the match block is not called.
168
-
169
- With the backtracking_array plugin, failures of later matchers after
170
- an array matcher backtrack so the next entry in the array is tried.
171
-
172
- * A per_thread_caching plugin has been added, allowing you to change
173
- from a thread-safe shared cache to a per-thread cache, which may
174
- be faster on alternative ruby implementations, at the cost of
175
- additional memory usage.
176
-
177
- = New Features
178
-
179
- * The hash_matcher class method has been added to make it easier to
180
- define custom hash matchers:
181
-
182
- hash_matcher(:foo) do |v|
183
- self['foo'] == v
184
- end
185
-
186
- route do |r|
187
- r.on :foo=>'bar' do
188
- # matches when param foo has value bar
189
- end
190
- end
191
-
192
- * An r.root routing method has been added for handling GET
193
- requests where the current path is /. This is basically
194
- a faster and simpler version of r.get "", except it does
195
- not consume the / from the path.
196
-
197
- * The r.halt method now works without an argument, in which
198
- case it uses the current response.
199
-
200
- * The r.redirect method now works without an argument for non-GET
201
- requests, redirecting to the current path.
202
-
203
- * An :all hash matcher has been added, which takes an array and
204
- matches only if all of the elements match. This is mainly
205
- designed for usage inside an array matcher, so:
206
-
207
- r.on ["foo", {:all=>["bar", :id]}] do
208
- end
209
-
210
- will match either /foo or /bar/123, but not /bar.
211
-
212
- * The render plugin's view method now accepts a :content option,
213
- in which case it uses the content directly without running it
214
- through the template engine. This is useful if you have
215
- arbitrary content you want rendered inside the layout.
216
-
217
- * The render plugin now accepts an :escape option, in which case
218
- it will automatically set the default :engine_class for erb
219
- templates to an Erubis::EscapedEruby subclass. This changes the
220
- behavior of erb templates such that:
221
-
222
- <%= '<escaped>' %> # &lt;escaped&gt;
223
- <%== '<not escaped>' %> # <not escaped>
224
-
225
- This makes it easier to protect against XSS attacks in your
226
- templates, as long as you only use <%== %> for content that has
227
- already been escaped.
228
-
229
- Note that similar behavior is available in Erubis by default,
230
- using the :opts=>{:escape_html=>true} render option, but that
231
- doesn't handle postfix conditionals in <%= %> tags.
232
-
233
- * The multi_route plugin now has an r.multi_route method, which
234
- will attempt to dispatch to one of the named routes based on
235
- first segment in the path. So this routing tree:
236
-
237
- plugin :multi_route
238
-
239
- route "a" do |r|
240
- r.is "c" do
241
- "e"
242
- end
243
- end
244
- route "b" do |r|
245
- r.is "d" do
246
- "f"
247
- end
248
- end
249
-
250
- route do |r|
251
- r.multi_route
252
- end
253
-
254
- will return "e" for /a/c and "f" for /b/d.
255
-
256
- * Plugins can now override request and response class methods
257
- using RequestClassMethods and ResponseClassMethods modules.
258
-
259
- = Optimizations
260
-
261
- * String, hash, and symbol matchers are now much faster by caching
262
- the underlying regexp.
263
-
264
- * String, hash, and symbol matchers are now faster by using a
265
- regexp positive lookahead assertion instead of an additional
266
- capture.
267
-
268
- * Terminal matching in the r.is, r.get, and r.post routing methods
269
- is now faster, as it does not use a hash matcher internally.
270
-
271
- * The routing methods are now faster by reducing the number of
272
- Array objects created.
273
-
274
- * Calling routing methods without arguments is now faster.
275
-
276
- * The r.get method is now faster by reducing the number of string
277
- allocations.
278
-
279
- * Many request methods are faster by reducing the number of
280
- method calls used.
281
-
282
- * Template caching no longer uses a mutex on MRI, since one is
283
- not needed for thread safety there.
284
-
285
- = Other Improvements
286
-
287
- * The flash plugin now implements its own flash hash instead of
288
- using sinatra-flash. It is now slightly faster and handles nil
289
- keys in #keep and #discard.
290
-
291
- * Roda's version is now stored in roda/version.rb so that it can be
292
- required without requiring Roda itself.
293
-
294
- = Backwards Compatibility
295
-
296
- * The multi_route plugin's route instance method has been changed
297
- to a request method. So the new usage is:
298
-
299
- plugin :multi_route
300
-
301
- route "a" do |r|
302
- end
303
-
304
- route do |r|
305
- r.route "a" # instead of: route "a"
306
- end
307
-
308
- * The session key used for the flash hash in the flash plugin is
309
- now :_flash, not :flash.
310
-
311
- * The :extension matcher now longer forces a terminal match, use
312
- one of the routing methods that forces a terminal match if you
313
- want that behavior.
314
-
315
- * The :term hash matcher has been removed.
316
-
317
- * The r.consume private method now takes the exact regexp to use
318
- to search the current path, it no longer enforces a preceeding
319
- slash and that the match end on a segment boundary.
320
-
321
- * Dynamically constructing match patterns is now a potential
322
- memory leak due to them being cached. So you shouldn't do
323
- things like:
324
-
325
- r.on r['param'] do
326
- end
327
-
328
- * Many private routing methods were changed or removed, if you were
329
- using them, you'll probably need to update your code.