roda 3.83.0 → 3.84.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/roda/plugins/hsts.rb +35 -0
- data/lib/roda/response.rb +1 -1
- data/lib/roda/version.rb +1 -1
- metadata +4 -179
- data/CHANGELOG +0 -691
- data/README.rdoc +0 -1136
- data/doc/conventions.rdoc +0 -177
- data/doc/release_notes/3.0.0.txt +0 -84
- data/doc/release_notes/3.1.0.txt +0 -24
- data/doc/release_notes/3.10.0.txt +0 -132
- data/doc/release_notes/3.11.0.txt +0 -54
- data/doc/release_notes/3.12.0.txt +0 -19
- data/doc/release_notes/3.13.0.txt +0 -38
- data/doc/release_notes/3.14.0.txt +0 -36
- data/doc/release_notes/3.14.1.txt +0 -43
- data/doc/release_notes/3.15.0.txt +0 -21
- data/doc/release_notes/3.16.0.txt +0 -52
- data/doc/release_notes/3.17.0.txt +0 -62
- data/doc/release_notes/3.18.0.txt +0 -170
- data/doc/release_notes/3.19.0.txt +0 -229
- data/doc/release_notes/3.2.0.txt +0 -22
- data/doc/release_notes/3.20.0.txt +0 -7
- data/doc/release_notes/3.21.0.txt +0 -5
- data/doc/release_notes/3.22.0.txt +0 -24
- data/doc/release_notes/3.23.0.txt +0 -28
- data/doc/release_notes/3.24.0.txt +0 -14
- data/doc/release_notes/3.25.0.txt +0 -12
- data/doc/release_notes/3.26.0.txt +0 -15
- data/doc/release_notes/3.27.0.txt +0 -15
- data/doc/release_notes/3.28.0.txt +0 -13
- data/doc/release_notes/3.29.0.txt +0 -15
- data/doc/release_notes/3.3.0.txt +0 -291
- data/doc/release_notes/3.30.0.txt +0 -14
- data/doc/release_notes/3.31.0.txt +0 -11
- data/doc/release_notes/3.32.0.txt +0 -42
- data/doc/release_notes/3.33.0.txt +0 -8
- data/doc/release_notes/3.34.0.txt +0 -17
- data/doc/release_notes/3.35.0.txt +0 -12
- data/doc/release_notes/3.36.0.txt +0 -17
- data/doc/release_notes/3.37.0.txt +0 -42
- data/doc/release_notes/3.38.0.txt +0 -5
- data/doc/release_notes/3.39.0.txt +0 -16
- data/doc/release_notes/3.4.0.txt +0 -24
- data/doc/release_notes/3.40.0.txt +0 -24
- data/doc/release_notes/3.41.0.txt +0 -9
- data/doc/release_notes/3.42.0.txt +0 -21
- data/doc/release_notes/3.43.0.txt +0 -34
- data/doc/release_notes/3.44.0.txt +0 -23
- data/doc/release_notes/3.45.0.txt +0 -22
- data/doc/release_notes/3.46.0.txt +0 -19
- data/doc/release_notes/3.47.0.txt +0 -13
- data/doc/release_notes/3.48.0.txt +0 -10
- data/doc/release_notes/3.49.0.txt +0 -18
- data/doc/release_notes/3.5.0.txt +0 -31
- data/doc/release_notes/3.50.0.txt +0 -21
- data/doc/release_notes/3.51.0.txt +0 -20
- data/doc/release_notes/3.52.0.txt +0 -20
- data/doc/release_notes/3.53.0.txt +0 -14
- data/doc/release_notes/3.54.0.txt +0 -48
- data/doc/release_notes/3.55.0.txt +0 -12
- data/doc/release_notes/3.56.0.txt +0 -33
- data/doc/release_notes/3.57.0.txt +0 -34
- data/doc/release_notes/3.58.0.txt +0 -16
- data/doc/release_notes/3.59.0.txt +0 -17
- data/doc/release_notes/3.6.0.txt +0 -21
- data/doc/release_notes/3.60.0.txt +0 -56
- data/doc/release_notes/3.61.0.txt +0 -24
- data/doc/release_notes/3.62.0.txt +0 -41
- data/doc/release_notes/3.63.0.txt +0 -36
- data/doc/release_notes/3.64.0.txt +0 -26
- data/doc/release_notes/3.65.0.txt +0 -12
- data/doc/release_notes/3.66.0.txt +0 -23
- data/doc/release_notes/3.67.0.txt +0 -25
- data/doc/release_notes/3.68.0.txt +0 -21
- data/doc/release_notes/3.69.0.txt +0 -33
- data/doc/release_notes/3.7.0.txt +0 -123
- data/doc/release_notes/3.70.0.txt +0 -19
- data/doc/release_notes/3.71.0.txt +0 -33
- data/doc/release_notes/3.72.0.txt +0 -48
- data/doc/release_notes/3.73.0.txt +0 -33
- data/doc/release_notes/3.74.0.txt +0 -28
- data/doc/release_notes/3.75.0.txt +0 -19
- data/doc/release_notes/3.76.0.txt +0 -18
- data/doc/release_notes/3.77.0.txt +0 -8
- data/doc/release_notes/3.78.0.txt +0 -99
- data/doc/release_notes/3.79.0.txt +0 -148
- data/doc/release_notes/3.8.0.txt +0 -27
- data/doc/release_notes/3.80.0.txt +0 -31
- data/doc/release_notes/3.81.0.txt +0 -24
- data/doc/release_notes/3.82.0.txt +0 -43
- data/doc/release_notes/3.83.0.txt +0 -6
- data/doc/release_notes/3.9.0.txt +0 -67
@@ -1,19 +0,0 @@
|
|
1
|
-
= Improvements
|
2
|
-
|
3
|
-
* The r.on, r.is, r.get and r.post methods (and other verb methods
|
4
|
-
if using the all_verbs plugin) have now been optimized when using
|
5
|
-
a single string or regexp matcher, or the String or Integer class
|
6
|
-
matcher. Since those four matchers are the most common types of
|
7
|
-
matchers passed to the methods, this can significantly improve
|
8
|
-
routing performance (about 50% in the r10k benchmark).
|
9
|
-
|
10
|
-
This optimization is automatically applied when freezing
|
11
|
-
applications, if the related methods have not been modified by
|
12
|
-
plugins.
|
13
|
-
|
14
|
-
This optimization does come at the expense of a small decrease
|
15
|
-
in routing performance (3-4%) for unoptimized cases, but the
|
16
|
-
majority of applications will see a overall performance benefit
|
17
|
-
from this change.
|
18
|
-
|
19
|
-
* Other minor performance improvements have been made.
|
@@ -1,13 +0,0 @@
|
|
1
|
-
= Improvements
|
2
|
-
|
3
|
-
* The r.on optimization added in 3.46.0 has been extended to optimize
|
4
|
-
all single argument calls. This results in the following speedups
|
5
|
-
based on argument type:
|
6
|
-
|
7
|
-
* Hash matching: 10%
|
8
|
-
* Array/Symbol/Class matching: 15%
|
9
|
-
* Proc matching: 25%
|
10
|
-
* true matching: 45%
|
11
|
-
* false/nil matching: 65%
|
12
|
-
|
13
|
-
* Other minor performance improvements have been made.
|
@@ -1,10 +0,0 @@
|
|
1
|
-
= New Features
|
2
|
-
|
3
|
-
* A named_routes plugin has been added, for defining named route
|
4
|
-
blocks that you can dispatch to with r.route. This feature was
|
5
|
-
previously available as part of the multi_route plugin, but there
|
6
|
-
are cases where the r.route method and support for named routes is
|
7
|
-
helpful even when the multi_route plugin is not used (such as when
|
8
|
-
the hash_routes plugin is used instead of the multi_route plugin).
|
9
|
-
The multi_route plugin now depends on the named_routes plugin, so
|
10
|
-
this change should not cause any backwards compatibility issues.
|
@@ -1,18 +0,0 @@
|
|
1
|
-
= Improvements
|
2
|
-
|
3
|
-
* The r.is optimization added in 3.46.0 has been extended to optimize
|
4
|
-
all single argument calls. This results in the following speedups
|
5
|
-
based on argument type:
|
6
|
-
|
7
|
-
* Hash/Class matching: 20%
|
8
|
-
* Symbol matching: 25%
|
9
|
-
* Array matching: 35%
|
10
|
-
* Proc matching: 50%
|
11
|
-
* false/nil matching: 65%
|
12
|
-
|
13
|
-
* Roda now uses defined?(yield) instead of block_given? internally
|
14
|
-
for better performance on CRuby. defined?(yield) is faster as it is
|
15
|
-
built into the VM, while block_given? is a regular method and has
|
16
|
-
the overhead of calling a regular method. Note that defined?(yield)
|
17
|
-
is not implemented correctly on JRuby before 9.0.0.0, so this
|
18
|
-
release of Roda drops support for JRuby versions before 9.0.0.0.
|
data/doc/release_notes/3.5.0.txt
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
= New Features
|
2
|
-
|
3
|
-
* A request_aref plugin has been added for configuring the behavior
|
4
|
-
of the [] and []= request methods. These methods are deprecated
|
5
|
-
in the current version of Rack, but Rack will only print a
|
6
|
-
deprecation warning in verbose mode. With this plugin, you can
|
7
|
-
choose to never warn, always warn, or raise an exception:
|
8
|
-
|
9
|
-
# Don't emit a warning, allowing for the historical Rack
|
10
|
-
# behavior
|
11
|
-
plugin :request_aref, :allow
|
12
|
-
|
13
|
-
# Always emit a warning when the method is called
|
14
|
-
plugin :request_aref, :warn
|
15
|
-
|
16
|
-
# Raise an exception if the method is called
|
17
|
-
plugin :request_aref, :raise
|
18
|
-
|
19
|
-
= Other Improvements
|
20
|
-
|
21
|
-
* When using the content_for plugin and calling content_for with a
|
22
|
-
block, convert the result of the block to a string before passing
|
23
|
-
the result to Tilt. This can fix issues when the template class
|
24
|
-
that Tilt uses does not handle non-String input.
|
25
|
-
|
26
|
-
* When using the public plugin with the :gzip option, do not add the
|
27
|
-
Content-Type or Content-Encoding headers if a 304 response is
|
28
|
-
returned.
|
29
|
-
|
30
|
-
* Add the spec/views/about directory to the gem, allowing the specs
|
31
|
-
to run correctly using just the files in the gem.
|
@@ -1,21 +0,0 @@
|
|
1
|
-
= New Features
|
2
|
-
|
3
|
-
* An inject_erb plugin has been added, adding an inject_erb method
|
4
|
-
that allows for injecting content directly into the template output
|
5
|
-
for the template currently being rendered. This allows you to more
|
6
|
-
easily wrap blocks in templates, by calling methods that accept
|
7
|
-
template blocks and injecting content before and after the block.
|
8
|
-
|
9
|
-
* A capture_erb plugin has been added, adding a capture_erb method
|
10
|
-
for capturing a template block in an erb template and returning
|
11
|
-
the content appended during the block as a string, instead of
|
12
|
-
having the content of the template block be included directly into
|
13
|
-
the template output. This can be combined with the inject_erb
|
14
|
-
plugin to inject modified versions of captured blocks into template
|
15
|
-
output.
|
16
|
-
|
17
|
-
* The hash_routes plugin now allows calling hash_branch and hash_path
|
18
|
-
without a block in order to remove the existing route handler. This
|
19
|
-
is designed to be used with code reloading libraries, so that if a
|
20
|
-
route file is deleted, the related hash branches/paths are also
|
21
|
-
removed, without having to reload all route files.
|
@@ -1,20 +0,0 @@
|
|
1
|
-
= New Features
|
2
|
-
|
3
|
-
* The named_routes plugin now allows calling route without a block
|
4
|
-
to remove the existing route handler. The multi_run plugin
|
5
|
-
now allows calling run without an app to remove an existing handler.
|
6
|
-
These changes are designed to better support code reloading
|
7
|
-
libraries, so that if the related file is deleted, the related
|
8
|
-
handlers are also removed, without having to reload the entire
|
9
|
-
application.
|
10
|
-
|
11
|
-
= Other Improvements
|
12
|
-
|
13
|
-
* The error_handler plugin now avoids a method redefinition warning
|
14
|
-
in verbose warning mode.
|
15
|
-
|
16
|
-
= Other
|
17
|
-
|
18
|
-
* Roda's primary discussion forum is now GitHub Discussions. The
|
19
|
-
ruby-roda Google Group is still available for users who would
|
20
|
-
prefer to use that instead.
|
@@ -1,20 +0,0 @@
|
|
1
|
-
= New Features
|
2
|
-
|
3
|
-
* The typecast_params plugin now supports a :date_parse_input_handler
|
4
|
-
option that will be called with all input that will be passed to
|
5
|
-
the date parsing methods. You can use this option to automatically
|
6
|
-
truncate input, if that is perferable to raising an error (which is
|
7
|
-
how recent versions of Ruby handle too-long input).
|
8
|
-
|
9
|
-
= Other Improvements
|
10
|
-
|
11
|
-
* The path helper methods added by the path plugin now support
|
12
|
-
blocks that use keyword arguments on Ruby 3+.
|
13
|
-
|
14
|
-
* The assets plugin now uses OpenSSL::Digest instead of Digest (if
|
15
|
-
available) for calculating SRI digests. This is faster on Ruby 3+,
|
16
|
-
where Digest no longer uses the faster OpenSSL::Digest automatically
|
17
|
-
if available.
|
18
|
-
|
19
|
-
* Roda.freeze now returns self when the multi_route plugin is used.
|
20
|
-
This was broken (not returning self) starting in 3.48.0.
|
@@ -1,14 +0,0 @@
|
|
1
|
-
= New Features
|
2
|
-
|
3
|
-
* An additional_view_directories plugin has been added, which allows
|
4
|
-
you to specify additional directories to look in for templates.
|
5
|
-
If the template path does not exist when using the default view
|
6
|
-
directory, then each additional view directory will be checked,
|
7
|
-
returning the first path that exists:
|
8
|
-
|
9
|
-
plugin :additional_view_directories, ['admin_views', 'public_views']
|
10
|
-
|
11
|
-
= Other Improvements
|
12
|
-
|
13
|
-
* The indifferent_params plugin now avoids a deprecation warning when
|
14
|
-
using the rack main branch, which will become Rack 3.
|
@@ -1,48 +0,0 @@
|
|
1
|
-
= New Features
|
2
|
-
|
3
|
-
* You can now override the type attribute for script tags produced
|
4
|
-
by the assets plugin, by providing a :type attribute when calling
|
5
|
-
the assets method.
|
6
|
-
|
7
|
-
= Other Improvements
|
8
|
-
|
9
|
-
* Reloading the render plugin after the additional_view_directories
|
10
|
-
plugin no longer removes the additional view directories from
|
11
|
-
the allowed paths for templates.
|
12
|
-
|
13
|
-
* When using Rack 3, Roda will now use an instance of Rack::Headers
|
14
|
-
instead of a plain hash for the headers, allowing for compliance
|
15
|
-
with the Rack 3 SPEC (which will require lowercase header keys).
|
16
|
-
|
17
|
-
* The public, multi_public, and sinatra_helpers plugin now use
|
18
|
-
Rack::Files instead of Rack::File if available, as Rack::File will
|
19
|
-
be deprecated in Rack 3.0.
|
20
|
-
|
21
|
-
* The json_parser plugin no longer rewinds the request body before
|
22
|
-
and after reading it when used with Rack 3.0, as Rack 3.0 has
|
23
|
-
dropped the requirement for rewindable input.
|
24
|
-
|
25
|
-
* The run_handler plugin now closes bodies for upstream 404 responses
|
26
|
-
when using the not_found: :pass option.
|
27
|
-
|
28
|
-
* The chunked plugin no longer uses Transfer-Encoding: chunked by
|
29
|
-
default. Requiring the use of Transfer-Encoding: chunked made the
|
30
|
-
plugin only work on HTTP 1.1, and not older or newer versions. The
|
31
|
-
plugin still allows for streaming template bodies as they are being
|
32
|
-
rendered. To get the previous behavior of forcing the use of
|
33
|
-
Transfer-Encoding: chunked, you can use the :force_chunked_encoding
|
34
|
-
plugin option
|
35
|
-
|
36
|
-
* Roda now supports testing with Rack::Lint. This found multiple
|
37
|
-
violations of the Rack SPEC which are fixed in this version, and
|
38
|
-
should ensure that Roda stays in compliance with the Rack SPEC going
|
39
|
-
forward.
|
40
|
-
|
41
|
-
= Backwards Compatibility
|
42
|
-
|
43
|
-
* Roda will no longer set the Content-Length header for 205 responses
|
44
|
-
when using Rack <2.0.2, as doing so violates the Rack SPEC for those
|
45
|
-
Rack versions.
|
46
|
-
|
47
|
-
* The drop_body plugin now drops response bodies for all 1xx responses,
|
48
|
-
not just for 100 and 101 responses, in compliance with the Rack SPEC.
|
@@ -1,12 +0,0 @@
|
|
1
|
-
= New Features
|
2
|
-
|
3
|
-
* A :forward_response_headers option has been added to the middleware
|
4
|
-
plugin, which uses the response headers added by the middleware
|
5
|
-
as default response headers even if the middleware does not handle
|
6
|
-
the response. Response headers set by the underlying application
|
7
|
-
take precedence over response headers set by the middleware.
|
8
|
-
|
9
|
-
* The render plugin view method now accepts a block and will pass the
|
10
|
-
block to the underlying render method call. This is useful for
|
11
|
-
rendering a template that yields inside of an existing layout.
|
12
|
-
Previously, you had to nest render calls to do that.
|
@@ -1,33 +0,0 @@
|
|
1
|
-
= New Features
|
2
|
-
|
3
|
-
* RodaRequest#http_version has been added for determining the HTTP
|
4
|
-
version the request was submitted with. This will be a string
|
5
|
-
such as "HTTP/1.0", "HTTP/1.1", "HTTP/2", etc. This will use the
|
6
|
-
SERVER_PROTOCOL and HTTP_VERSION entries from the environment to
|
7
|
-
determine which HTTP version is in use.
|
8
|
-
|
9
|
-
* The status_handler method in the status_handler plugin now supports
|
10
|
-
a :keep_headers option. The value for this option should be an
|
11
|
-
array of header names to keep. All other headers are removed. The
|
12
|
-
default behavior without the option is still to remove all headers.
|
13
|
-
|
14
|
-
* A run_require_slash plugin has been added, which will skip
|
15
|
-
dispatching to another rack application if the remaining path is not
|
16
|
-
empty and does not start with a slash.
|
17
|
-
|
18
|
-
= Other Improvements
|
19
|
-
|
20
|
-
* The status_303 plugin will use 303 as the default redirect status
|
21
|
-
for non-GET requests for HTTP/2 and higher HTTP versions. Previously,
|
22
|
-
it only used 303 for HTTP/1.1.
|
23
|
-
|
24
|
-
* The not_allowed plugin now overrides the r.root method to return
|
25
|
-
405 responses to non-GET requests to the root.
|
26
|
-
|
27
|
-
* The not_allowed plugin no longer sets the body when returning 405
|
28
|
-
responses using methods such as r.get and r.post. Previously, the
|
29
|
-
body was unintentionally set to the same value as the Allow header.
|
30
|
-
|
31
|
-
* When using the Rack master branch (what will become Rack 3), Roda
|
32
|
-
only requires the parts of rack that it uses, instead of requiring
|
33
|
-
rack and relying on autoload to load the parts of rack in use.
|
@@ -1,34 +0,0 @@
|
|
1
|
-
= New Features
|
2
|
-
|
3
|
-
* hash_branches and hash_paths plugins have been split off from the
|
4
|
-
hash_routes plugin, allowing you to use only those parts instead
|
5
|
-
of all of hash_routes.
|
6
|
-
|
7
|
-
The hash_branches plugin supports the hash_branch class method
|
8
|
-
and r.hash_branches routing method.
|
9
|
-
|
10
|
-
The hash_paths plugin supports the hash_path class method and
|
11
|
-
r.hash_paths routing method.
|
12
|
-
|
13
|
-
The hash_routes plugin functions as it did previously by
|
14
|
-
requiring the hash_branches and hash_paths plugins. It adds
|
15
|
-
the hash_routes DSL and r.hash_routes routing method.
|
16
|
-
|
17
|
-
* A hash_branch_view_subdir has been added. It builds on the
|
18
|
-
view_options plugin and new hash_branches plugin, automatically
|
19
|
-
appending a view subdirectory for each successful hash branch.
|
20
|
-
This can DRY up code that uses a separate view subdirectory for
|
21
|
-
each branch.
|
22
|
-
|
23
|
-
= Other Improvements
|
24
|
-
|
25
|
-
* Unprintable characters are now hex escaped in the output of the
|
26
|
-
common_logger plugin. This can protect users who use software
|
27
|
-
that respects shell escape sequences to view the logs.
|
28
|
-
|
29
|
-
= Backwards Compatibility
|
30
|
-
|
31
|
-
* The static_routing plugin now depends on the hash_paths plugin
|
32
|
-
instead of the hash_routes plugin, so you will need to update
|
33
|
-
your application to explicitly load the hash_routes plugin if
|
34
|
-
you were relying on static_routing to implicitly load it.
|
@@ -1,16 +0,0 @@
|
|
1
|
-
= New Features
|
2
|
-
|
3
|
-
* A filter_common_logger plugin has been added, allowing you to skip
|
4
|
-
logging of certain requests in the common_logger plugin. This
|
5
|
-
allows you to only log requests for certain paths, or only log
|
6
|
-
requests for certain types of responses.
|
7
|
-
|
8
|
-
= Other Improvements
|
9
|
-
|
10
|
-
* The heartbeat plugin is now compatible with recent changes in the
|
11
|
-
rack master branch (what will be rack 3).
|
12
|
-
|
13
|
-
* The exception_page plugin will now use Exception#detailed_message
|
14
|
-
on Ruby 3.2+, preserving the did_you_mean and error_highlight
|
15
|
-
information. Additionally, the display of exception messages
|
16
|
-
has been improved.
|
@@ -1,17 +0,0 @@
|
|
1
|
-
= New Features
|
2
|
-
|
3
|
-
* An additional_render_engines plugin has been added, for considering
|
4
|
-
multiple render engines for templates. If the template path does not
|
5
|
-
exist for the default render engine, then each additional render
|
6
|
-
engine will be checked, returning the first path that exists:
|
7
|
-
|
8
|
-
plugin :additional_render_engines, ['haml', 'str']
|
9
|
-
|
10
|
-
This is similar to the additional_view_directories plugin added in
|
11
|
-
3.53.0. Both plugins can be used if you want to consider multiple
|
12
|
-
view directories and multiple render engines.
|
13
|
-
|
14
|
-
= Other Improvements
|
15
|
-
|
16
|
-
* A typo in a private method name in the delete_empty_headers plugin
|
17
|
-
has been fixed.
|
data/doc/release_notes/3.6.0.txt
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
= New Features
|
2
|
-
|
3
|
-
* An early_hints plugin has been added for senting 103 Early Hint
|
4
|
-
responses. This is currently only supported on puma 3.11+, and
|
5
|
-
can allow for improved performance by letting the requestor know
|
6
|
-
which related files will be needed by the request.
|
7
|
-
|
8
|
-
* An :early_hints option has been added to the assets plugin. If
|
9
|
-
given, calling the assets method will also issue an early hint
|
10
|
-
for the related assets.
|
11
|
-
|
12
|
-
* A :wrap option has been added to the json_parser plugin. If set
|
13
|
-
to :always, all uploaded json data will be stored using a hash
|
14
|
-
with a "_json" key. If set to :unless_hash, uploaded json data
|
15
|
-
will only be wrapped in such a matter if it is not already a hash.
|
16
|
-
|
17
|
-
Using the :wrap option can fix problems when using r.params when
|
18
|
-
the uploaded JSON data is an array and not a hash. However, it
|
19
|
-
does change the behavior of r.POST. It is possible to handle
|
20
|
-
uploaded JSON array data without the :wrap option by using r.GET
|
21
|
-
and r.POST directly instead of using r.params.
|
@@ -1,56 +0,0 @@
|
|
1
|
-
= New Features
|
2
|
-
|
3
|
-
* A link_to plugin has been added with a link_to method for
|
4
|
-
creating HTML links.
|
5
|
-
|
6
|
-
The simplest usage of link_to is passing the body and the location
|
7
|
-
to link to as strings:
|
8
|
-
|
9
|
-
# Instance level
|
10
|
-
link_to("body", "/path")
|
11
|
-
# => "<a href=\"/path\">body</a>"
|
12
|
-
|
13
|
-
The link_to plugin depends on the path plugin, and allows you to
|
14
|
-
pass symbols for named paths:
|
15
|
-
|
16
|
-
# Class level
|
17
|
-
path :foo, "/path/to/too"
|
18
|
-
|
19
|
-
# Instance level
|
20
|
-
link_to("body", :foo)
|
21
|
-
# => "<a href=\"/path/to/foo\">body</a>"
|
22
|
-
|
23
|
-
It also allows you to pass instances of classes that you have
|
24
|
-
registered with the path plugin:
|
25
|
-
|
26
|
-
# Class level
|
27
|
-
A = Struct.new(:id)
|
28
|
-
path A do
|
29
|
-
"/path/to/a/#{id}"
|
30
|
-
end
|
31
|
-
|
32
|
-
# Instance level
|
33
|
-
link_to("body", A.new(1))
|
34
|
-
# => "<a href=\"/path/to/a/1\">body</a>"
|
35
|
-
|
36
|
-
To set additional HTML attributes on the tag, you can pass them as
|
37
|
-
an options hash:
|
38
|
-
|
39
|
-
link_to("body", "/path", foo: "bar")
|
40
|
-
# => "<a href=\"/path\" foo=\"bar\">body</a>"
|
41
|
-
|
42
|
-
If the body is nil, it will be set to the same as the path:
|
43
|
-
|
44
|
-
link_to(nil, "/path")
|
45
|
-
# => "<a href=\"/path\">/path</a>"
|
46
|
-
|
47
|
-
The plugin will automatically HTML escape the path and any HTML
|
48
|
-
attribute values, using the h plugin:
|
49
|
-
|
50
|
-
link_to("body", "/path?a=1&b=2", foo: '"bar"')
|
51
|
-
# => "<a href=\"/path?a=1&b=2\" foo=\""bar"\">body</a>"
|
52
|
-
|
53
|
-
= Other Improvements
|
54
|
-
|
55
|
-
* Coverage testing has been expanded to multiple rack versions, instead
|
56
|
-
of just the current rack release.
|
@@ -1,24 +0,0 @@
|
|
1
|
-
= Improvements
|
2
|
-
|
3
|
-
* The typecast_params plugin now limits input bytesize for integer,
|
4
|
-
float, and date/time typecasts. If the input is over the allowed
|
5
|
-
bytesize, typecasting will fail. This prevents issues with trying
|
6
|
-
to typecast arbitrarily large input.
|
7
|
-
|
8
|
-
* The default Integer class matcher now limits integer segments to
|
9
|
-
100 characters by default, also to prevent issues with typecasting
|
10
|
-
arbitrarily large input. Segments larger than 100 characters will
|
11
|
-
no longer be matched by the Integer class matcher.
|
12
|
-
|
13
|
-
= Backwards Compatibility
|
14
|
-
|
15
|
-
* If the input bytesize limits in the typecast_params plugin cause
|
16
|
-
issues in your application, you can use the :skip_bytesize_checking
|
17
|
-
option when loading the plugin to disable the checks.
|
18
|
-
|
19
|
-
* If the default Integer class matcher limit causes problems in your
|
20
|
-
application, you can use the class_matchers plugin to override the
|
21
|
-
matcher to not use a limit:
|
22
|
-
|
23
|
-
plugin :class_matchers
|
24
|
-
class_matcher(Integer, /(\d+)/){|a| [a.to_i]}
|
@@ -1,41 +0,0 @@
|
|
1
|
-
= New Features
|
2
|
-
|
3
|
-
* An Integer_matcher_max plugin has been added for setting the
|
4
|
-
maximum value matched by the Integer matcher (the minimum is
|
5
|
-
always 0, since the Integer matcher does not match negative
|
6
|
-
integers). The default maximum value when using the plugin
|
7
|
-
is 2**63-1, the maximum value for a signed 64-bit integer.
|
8
|
-
You can specify a different maximum value by passing an argument
|
9
|
-
when loading the plugin.
|
10
|
-
|
11
|
-
* A typecast_params_sized_integers plugin has been added for
|
12
|
-
converting parameters to integers only if the integer is within a
|
13
|
-
specific size. By default, the plugin supports 8-bit, 16-bit,
|
14
|
-
32-bit, and 64-bit signed and unsigned integer types, with the
|
15
|
-
following typecast_params methods added by the plugin:
|
16
|
-
|
17
|
-
* int8, uint8, pos_int8, pos_uint8, Integer8, Integeru8
|
18
|
-
* int16, uint16, pos_int16, pos_uint16, Integer16, Integeru16
|
19
|
-
* int32, uint32, pos_int32, pos_uint32, Integer32, Integeru32
|
20
|
-
* int64, uint64, pos_int64, pos_uint64, Integer64, Integeru64
|
21
|
-
|
22
|
-
You can override what sizes are added by default by using the
|
23
|
-
:sizes option. You can also specify a :default_size option,
|
24
|
-
in which case the default int, pos_int, and Integer conversions
|
25
|
-
will use the given size. So if you want to change the default
|
26
|
-
typecast_params integer conversion behavior to only support
|
27
|
-
integer values that can fit in 64-bit signed integers, you can
|
28
|
-
use:
|
29
|
-
|
30
|
-
plugin :typecast_params_sized_integers, sizes: [64],
|
31
|
-
default_size: 64
|
32
|
-
|
33
|
-
= Other Improvements
|
34
|
-
|
35
|
-
* The block passed to the class_matcher method in the class_matchers
|
36
|
-
plugin can now return nil/false to signal that it should not match.
|
37
|
-
This is useful when the regexp argument provided matches segments
|
38
|
-
not valid for the class.
|
39
|
-
|
40
|
-
* RodaRequest#matched_path now works correctly when using the
|
41
|
-
unescape_path plugin.
|
@@ -1,36 +0,0 @@
|
|
1
|
-
= New Features
|
2
|
-
|
3
|
-
* An autoload_hash_branches plugin has been added for autoloading
|
4
|
-
route files for each hash branch, instead of requiring the route
|
5
|
-
files be loaded up front. For example, to automatically load a
|
6
|
-
route file for a hash branch on the first request to that branch:
|
7
|
-
|
8
|
-
plugin :autoload_hash_branches
|
9
|
-
autoload_hash_branch('branch_name', '/path/to/file')
|
10
|
-
autoload_hash_branch('namespace', 'branch_name', '/path/to/file')
|
11
|
-
|
12
|
-
The route file loaded should define the expected hash branch.
|
13
|
-
|
14
|
-
It is common to have route files stored in a directory, with the
|
15
|
-
file name matching the branch name. In that case, you can set
|
16
|
-
autoloading for all route files in a given directory:
|
17
|
-
|
18
|
-
plugin :autoload_hash_branches
|
19
|
-
autoload_hash_branch_dir('/path/to/dir')
|
20
|
-
autoload_hash_branch_dir('namespace', '/path/to/dir')
|
21
|
-
|
22
|
-
Note that autoloading hash branches does not work if the application
|
23
|
-
is frozen. This plugin should only be used in development mode for
|
24
|
-
faster startup, or when running tests on a subset of the application
|
25
|
-
in order to avoid loading parts of the application unrelated to what
|
26
|
-
is being tested.
|
27
|
-
|
28
|
-
* The mailer plugin now supports a :terminal plugin option to make
|
29
|
-
the r.mail method force a terminal match, similar to how r.get
|
30
|
-
and other HTTP verb methods work in standard Roda. This behavior
|
31
|
-
will become the default in Roda 4.
|
32
|
-
|
33
|
-
= Other Improvements
|
34
|
-
|
35
|
-
* The mailer plugin now correctly sets the content_type of the body
|
36
|
-
for emails with attachments when using mail 2.8.0+.
|
@@ -1,26 +0,0 @@
|
|
1
|
-
= New Features
|
2
|
-
|
3
|
-
* An erb_h plugin has been added for faster HTML escaping using
|
4
|
-
erb/escape. erb 4 added erb/escape and it is included in Ruby 3.2.
|
5
|
-
|
6
|
-
The erb_h plugin is added as a separate plugin because it changes
|
7
|
-
the behavior of the h method. The h method added by the h plugin
|
8
|
-
will always return a new string, but the h method added by the
|
9
|
-
erb_h plugin will return the argument if the argument is a
|
10
|
-
string that does not need escaping. By avoiding unnecessary
|
11
|
-
string allocations, use of the erb_h plugin can speed up HTML
|
12
|
-
escaping.
|
13
|
-
|
14
|
-
= Other Improvements
|
15
|
-
|
16
|
-
* The autoload_hash_branches plugin added in Roda 3.63.0 will now
|
17
|
-
eagerly load the hash branches when freezing the application,
|
18
|
-
allowing the application to continue to work after being frozen.
|
19
|
-
Additionally, file paths for the hash branches will now be
|
20
|
-
automatically expanded, allowing the use of relative file paths.
|
21
|
-
|
22
|
-
= Backwards Compatibility
|
23
|
-
|
24
|
-
* The expanding of file paths in the autoload_hash_branches plugin
|
25
|
-
can break applications that were providing relative paths and
|
26
|
-
expecting them to be looked up using the Ruby load path.
|
@@ -1,12 +0,0 @@
|
|
1
|
-
= New Features
|
2
|
-
|
3
|
-
* An autoload_named_routes plugin has been added for autoloading files
|
4
|
-
for a named route setup by the named_routes plugin when there is a
|
5
|
-
request for that route.
|
6
|
-
|
7
|
-
= Other Improvements
|
8
|
-
|
9
|
-
* The path method in the path plugin now supports a :class_name option.
|
10
|
-
You can set this option to true and use a class name String/Symbol
|
11
|
-
to register paths for classes without referencing the related class,
|
12
|
-
useful when autoloading the class.
|
@@ -1,23 +0,0 @@
|
|
1
|
-
= New Features
|
2
|
-
|
3
|
-
* A render_coverage plugin has been added, which will cause compiled
|
4
|
-
template code to be saved to a folder and loaded using load instead
|
5
|
-
of eval. This allows for coverage to work for the compiled template
|
6
|
-
code in Ruby versions before 3.2. It can also allow for verbose
|
7
|
-
syntax warnings in compiled template code (ignored by eval), and
|
8
|
-
can also be useful for static analysis of compiled template code.
|
9
|
-
This plugin requires tilt 2.1+.
|
10
|
-
|
11
|
-
* The exception_page plugin now supports exception_page_{css,js}
|
12
|
-
instance methods for overriding the CSS and JavaScript on the
|
13
|
-
generated exception page.
|
14
|
-
|
15
|
-
= Other Improvements
|
16
|
-
|
17
|
-
* Using inline templates (render/view :inline option) no longer keeps
|
18
|
-
a reference to the Roda instance that caches the template.
|
19
|
-
|
20
|
-
= Backwards Compatibility
|
21
|
-
|
22
|
-
* The Render::TemplateMtimeWrapper API has changed. Any external
|
23
|
-
use of this class needs to be updated.
|
@@ -1,25 +0,0 @@
|
|
1
|
-
= New Feature
|
2
|
-
|
3
|
-
* A custom_block_results plugin has been added for custom handling
|
4
|
-
of block results. This allows routing blocks to return
|
5
|
-
arbitrary objects instead of just String, nil, and false, and
|
6
|
-
to have custom handling for them. For example, if you want to
|
7
|
-
be able to have your routing blocks return the status code to use,
|
8
|
-
you could do:
|
9
|
-
|
10
|
-
plugin :custom_block_results
|
11
|
-
|
12
|
-
handle_block_result Integer do |result|
|
13
|
-
response.status_code = result
|
14
|
-
end
|
15
|
-
|
16
|
-
route do |r|
|
17
|
-
200
|
18
|
-
end
|
19
|
-
|
20
|
-
While the expected use of the handle_block_result method is with
|
21
|
-
class arguments, you can use any argument that implements an
|
22
|
-
appropriate === method.
|
23
|
-
|
24
|
-
The symbol_views and json plugins, which support additional block
|
25
|
-
results, now use the custom_block_results plugin internally.
|
@@ -1,21 +0,0 @@
|
|
1
|
-
= New Feature
|
2
|
-
|
3
|
-
* Roda.run in the multi_run plugin now accepts blocks, to allow
|
4
|
-
autoloading of apps to dispatch to:
|
5
|
-
|
6
|
-
class App < Roda
|
7
|
-
plugin :multi_run
|
8
|
-
|
9
|
-
run("other_app"){OtherApp}
|
10
|
-
|
11
|
-
route do |r|
|
12
|
-
r.multi_run
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
With the above example, the block is not evaluated until a
|
17
|
-
request for the /other_app branch is received. If OtherApp is
|
18
|
-
autoloaded, this can speed up application startup and partial
|
19
|
-
testing. When freezing the application (for production use),
|
20
|
-
the block is eagerly loaded, so that requests to the
|
21
|
-
/other_app branch do not call the block on every request.
|