roda 3.28.0 → 3.33.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +40 -0
- data/README.rdoc +15 -1
- data/doc/conventions.rdoc +17 -8
- data/doc/release_notes/3.29.0.txt +15 -0
- data/doc/release_notes/3.30.0.txt +14 -0
- data/doc/release_notes/3.31.0.txt +11 -0
- data/doc/release_notes/3.32.0.txt +42 -0
- data/doc/release_notes/3.33.0.txt +8 -0
- data/lib/roda.rb +3 -0
- data/lib/roda/plugins/_symbol_regexp_matchers.rb +2 -0
- data/lib/roda/plugins/assets.rb +26 -5
- data/lib/roda/plugins/caching.rb +2 -0
- data/lib/roda/plugins/common_logger.rb +1 -1
- data/lib/roda/plugins/content_security_policy.rb +2 -0
- data/lib/roda/plugins/default_headers.rb +2 -0
- data/lib/roda/plugins/exception_page.rb +9 -5
- data/lib/roda/plugins/hash_matcher.rb +1 -1
- data/lib/roda/plugins/header_matchers.rb +5 -1
- data/lib/roda/plugins/indifferent_params.rb +4 -0
- data/lib/roda/plugins/partials.rb +33 -6
- data/lib/roda/plugins/path.rb +42 -15
- data/lib/roda/plugins/placeholder_string_matchers.rb +2 -0
- data/lib/roda/plugins/public.rb +25 -17
- data/lib/roda/plugins/relative_path.rb +73 -0
- data/lib/roda/plugins/render.rb +17 -5
- data/lib/roda/plugins/render_each.rb +11 -3
- data/lib/roda/plugins/run_append_slash.rb +1 -1
- data/lib/roda/plugins/symbol_matchers.rb +2 -2
- data/lib/roda/version.rb +1 -1
- metadata +13 -214
- data/Rakefile +0 -108
- data/doc/release_notes/1.0.0.txt +0 -329
- data/doc/release_notes/1.1.0.txt +0 -226
- data/doc/release_notes/1.2.0.txt +0 -406
- data/doc/release_notes/1.3.0.txt +0 -109
- data/doc/release_notes/2.0.0.txt +0 -75
- data/doc/release_notes/2.1.0.txt +0 -124
- data/doc/release_notes/2.10.0.txt +0 -27
- data/doc/release_notes/2.11.0.txt +0 -70
- data/doc/release_notes/2.12.0.txt +0 -40
- data/doc/release_notes/2.13.0.txt +0 -10
- data/doc/release_notes/2.14.0.txt +0 -44
- data/doc/release_notes/2.15.0.txt +0 -53
- data/doc/release_notes/2.16.0.txt +0 -48
- data/doc/release_notes/2.17.0.txt +0 -62
- data/doc/release_notes/2.18.0.txt +0 -69
- data/doc/release_notes/2.19.0.txt +0 -30
- data/doc/release_notes/2.2.0.txt +0 -97
- data/doc/release_notes/2.20.0.txt +0 -5
- data/doc/release_notes/2.21.0.txt +0 -17
- data/doc/release_notes/2.22.0.txt +0 -41
- data/doc/release_notes/2.23.0.txt +0 -29
- data/doc/release_notes/2.24.0.txt +0 -65
- data/doc/release_notes/2.25.0.txt +0 -14
- data/doc/release_notes/2.26.0.txt +0 -13
- data/doc/release_notes/2.27.0.txt +0 -56
- data/doc/release_notes/2.28.0.txt +0 -17
- data/doc/release_notes/2.29.0.txt +0 -156
- data/doc/release_notes/2.3.0.txt +0 -109
- data/doc/release_notes/2.4.0.txt +0 -55
- data/doc/release_notes/2.5.0.txt +0 -23
- data/doc/release_notes/2.5.1.txt +0 -4
- data/doc/release_notes/2.6.0.txt +0 -21
- data/doc/release_notes/2.7.0.txt +0 -75
- data/doc/release_notes/2.8.0.txt +0 -44
- data/doc/release_notes/2.9.0.txt +0 -6
- data/spec/all.rb +0 -1
- data/spec/assets/css/app.scss +0 -1
- data/spec/assets/css/no_access.css +0 -1
- data/spec/assets/css/raw.css +0 -1
- data/spec/assets/js/head/app.js +0 -1
- data/spec/composition_spec.rb +0 -31
- data/spec/define_roda_method_spec.rb +0 -274
- data/spec/env_spec.rb +0 -11
- data/spec/freeze_spec.rb +0 -37
- data/spec/integration_spec.rb +0 -209
- data/spec/matchers_spec.rb +0 -832
- data/spec/opts_spec.rb +0 -42
- data/spec/plugin/_after_hook_spec.rb +0 -19
- data/spec/plugin/all_verbs_spec.rb +0 -29
- data/spec/plugin/assets_preloading_spec.rb +0 -98
- data/spec/plugin/assets_spec.rb +0 -745
- data/spec/plugin/backtracking_array_spec.rb +0 -42
- data/spec/plugin/branch_locals_spec.rb +0 -106
- data/spec/plugin/caching_spec.rb +0 -337
- data/spec/plugin/chunked_spec.rb +0 -201
- data/spec/plugin/class_level_routing_spec.rb +0 -164
- data/spec/plugin/class_matchers_spec.rb +0 -40
- data/spec/plugin/common_logger_spec.rb +0 -85
- data/spec/plugin/content_for_spec.rb +0 -162
- data/spec/plugin/content_security_policy_spec.rb +0 -175
- data/spec/plugin/cookies_spec.rb +0 -51
- data/spec/plugin/csrf_spec.rb +0 -111
- data/spec/plugin/default_headers_spec.rb +0 -82
- data/spec/plugin/default_status_spec.rb +0 -95
- data/spec/plugin/delay_build_spec.rb +0 -23
- data/spec/plugin/delegate_spec.rb +0 -23
- data/spec/plugin/delete_empty_headers_spec.rb +0 -27
- data/spec/plugin/direct_call_spec.rb +0 -28
- data/spec/plugin/disallow_file_uploads_spec.rb +0 -25
- data/spec/plugin/drop_body_spec.rb +0 -24
- data/spec/plugin/early_hints_spec.rb +0 -19
- data/spec/plugin/empty_root_spec.rb +0 -14
- data/spec/plugin/environments_spec.rb +0 -42
- data/spec/plugin/error_email_spec.rb +0 -97
- data/spec/plugin/error_handler_spec.rb +0 -216
- data/spec/plugin/error_mail_spec.rb +0 -93
- data/spec/plugin/exception_page_spec.rb +0 -168
- data/spec/plugin/flash_spec.rb +0 -121
- data/spec/plugin/h_spec.rb +0 -11
- data/spec/plugin/halt_spec.rb +0 -119
- data/spec/plugin/hash_matcher_spec.rb +0 -27
- data/spec/plugin/hash_routes_spec.rb +0 -535
- data/spec/plugin/head_spec.rb +0 -52
- data/spec/plugin/header_matchers_spec.rb +0 -98
- data/spec/plugin/heartbeat_spec.rb +0 -74
- data/spec/plugin/hooks_spec.rb +0 -152
- data/spec/plugin/indifferent_params_spec.rb +0 -14
- data/spec/plugin/json_parser_spec.rb +0 -141
- data/spec/plugin/json_spec.rb +0 -83
- data/spec/plugin/mail_processor_spec.rb +0 -451
- data/spec/plugin/mailer_spec.rb +0 -282
- data/spec/plugin/match_affix_spec.rb +0 -43
- data/spec/plugin/match_hook_spec.rb +0 -79
- data/spec/plugin/middleware_spec.rb +0 -237
- data/spec/plugin/middleware_stack_spec.rb +0 -81
- data/spec/plugin/module_include_spec.rb +0 -48
- data/spec/plugin/multi_route_spec.rb +0 -268
- data/spec/plugin/multi_run_spec.rb +0 -87
- data/spec/plugin/multi_view_spec.rb +0 -50
- data/spec/plugin/multibyte_string_matcher_spec.rb +0 -44
- data/spec/plugin/named_templates_spec.rb +0 -96
- data/spec/plugin/not_allowed_spec.rb +0 -69
- data/spec/plugin/not_found_spec.rb +0 -128
- data/spec/plugin/optimized_string_matchers_spec.rb +0 -43
- data/spec/plugin/padrino_render_spec.rb +0 -34
- data/spec/plugin/param_matchers_spec.rb +0 -69
- data/spec/plugin/params_capturing_spec.rb +0 -33
- data/spec/plugin/partials_spec.rb +0 -43
- data/spec/plugin/pass_spec.rb +0 -29
- data/spec/plugin/path_matchers_spec.rb +0 -42
- data/spec/plugin/path_rewriter_spec.rb +0 -45
- data/spec/plugin/path_spec.rb +0 -222
- data/spec/plugin/placeholder_string_matchers_spec.rb +0 -126
- data/spec/plugin/precompile_templates_spec.rb +0 -61
- data/spec/plugin/public_spec.rb +0 -85
- data/spec/plugin/render_each_spec.rb +0 -82
- data/spec/plugin/render_locals_spec.rb +0 -114
- data/spec/plugin/render_spec.rb +0 -912
- data/spec/plugin/request_aref_spec.rb +0 -51
- data/spec/plugin/request_headers_spec.rb +0 -39
- data/spec/plugin/response_request_spec.rb +0 -43
- data/spec/plugin/route_block_args_spec.rb +0 -86
- data/spec/plugin/route_csrf_spec.rb +0 -305
- data/spec/plugin/run_append_slash_spec.rb +0 -77
- data/spec/plugin/run_handler_spec.rb +0 -53
- data/spec/plugin/sessions_spec.rb +0 -452
- data/spec/plugin/shared_vars_spec.rb +0 -45
- data/spec/plugin/sinatra_helpers_spec.rb +0 -537
- data/spec/plugin/slash_path_empty_spec.rb +0 -22
- data/spec/plugin/static_routing_spec.rb +0 -192
- data/spec/plugin/static_spec.rb +0 -30
- data/spec/plugin/status_303_spec.rb +0 -28
- data/spec/plugin/status_handler_spec.rb +0 -158
- data/spec/plugin/streaming_spec.rb +0 -246
- data/spec/plugin/strip_path_prefix_spec.rb +0 -24
- data/spec/plugin/symbol_matchers_spec.rb +0 -51
- data/spec/plugin/symbol_status_spec.rb +0 -25
- data/spec/plugin/symbol_views_spec.rb +0 -32
- data/spec/plugin/timestamp_public_spec.rb +0 -85
- data/spec/plugin/type_routing_spec.rb +0 -348
- data/spec/plugin/typecast_params_spec.rb +0 -1370
- data/spec/plugin/unescape_path_spec.rb +0 -22
- data/spec/plugin/view_options_spec.rb +0 -170
- data/spec/plugin_spec.rb +0 -71
- data/spec/redirect_spec.rb +0 -41
- data/spec/request_spec.rb +0 -97
- data/spec/response_spec.rb +0 -199
- data/spec/route_spec.rb +0 -39
- data/spec/session_middleware_spec.rb +0 -129
- data/spec/session_spec.rb +0 -37
- data/spec/spec_helper.rb +0 -137
- data/spec/version_spec.rb +0 -14
- data/spec/views/_test.erb +0 -1
- data/spec/views/a.erb +0 -1
- data/spec/views/a.rdoc +0 -2
- data/spec/views/about.erb +0 -1
- data/spec/views/about.str +0 -1
- data/spec/views/about/_test.css.gz +0 -0
- data/spec/views/about/_test.erb +0 -1
- data/spec/views/about/_test.erb.gz +0 -0
- data/spec/views/about/comp_test.erb +0 -1
- data/spec/views/b.erb +0 -1
- data/spec/views/c.erb +0 -1
- data/spec/views/comp_layout.erb +0 -1
- data/spec/views/comp_test.erb +0 -1
- data/spec/views/content-yield.erb +0 -1
- data/spec/views/each.str +0 -1
- data/spec/views/home.erb +0 -2
- data/spec/views/home.str +0 -2
- data/spec/views/iv.erb +0 -1
- data/spec/views/layout-alternative.erb +0 -2
- data/spec/views/layout-yield.erb +0 -3
- data/spec/views/layout.erb +0 -2
- data/spec/views/layout.str +0 -2
- data/spec/views/multiple-layout.erb +0 -1
- data/spec/views/multiple.erb +0 -1
@@ -1,41 +0,0 @@
|
|
1
|
-
= New Features
|
2
|
-
|
3
|
-
* An :unsupported_block_result => :raise option is now supported
|
4
|
-
for Roda applications. This will raise a RodaError if an
|
5
|
-
unsupported value is returned from a match block or the
|
6
|
-
route block. This can make it easier to discover potential
|
7
|
-
problems in the routing tree. This option may become the
|
8
|
-
default behavior in Roda 3.
|
9
|
-
|
10
|
-
* An :unsupported_matcher => :raise option is now supported for
|
11
|
-
Roda applications. This will raise a RodaError if you use an
|
12
|
-
unsupported value as a matcher. This can make it easier to
|
13
|
-
discover potential problems in the routing tree. This option
|
14
|
-
may become the default behavior in Roda 3.
|
15
|
-
|
16
|
-
* A :verbatim_string_matcher option is now supported for Roda
|
17
|
-
applications. This will make all string matchers only match
|
18
|
-
the path verbatim, disallowing the use of a colon for
|
19
|
-
placeholders in the string. It's recommended that users
|
20
|
-
switch to using separate symbol arguments for placeholders.
|
21
|
-
|
22
|
-
If you enable this option, you need to change code such as:
|
23
|
-
|
24
|
-
r.is "foo/:bar" do |bar|
|
25
|
-
end
|
26
|
-
|
27
|
-
to:
|
28
|
-
|
29
|
-
r.is "foo", :bar do |bar|
|
30
|
-
end
|
31
|
-
|
32
|
-
If you are looking to convert an existing routing tree
|
33
|
-
from using placeholders in strings to separate symbol
|
34
|
-
arguments, you can scan your routing tree for potential
|
35
|
-
usage of placeholders in strings:
|
36
|
-
|
37
|
-
grep ' r\..*['\''"].*:.*['\''"]' app.rb
|
38
|
-
|
39
|
-
This option may become the default behavior in Roda 3, with
|
40
|
-
a plugin added to support the current default behavior of
|
41
|
-
allowing placeholders in string matchers.
|
@@ -1,29 +0,0 @@
|
|
1
|
-
= New Features
|
2
|
-
|
3
|
-
* An :explicit_cache option has been added to the render plugin.
|
4
|
-
This is similar to the :cache=>false option, but instead of
|
5
|
-
disabling caching completely, this disables caching by default but
|
6
|
-
allows for explicit caching of templates by providing the :cache
|
7
|
-
option to view/render.
|
8
|
-
|
9
|
-
In development mode, Roda now defaults to :explicit_cache=>true
|
10
|
-
instead of :cache=>false.
|
11
|
-
|
12
|
-
* An :inherit_cache option has been added to the render plugin,
|
13
|
-
making subclasses of that class start with a dup of the template
|
14
|
-
cache, instead of starting with an empty template cache. This can
|
15
|
-
result in less memory used.
|
16
|
-
|
17
|
-
* Roda#error_email in the error_email plugin now accepts non-Exception
|
18
|
-
arguments (such as strings). This can be useful in conditions that
|
19
|
-
are errors you may want to notify about, where an exception hasn't
|
20
|
-
been raised.
|
21
|
-
|
22
|
-
* Roda#error_email_content has been added to the error_email plugin.
|
23
|
-
This can be used to create the email message, which can be delivered
|
24
|
-
via another mechanism, and may make testing easier.
|
25
|
-
|
26
|
-
= Other Improvements
|
27
|
-
|
28
|
-
* Roda.freeze in the static_routing plugin now returns self, fixing
|
29
|
-
code such as Roda.freeze.app.
|
@@ -1,65 +0,0 @@
|
|
1
|
-
= New Features
|
2
|
-
|
3
|
-
* The middleware plugin now accepts a block that can be used to
|
4
|
-
implement configurable middleware. This allows you to load the
|
5
|
-
Roda application as middleware in another application, and provide
|
6
|
-
options/block that are passed to the block you passed when loading
|
7
|
-
the middleware plugin. Example:
|
8
|
-
|
9
|
-
class Mid < Roda
|
10
|
-
plugin :middleware do |middleware, *args, &block|
|
11
|
-
middleware.opts[:middleware_args] = args
|
12
|
-
block.call(middleware)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
class App < Roda
|
17
|
-
use Mid, :foo, :bar do |middleware|
|
18
|
-
middleware.opts[:middleware_args] << :baz
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
Note that when passing a block when loading the middleware plugin,
|
23
|
-
using the middleware in another rack application will actually
|
24
|
-
load a subclass of the middleware (Mid in the example above).
|
25
|
-
This allows you to use the Roda middleware multiple times in the
|
26
|
-
same process with different configurations.
|
27
|
-
|
28
|
-
* The cookies plugin now accepts options that are used as the default
|
29
|
-
options when setting and deleting cookies:
|
30
|
-
|
31
|
-
plugin :cookies, :path => '/foo', :domain => 'example.com'
|
32
|
-
|
33
|
-
* A strip_path_prefix plugin has been added, which can be used to
|
34
|
-
strip prefixes from internal paths. Internally Sequel stores
|
35
|
-
most paths as absolute paths, but there are cases where this
|
36
|
-
doesn't work well, such as symlink changes and chroot. This
|
37
|
-
plugin supports those scenarios.
|
38
|
-
|
39
|
-
* A disallow_file_uploads plugin has been added, which raises
|
40
|
-
an exception if the user attempts a multipart file upload.
|
41
|
-
More exactly, it makes the application raise an exception if
|
42
|
-
attempting to parse a request body when the user has submitted
|
43
|
-
a multipart file upload. This is useful if you don't need to
|
44
|
-
support file uploads in your application, or cases where no
|
45
|
-
paths are writable by the application (due to chroot or system call
|
46
|
-
filtering).
|
47
|
-
|
48
|
-
* The :freeze_middleware option has been added, which freezes all
|
49
|
-
middleware instances when building the rack application. This
|
50
|
-
can help find thread safety issues in middleware.
|
51
|
-
|
52
|
-
= Other Improvements
|
53
|
-
|
54
|
-
* The h plugin is now about 6x faster on ruby 2.3+ due to the use
|
55
|
-
of cgi/escape.
|
56
|
-
|
57
|
-
* The static_routing plugin now works with the hooks plugin if the
|
58
|
-
hooks plugin is loaded first.
|
59
|
-
|
60
|
-
* The render plugin's render cache is no longer cleared when loading
|
61
|
-
the plugin multiple times.
|
62
|
-
|
63
|
-
= Backwards Compatibility
|
64
|
-
|
65
|
-
* The h plugin now escapes ' as ' instead of '.
|
@@ -1,14 +0,0 @@
|
|
1
|
-
= New Features
|
2
|
-
|
3
|
-
* An error_mail plugin has been added for reporting exceptions raised
|
4
|
-
via email. This is similar to the existing error_email plugin, but
|
5
|
-
uses the mail library instead of net/smtp directly. If you are
|
6
|
-
already using the mail library and the error_email plugin in your
|
7
|
-
application, it's recommended to switch to the error_mail plugin.
|
8
|
-
Example:
|
9
|
-
|
10
|
-
plugin :error_mail, :to=>'to@example.com', :from=>'from@example.com'
|
11
|
-
plugin :error_handler do |e|
|
12
|
-
error_mail(e)
|
13
|
-
'Internal Server Error'
|
14
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
= New Features
|
2
|
-
|
3
|
-
* The csrf plugin now supports a :skip_middleware option, which adds
|
4
|
-
the methods without adding the middleware. This is designed for
|
5
|
-
cases where you are using multiple rack apps, where the rack_csrf
|
6
|
-
middleware is loaded in an earlier rack app, and you want to avoid
|
7
|
-
the duplicate CSRF checks.
|
8
|
-
|
9
|
-
= Other Improvements
|
10
|
-
|
11
|
-
* The type_routing plugin now supports using multiple extensions
|
12
|
-
where one extension is a suffix of another extension, such as
|
13
|
-
using gz and tar.gz.
|
@@ -1,56 +0,0 @@
|
|
1
|
-
= New Features
|
2
|
-
|
3
|
-
* String and Integer class matchers have been added. The
|
4
|
-
String class matches any non-empty segment and yields it as a
|
5
|
-
string. This is the same as the behavior of the symbol matchers,
|
6
|
-
but without the duplication. So instead of:
|
7
|
-
|
8
|
-
r.is "album", :album_name do |album_name|
|
9
|
-
end
|
10
|
-
|
11
|
-
you can now do:
|
12
|
-
|
13
|
-
r.is "album", String do |album_name|
|
14
|
-
end
|
15
|
-
|
16
|
-
This makes it a bit more intuitive that you want to match
|
17
|
-
any string, and avoids the redundancy between the symbol
|
18
|
-
name and block argument name.
|
19
|
-
|
20
|
-
The Integer class matches any integer segment (\d+) and yields it
|
21
|
-
as an integer:
|
22
|
-
|
23
|
-
r.is "album", Integer do |album_id|
|
24
|
-
# does not match "/albums/foo"
|
25
|
-
# matches "/albums/1", yielding 1 (not "1")
|
26
|
-
end
|
27
|
-
|
28
|
-
Previously, the :d matcher in the symbol_matchers plugin could
|
29
|
-
be used to only match integer segments, but it yielded results
|
30
|
-
as strings and not integers, so you still needed to convert the
|
31
|
-
type manually. Using Integer is a bit more intuitive than
|
32
|
-
using :d, and it handles the type conversion for you.
|
33
|
-
|
34
|
-
* A class_matchers plugin has been added for matching additional
|
35
|
-
classes, with user-specified regexps and type conversion. For
|
36
|
-
example, if you want to match YYYY-MM-DD segments and yield
|
37
|
-
them to the match blocks as ruby Date objects, you can do:
|
38
|
-
|
39
|
-
plugin :class_matchers
|
40
|
-
|
41
|
-
class_matcher(Date, /(\d\d\d\d)-(\d\d)-(\d\d)/) do |y, m, d|
|
42
|
-
[Date.new(y.to_i, m.to_i, d.to_i)]
|
43
|
-
end
|
44
|
-
|
45
|
-
and then in your routing tree, you can do:
|
46
|
-
|
47
|
-
r.on "posts", Date do |date|
|
48
|
-
# does not match "/posts/foo" or "/posts/2017-01"
|
49
|
-
# matches "/posts/2017-01-13", yielding Date.new(2017, 1, 13)
|
50
|
-
end
|
51
|
-
|
52
|
-
= Backwards Compatibility
|
53
|
-
|
54
|
-
* If you were using the Integer and String classes as matchers
|
55
|
-
before and expected them to always match, you'll need to
|
56
|
-
change your code to use true instead.
|
@@ -1,17 +0,0 @@
|
|
1
|
-
= New Features
|
2
|
-
|
3
|
-
* A status_303 plugin has been added, which changes the default
|
4
|
-
redirect status from 302 to 303 if the HTTP version is 1.1 and
|
5
|
-
the request is not a GET request.
|
6
|
-
|
7
|
-
= Other Improvements
|
8
|
-
|
9
|
-
* Roda is now optimized for ruby 2.3+ using frozen string literals
|
10
|
-
instead of constant references. This improves performance on ruby
|
11
|
-
2.3+, and decreases performance on ruby <2.3.
|
12
|
-
|
13
|
-
= Backwards Compatibility
|
14
|
-
|
15
|
-
* Many now unused internal constants are now deprecated, and
|
16
|
-
attempting to access them will result in deprecation warnings
|
17
|
-
on ruby 2.3+.
|
@@ -1,156 +0,0 @@
|
|
1
|
-
= Deprecated Features
|
2
|
-
|
3
|
-
Roda 2.29.0 will be the last minor release of Roda 2. Roda 3.0.0
|
4
|
-
will be released next month and will remove support for the following
|
5
|
-
deprecated features. All of these features will have deprecation
|
6
|
-
warnings if used in Roda 2.29.0.
|
7
|
-
|
8
|
-
* The use of placeholders in string matchers is now deprecated.
|
9
|
-
So code such as:
|
10
|
-
|
11
|
-
r.get "users/:user_id" do |id|
|
12
|
-
end
|
13
|
-
|
14
|
-
should be switched to using a class matcher such as String or
|
15
|
-
Integer:
|
16
|
-
|
17
|
-
r.get "users", Integer do |id|
|
18
|
-
end
|
19
|
-
|
20
|
-
or a symbol matcher:
|
21
|
-
|
22
|
-
r.get "users", :user_id do |id|
|
23
|
-
end
|
24
|
-
|
25
|
-
If you really want to keep support for placeholders in string
|
26
|
-
matchers, the support is available in the new
|
27
|
-
placeholder_string_matchers plugin.
|
28
|
-
|
29
|
-
* The :format, :opt, and :optd default symbol matchers are now
|
30
|
-
deprecated in the symbol_matchers plugin. These matchers
|
31
|
-
only made sense when placeholder string matchers are used,
|
32
|
-
which will no longer be the default behavior in Roda 3. These
|
33
|
-
methods can be defined manually if you are going to use the
|
34
|
-
placeholder_string_matchers plugin and still want to use
|
35
|
-
these symbol matchers:
|
36
|
-
|
37
|
-
symbol_matcher(:format, /(?:\.(\w+))?/)
|
38
|
-
symbol_matcher(:opt, /(?:\/([^\/]+))?/)
|
39
|
-
symbol_matcher(:optd, /(?:\/(\d+))?/)
|
40
|
-
|
41
|
-
* Ignoring unsupported match block return values is now deprecated.
|
42
|
-
Doing so can hide errors and make debugging more difficult. If you
|
43
|
-
get a deprecation warning related to this, just make sure the match
|
44
|
-
block returns nil or false to specify the match block return value
|
45
|
-
should be ignored.
|
46
|
-
|
47
|
-
* Treating unsupported matchers as always matching is now deprecated.
|
48
|
-
Doing so can hide errors and make debugging more difficult. If you
|
49
|
-
get a deprecation warning related to this, switch the matcher to
|
50
|
-
true instead of an unsupported object.
|
51
|
-
|
52
|
-
* The render plugin's handling of plugin level locals and merging of
|
53
|
-
template and layout locals is now deprecated. Users of these
|
54
|
-
features should switch to the new render_locals plugin.
|
55
|
-
|
56
|
-
* The view_options plugin's handling of per-branch view and layout
|
57
|
-
locals is now deprecated. Users of these feature should switch to
|
58
|
-
the new branch_locals plugin.
|
59
|
-
|
60
|
-
* The render plugin's support for Erubis escaping is now deprecated.
|
61
|
-
In Roda 3, the render plugin :escape option will use Erubi escaping.
|
62
|
-
Switch to using :escape=>:erubi temporarily to avoid the deprecation
|
63
|
-
warning.
|
64
|
-
|
65
|
-
* Using the render plugin to render a template that is outside one of
|
66
|
-
the allowed paths is now deprecated unless the :check_paths option
|
67
|
-
has been set to false. In Roda 3, the default behavior will change
|
68
|
-
to checking that template files are in one of the allowed paths.
|
69
|
-
|
70
|
-
* The :ext option in the render plugin is now deprecated, users should
|
71
|
-
switch to using the :engine option, which has always had priority.
|
72
|
-
|
73
|
-
* Using the :cache=>true option to the view/render method in the
|
74
|
-
render plugin is now deprecated if the :cache=>nil/false option
|
75
|
-
was given when loading the plugin. In Roda 3, the default behavior
|
76
|
-
will change so that the :cache=>nil/false plugin option still
|
77
|
-
allows caching via the :cache=>true method option. Users can use
|
78
|
-
the :explicit_cache=>true render plugin option instead of the
|
79
|
-
:cache=>nil render plugin option to work around the deprecation
|
80
|
-
warning.
|
81
|
-
|
82
|
-
* Attempting to use multi_route while routing with a namespace that
|
83
|
-
hasn't yet been defined is now deprecated. The previous behavior
|
84
|
-
was to ignore undefined namespaces, but that is more likely to
|
85
|
-
hide an error than be desired behavior. In Roda 3, using an
|
86
|
-
undefined namespace will raise an error.
|
87
|
-
|
88
|
-
* The streaming plugin's support for EventMachine is now deprecated,
|
89
|
-
as is related support for Stream#callback. The streaming plugin
|
90
|
-
will be much simpler in Roda 3 by dropping this support.
|
91
|
-
|
92
|
-
* Calling content_for in the content_for plugin multiple times with
|
93
|
-
the same argument is now deprecated unless the content_for
|
94
|
-
plugin :append option is used to specify behavior. The default
|
95
|
-
behavior in Roda 3 will change to appending to the existing
|
96
|
-
content instead of overwriting the existing content.
|
97
|
-
|
98
|
-
* The :host matcher in the header_matchers plugin is now deprecated
|
99
|
-
when using a regexp value unless the :host_matcher_captures app
|
100
|
-
option is used. In Roda 3, the :host matcher will automatically
|
101
|
-
yield any regexp captures to the match block.
|
102
|
-
|
103
|
-
* The :header matcher in the header_matchers plugin is now deprecated
|
104
|
-
unless the :header_matcher_prefix app option is used. In Roda 3,
|
105
|
-
the :header matcher will always prefix the argument given with
|
106
|
-
HTTP_.
|
107
|
-
|
108
|
-
* The websockets plugin is now deprecated. It was one of the less
|
109
|
-
commonly used plugins, and the tests for it were subject to race
|
110
|
-
conditions and failed occassionally, and even when they worked
|
111
|
-
they almost doubled the testing time. Anyone wanting to use it
|
112
|
-
should consider maintaining it as an external plugin.
|
113
|
-
|
114
|
-
* The per_thread_caching, static_path_info, and view_subdirs
|
115
|
-
plugins are now deprecated. static_path_info has been a no-op since
|
116
|
-
Roda 3, view_subdirs is just an alias for view_options, and
|
117
|
-
per_thread_caching doesn't change behavior and is unlikely to
|
118
|
-
significantly increase performance.
|
119
|
-
|
120
|
-
* Additional internal constants are now deprecated. Deprecation
|
121
|
-
warnings for accessing these constants will only be displayed on
|
122
|
-
ruby 2.3+.
|
123
|
-
|
124
|
-
= Forward Compatibility
|
125
|
-
|
126
|
-
Roda 3.0.0 will also include some behavior changes which will not
|
127
|
-
have deprecation warnings:
|
128
|
-
|
129
|
-
* Ruby 1.8.7 support will be dropped. Ruby 1.9.2 will be the new
|
130
|
-
minimum supported version.
|
131
|
-
|
132
|
-
* Subclassing a Roda app that uses the render plugin will always
|
133
|
-
use a copy of the superclass's template cache.
|
134
|
-
|
135
|
-
* The assets plugin will default to using subresource integrity
|
136
|
-
using SHA256 for compiled assets, and using SHA256 instead of
|
137
|
-
SHA1 for compiled asset hashes.
|
138
|
-
|
139
|
-
* Using an Roda app as middleware will now always use a subclass
|
140
|
-
of the app for the middleware.
|
141
|
-
|
142
|
-
* public_send will be used instead of send internally unless it is
|
143
|
-
expected that private methods will be called.
|
144
|
-
|
145
|
-
* The match methods added by the symbol_matchers and hash_matchers
|
146
|
-
plugins will be private instead of public.
|
147
|
-
|
148
|
-
= New Features
|
149
|
-
|
150
|
-
* The render plugin now has the :layout_opts=>:views plugin option
|
151
|
-
respect the :root app option.
|
152
|
-
|
153
|
-
* RodaPlugins::OPTS and RodaPlugins::EMPTY_ARRAY have been added.
|
154
|
-
These are a frozen empty hash and a frozen empty array, and
|
155
|
-
they are designed for use in plugins so that similar objects are
|
156
|
-
not needed to be defined separately in each plugin.
|
data/doc/release_notes/2.3.0.txt
DELETED
@@ -1,109 +0,0 @@
|
|
1
|
-
= New Plugins
|
2
|
-
|
3
|
-
* A json_parser plugin has been added, for parsing request bodies in
|
4
|
-
JSON format. This is faster than using a middleware to perform
|
5
|
-
the same task. This plugin supports a :parser option to use a
|
6
|
-
custom JSON parser, an :include_request option to include the
|
7
|
-
request when calling the parser, and a :error_handler option for
|
8
|
-
a proc to call with the request if there is an error when parsing.
|
9
|
-
Example:
|
10
|
-
|
11
|
-
plugin :json_parser,
|
12
|
-
:parser=>JSON.method(:parse),
|
13
|
-
:include_request=>false,
|
14
|
-
:error_handler=>proc{|r| r.halt [400, {}, []]}
|
15
|
-
|
16
|
-
* A path_rewriter plugin has been added, allowing for the rewriting
|
17
|
-
of paths before routing. This allows you to rewrite just the
|
18
|
-
routing path (the default), or PATH_INFO as well as the routing
|
19
|
-
path (if the :path_info option is used). This is useful if you
|
20
|
-
want to internally treat one path exactly the same as another
|
21
|
-
path.
|
22
|
-
|
23
|
-
By default, path rewriting is done on prefixes, so any path that
|
24
|
-
starts with the prefix will be rewritten. You can pass a
|
25
|
-
Regexp when rewriting the path for more complete control.
|
26
|
-
|
27
|
-
Examples:
|
28
|
-
|
29
|
-
plugin :path_rewriter
|
30
|
-
rewrite_path '/a', '/b'
|
31
|
-
# GET /a treated as GET /b
|
32
|
-
# GET /a/c treated as GET /b/c
|
33
|
-
|
34
|
-
rewrite_path /\A\/c\z/, '/d'
|
35
|
-
# GET /c treated as GET /d
|
36
|
-
# GET /c/e no change
|
37
|
-
|
38
|
-
* A precompiled_templates plugin has been added, for precompiling
|
39
|
-
templates before starting the application. This can save a
|
40
|
-
substantial amount of memory if you are using large templates or
|
41
|
-
a large number of small templates in conjunction when using
|
42
|
-
application preloading with a forking webserver. Example:
|
43
|
-
|
44
|
-
plugin :precompile_templates
|
45
|
-
precompile_templates "views/\*\*/*.erb"
|
46
|
-
precompile_templates "views/users/_*.erb", :locals=>[:user]
|
47
|
-
|
48
|
-
* A heartbeat plugin has been added, for easily handling
|
49
|
-
heartbeat/status requests. If a heartbeat/status request comes in,
|
50
|
-
it will get a 200 response with a body of "OK". This is designed
|
51
|
-
for automated systems that check if the application is functioning.
|
52
|
-
The default heartbeat path is /heartbeat, but you can choose a
|
53
|
-
different one using the :path option.
|
54
|
-
|
55
|
-
plugin :heartbeat, :path=>'/heartbeat'
|
56
|
-
|
57
|
-
= Other New Features
|
58
|
-
|
59
|
-
* The json plugin now supports a :serializer option to use a custom
|
60
|
-
serializer. Additionally, it now supports a :include_request
|
61
|
-
option to include the request when calling the serializer.
|
62
|
-
|
63
|
-
* In the render plugin, the render/view methods now support a
|
64
|
-
:cache=>false option to not cache the template. This can be useful
|
65
|
-
for large but rarely used templates, or where a new template object
|
66
|
-
is created for every render/view call.
|
67
|
-
|
68
|
-
* In the render plugin, the render/view methods now support a
|
69
|
-
:cache_key option to force a specific cache key. Manually setting
|
70
|
-
cache keys can result in improved performance, as automatically
|
71
|
-
determining the cache key can be a relatively expensive operation.
|
72
|
-
|
73
|
-
* The render plugin now supports a :engine_opts option, to specify
|
74
|
-
per-template engine options. :engine options should be a hash
|
75
|
-
keyed by render engine strings, with values being hashes of
|
76
|
-
template options.
|
77
|
-
|
78
|
-
* In the mailer plugin, a no_mail! method is now supported when
|
79
|
-
mailing, which will skip the current mail. This makes it easier
|
80
|
-
to delay the decision about actually sending the email till it is
|
81
|
-
time to send the email, which makes it easier to avoid race
|
82
|
-
conditions if you are using a job queue for mailing.
|
83
|
-
|
84
|
-
= Other Improvements
|
85
|
-
|
86
|
-
* Roda avoids rehashing hashes at runtime in some places, for a minor
|
87
|
-
speedup.
|
88
|
-
|
89
|
-
* If the :template_block is given to render/view, default to not
|
90
|
-
caching the template, since it is likely the template block is
|
91
|
-
specific to the request. Allow for the :cache=>true option to be
|
92
|
-
used to force the caching of the template.
|
93
|
-
|
94
|
-
* Roda now returns a 404 response for unmatched GET requests when
|
95
|
-
using the assets and json plugins where r.assets is the last
|
96
|
-
method called in a route block.
|
97
|
-
|
98
|
-
= Backwards Compatibility
|
99
|
-
|
100
|
-
* In the render plugin, the :ext option to the plugin and to the
|
101
|
-
render/view methods is now replaced by the :engine option.
|
102
|
-
Previously, :engine was used by default if :ext was not given. In
|
103
|
-
general, there is no need for two separate options, the engine is
|
104
|
-
used as the extension by Tilt.
|
105
|
-
|
106
|
-
In general, this is a backwards compatible change, except when
|
107
|
-
both :ext and :engine were specified differently as plugin options,
|
108
|
-
and an inline template is used with render or view without either
|
109
|
-
the :ext or :engine options being specified.
|