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
@@ -1,10 +0,0 @@
1
- = New Features
2
-
3
- * The render plugin now supports :check_paths and :allowed_paths
4
- options. Setting :check_paths to true will turn on path checking of
5
- template files. By default, template files are required to be in
6
- the :views directory, otherwise an exception will be raised. Using
7
- the :check_paths option can prevent security issues when template
8
- names are derived from user input. The :allowed_paths option
9
- overrides which path prefixes are allowed. In Roda 3, :check_paths
10
- will default to true.
@@ -1,44 +0,0 @@
1
- = New Features
2
-
3
- * A symbol_status plugin has been added for using symbolic status names
4
- in response.status=:
5
-
6
- class App < Roda
7
- plugin :symbol_status
8
-
9
- route do |r|
10
- r.is "needs_authorization"
11
- response.status = :unauthorized
12
- end
13
- end
14
-
15
- = Other Improvements
16
-
17
- * The middleware plugin will now also run the application's middleware
18
- when the application is used as middleware. For example, if you
19
- have the following code in your config.ru file:
20
-
21
- class App < Roda
22
- plugin :csrf
23
- plugin :middleware
24
- route{}
25
- end
26
-
27
- use App
28
-
29
- previously, the csrf protection would not be enforced, as it uses a
30
- middleware instead of being part of the application. Now, csrf
31
- protection will be enforced. This change makes it so the Roda
32
- application operates the same way regardless of whether it is run
33
- as the rack application or used as rack middleware.
34
-
35
- Because of this change, if you are nesting roda applications using
36
- the middleware plugin, you may need to use the middleware plugin's
37
- :env_var option to specify the environment variable used to
38
- indicate to the Roda application that it is being run as middleware.
39
-
40
- = Backwards Compatibility
41
-
42
- * See above changes to the middleware plugin if you are using
43
- middleware inside a Roda application that uses the middleware
44
- plugin.
@@ -1,53 +0,0 @@
1
- = New Features
2
-
3
- * A public plugin has been added. This adds an r.public method
4
- for serving all files in the public directory. The public
5
- plugin can replace usage of the static plugin, and is more
6
- flexible. You can place r.public at any point in the routing
7
- tree, and it will use the remaining path to lookup the file
8
- in the public directory. You can also pass the :gzip option
9
- when loading the plugin, and it will serve already gzipped
10
- files to the client if the client supports gzipped transfer
11
- encoding and the file exists with a .gz extension. Example:
12
-
13
- plugin :public
14
- route do |r|
15
- # Serve public files before routing
16
- r.public
17
-
18
- # ...
19
- end
20
-
21
- * The :header matcher added by the header_matchers plugin now
22
- automatically prefixes the key with HTTP_ when looking it up in
23
- the environment, if the :header_matcher_prefix application
24
- option is set. This behavior will probably be the default in
25
- Roda 3.
26
-
27
- # Before
28
- r.on :header => 'http_accept'
29
-
30
- # Now, with :header_matcher_prefix=>true application option
31
- r.on :header => 'accept'
32
-
33
- * The content_for plugin now accepts an :append=>true option to
34
- support appending to the existing content instead of overwriting
35
- the existing content if called multiple times. This behavior
36
- will probably be the default in Roda 3.
37
-
38
- # Before
39
- content_for(:form, 'a')
40
- content_for(:form, 'b')
41
- content_for(:form) # => 'b'
42
-
43
- # Now, with :append=>true option
44
- content_for(:form, 'a')
45
- content_for(:form, 'b')
46
- content_for(:form) # => 'ab'
47
-
48
- = Other Improvements
49
-
50
- * The r.send_file method in the sinatra_helpers plugin now works
51
- correctly when using rack 2.
52
-
53
- * The specs now run correctly on Windows.
@@ -1,48 +0,0 @@
1
- = New Features
2
-
3
- * A type_routing plugin has been added. This plugin allows routing
4
- based on the requested type, which can be submitted either via a
5
- file extension or Accept header:
6
-
7
- plugin :type_routing
8
-
9
- route do |r|
10
- r.get 'a' do
11
- r.html{ "<h1>This is the HTML response</h1>" }
12
- r.json{ '{"json": "ok"}' }
13
- r.xml{ "<root>This is the XML response</root>" }
14
- end
15
- end
16
-
17
- # /a or /a.html => HTML response
18
- # /a.json => JSON response
19
- # /a.xml => XML response
20
-
21
- The response content type is set appropriately when the r.html,
22
- r.json, or r.xml block is yielded to. Using plugin options, you can
23
- add support for custom types, and choose whether to use only file
24
- extensions or only Accept headers for type matching.
25
-
26
- * A request_headers plugin has been added. This allows easier access
27
- to request headers. For example, to access a header called
28
- X-My-Header, by default you would need to use the CGI mangled name:
29
-
30
- r.env['HTTP_X_MY_HEADER']
31
-
32
- The request_headers plugin allows the easier to use:
33
-
34
- r.headers['X-My-Header']
35
-
36
- * An unescape_path plugin has been added. By default, Roda does not
37
- unescape a URL-encoded PATH_INFO before routing. This plugin allows
38
- URL-encoded PATH_INFO to work, supporting %2f as well as / as path
39
- separators, and having captures return unescaped values:
40
-
41
- plugin :unescape_path
42
-
43
- route do |r|
44
- # Assume /b/a URL encoded at %2f%62%2f%61
45
- r.on :x, /(.)/ do |*x|
46
- # x => ['b', 'a']
47
- end
48
- end
@@ -1,62 +0,0 @@
1
- = New Plugins
2
-
3
- * A run_append_slash plugin has been added, which automatically uses
4
- "/" as the path instead of an empty path when calling rack
5
- applications with r.run:
6
-
7
- route do |r|
8
- r.on "a" do
9
- r.run App
10
- end
11
- end
12
-
13
- # without run_append_slash:
14
- # GET /a => App gets "" as PATH_INFO
15
- # GET /a/ => App gets "/" as PATH_INFO
16
-
17
- # with run_append_slash:
18
- # GET /a => App gets "/" as PATH_INFO
19
- # GET /a/ => App gets "/" as PATH_INFO
20
-
21
- By default, the path is modified directly, but if you want to
22
- redirect instead, you can pass a :use_redirects option when loading
23
- the plugin.
24
-
25
- = New Features
26
-
27
- * The assets plugin now supports an :sri option to enable subresource
28
- integrity on the link/script tags generated by the assets helper.
29
- This option takes either :sha256, :sha384, or :sha512 values,
30
- specifying the hash algorithm to use. Roda 3 will default to using
31
- :sri => :sha256.
32
-
33
- * The assets plugin now supports a :postprocessor option, which should
34
- be a callable object. If the option is given, it will be called with
35
- the filename, type, and rendered asset output of the file (CSS/JS),
36
- and should return the postprocessed content to use. This allows any
37
- type of custom postprocessing to be done, such as CSS autoprefixing.
38
-
39
- * The render plugin now supports a :layout_opts=>:merge_locals option,
40
- which will automatically merge view template locals into layout
41
- template locals. This is useful if you want to use the same local
42
- variable for both templates.
43
-
44
- * The error_handler plugin now supports a :classes option, allowing
45
- you to override which exception classes to handle. This allows it
46
- to be used with libraries which use exception classes that
47
- subclass from Exception instead of StandardError.
48
-
49
- = Other Improvements
50
-
51
- * The type_routing plugin now works correctly when using r.run.
52
- Previously, if the type routing plugin recognized and removed
53
- the file extension used in the requested path, it would not
54
- add the file extension back to the path when passing the request
55
- to another rack app.
56
-
57
- = Backwards Compatibility
58
-
59
- * In the assets plugin, Roda::RodaRequest.assets_matchers now uses
60
- symbols instead of strings as the first argument in each entry.
61
- This should not affect you unless you were accessing the values
62
- directly.
@@ -1,69 +0,0 @@
1
- = New Plugins
2
-
3
- * A static_routing plugin has been added, which can give a 3-4x
4
- increase in performance for large number of static routes, and
5
- makes routing O(1) for static routes. Static routes are routes
6
- that match full paths, with no placeholders, and are checked before
7
- using the normal routing tree.
8
-
9
- Static routes are defined via class-level static_* routing methods.
10
- There is a static_* routing method for each HTTP verb (e.g.
11
- static_get), as well as a static_route method, which will work
12
- for any HTTP verb, with the verb-specific method taking priority.
13
- By using static_route, you can get significantly faster performance
14
- while retaining some of the benefits of Roda's routing tree design
15
- (simple shared logic with verb specific behavior). Example:
16
-
17
- plugin :static_routing
18
-
19
- static_route '/foo' do |r|
20
- @var = :foo
21
-
22
- r.get do
23
- 'Not actually reached'
24
- end
25
-
26
- r.post{'static POST /#{@var}'}
27
- end
28
-
29
- static_get '/foo' do |r|
30
- 'static GET /foo'
31
- end
32
-
33
- route do |r|
34
- 'Not a static route'
35
- end
36
-
37
- Because static routing routes on the full path instead of by
38
- path segment, the methods takes the full path as a string,
39
- including the leading slash.
40
-
41
- * An assets_preloading plugin has been added, which makes it simple
42
- to generate HTML link tags or a Link header value to tell the
43
- browser to preload assets for performance reasons.
44
-
45
- # In routes, using the Link header:
46
- response.headers['Link'] = preload_assets_link_header(:css)
47
-
48
- # In templates, using a link tag:
49
- <%= preload_assets_link_tags(:css) %>
50
-
51
- = New Features
52
-
53
- * RodaRequest#real_remaining_path has been added. This is designed
54
- to be overridden by plugins that modify remaining_path for internal
55
- routing purposes. RodaRequest#run now uses real_remaining_path
56
- when passing requests to other rack applications.
57
-
58
- * An assets_paths method has been added to the assets plugin. This
59
- is similar to the assets method, but it returns an array of paths
60
- to the assets, instead of a HTML link/script tag.
61
-
62
- = Other Improvements
63
-
64
- * The public plugin now works correctly when used with the
65
- type_routing plugin, for paths ending in extensions that
66
- type_routing is configured to handle.
67
-
68
- * The head plugin now works with the not_allowed plugin if it is
69
- loaded after the not_allowed plugin.
@@ -1,30 +0,0 @@
1
- = Improvements
2
-
3
- * The indifferent_params plugin is now optimized when using Rack 2,
4
- using Rack 2's query_parser API, and it no longer needs to do a
5
- deep copy of the params.
6
-
7
- * The Content-Type and Content-Length headers are no longer added
8
- for 1xx, 204, 205, and 304 responses.
9
-
10
- * The assets_paths method in the assets plugin now works
11
- correctly when subresource integrity is enabled.
12
-
13
- * The asset paths are now escaped in tags by the assets and
14
- assets_preloading plugins. While it's unlikely a developer
15
- would use an asset path that requires escaping, that case is
16
- now handled correctly.
17
-
18
- * The h plugin no longer calls Rack::Utils.escape_html, instead
19
- implementing it's own html escaping.
20
-
21
- * The assets plugin now uses the h plugin, instead of calling
22
- Rack::Utils.escape_html.
23
-
24
- = Backwards Compatibility
25
-
26
- * The h plugin's html escaping no longer escapes "/", which is
27
- a behavior change if you are using any recent version of rack.
28
- The security arguments made to escape "/" could be applied to
29
- many other characters, so if you want to escape "/", you should
30
- probably use a separate method that escapes all \W characters.
@@ -1,97 +0,0 @@
1
- = New Plugins
2
-
3
- * A shared_vars plugin has been added, for sharing variables between
4
- multiple Roda apps. Example:
5
-
6
- class API < Roda
7
- plugin :shared_vars
8
- route do |r|
9
- user = shared[:user]
10
- # ...
11
- end
12
- end
13
-
14
- class App < Roda
15
- plugin :shared_vars
16
-
17
- route do |r|
18
- r.on :user_id do |user_id|
19
- shared[:user] = User[user_id]
20
- r.run API
21
- end
22
- end
23
- end
24
-
25
- If you pass a hash to shared, it will update the shared
26
- variables with the content of the hash:
27
-
28
- route do |r|
29
- r.on :user_id do |user_id|
30
- shared(:user => User[user_id])
31
- r.run API
32
- end
33
- end
34
-
35
- You can also pass a block to shared, which will set the
36
- shared variables only for the given block, restoring the
37
- previous shared variables afterward:
38
-
39
- route do |r|
40
- r.on :user_id do |user_id|
41
- shared(:user => User[user_id]) do
42
- r.run API
43
- end
44
- end
45
- end
46
-
47
- * The partials method added by the padrino_render plugin has been
48
- extracted into a partials plugin, for users who want to use the
49
- partials method without having render use a layout by default.
50
-
51
- = Other New Features
52
-
53
- * The render plugin when using the :escape option now additionally
54
- supports an :escape_safe_classes option, which accepts a class or
55
- array of classes that should not be automatically escaped when using
56
- <%= %> tags. This makes easier to integrate with helpers or
57
- external libraries that return already html escaped strings, without
58
- using <%== %> tags.
59
-
60
- For complete control, an :escaper option is also supported, which
61
- will be used for escaping <%= %> strings. The value of this option
62
- should be an object that responds to escape_xml with a single
63
- argument and returns an output string.
64
-
65
- * A Roda#delay method has been added to the chunked plugin, which
66
- delays execution of the given block until right before the content
67
- template is rendered. This allows you to continue to use the
68
- routing tree to DRY up your code even when streaming template
69
- rendering. Example:
70
-
71
- r.on 'albums/:d' do |album_id|
72
- delay do
73
- @album = Album[album_id]
74
- end
75
- r.get 'info' do
76
- chunked(:info)
77
- end
78
- r.get 'tracks' do
79
- chunked(:tracks)
80
- end
81
- end
82
-
83
- * The path plugin now supports a :by_name option, which makes lookup
84
- of the class be by name as opposed to by reference. This is
85
- designed for use in development when doing code reloading.
86
-
87
- * Roda.path_block has been added to the path plugin for returning the
88
- block associated with the given class.
89
-
90
- = Other Improvements
91
-
92
- * The default_headers plugin now defaults to the same headers that
93
- Roda uses by default (just the Content-Type header with text/html
94
- value). Previously, it did not set a Content-Type header if you
95
- didn't specify one.
96
-
97
- * In the path plugin, Roda#path now works correctly in subclasses.
@@ -1,5 +0,0 @@
1
- = New Features
2
-
3
- * The render plugin now supports :erubi as an :escape option value,
4
- which will change the plugin to use Erubi instead of Erubis as the
5
- template processor. Erubi is a simplified Erubis fork.
@@ -1,17 +0,0 @@
1
- = New Features
2
-
3
- * The streaming plugin now supports a handle_stream_error method to
4
- handle exceptions when using stream(:loop=>true). This method
5
- takes the exception and the stream object, and can be used to log
6
- errors, output errors into the stream, close the stream, ignore
7
- errors, or any other error handling.
8
-
9
- = Other Improvements
10
-
11
- * A couple of unused variable assignments have been removed, providing
12
- a minor speedup.
13
-
14
- * The specs no longer produce deprecation warnings when using Minitest
15
- 5.10.
16
-
17
- * Some verbose warnings have been removed from the specs.