roda 3.54.0 → 3.57.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 (37) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +32 -0
  3. data/doc/conventions.rdoc +14 -11
  4. data/doc/release_notes/3.55.0.txt +12 -0
  5. data/doc/release_notes/3.56.0.txt +33 -0
  6. data/doc/release_notes/3.57.0.txt +34 -0
  7. data/lib/roda/plugins/chunked.rb +2 -2
  8. data/lib/roda/plugins/common_logger.rb +12 -1
  9. data/lib/roda/plugins/cookies.rb +2 -0
  10. data/lib/roda/plugins/hash_branch_view_subdir.rb +76 -0
  11. data/lib/roda/plugins/hash_branches.rb +145 -0
  12. data/lib/roda/plugins/hash_paths.rb +128 -0
  13. data/lib/roda/plugins/hash_routes.rb +13 -176
  14. data/lib/roda/plugins/json_parser.rb +6 -2
  15. data/lib/roda/plugins/middleware.rb +17 -2
  16. data/lib/roda/plugins/multi_public.rb +8 -0
  17. data/lib/roda/plugins/multi_route.rb +1 -1
  18. data/lib/roda/plugins/multi_view.rb +0 -4
  19. data/lib/roda/plugins/named_routes.rb +1 -2
  20. data/lib/roda/plugins/not_allowed.rb +13 -0
  21. data/lib/roda/plugins/public.rb +8 -0
  22. data/lib/roda/plugins/render.rb +5 -3
  23. data/lib/roda/plugins/route_csrf.rb +1 -0
  24. data/lib/roda/plugins/run_append_slash.rb +1 -1
  25. data/lib/roda/plugins/run_require_slash.rb +46 -0
  26. data/lib/roda/plugins/sessions.rb +1 -0
  27. data/lib/roda/plugins/sinatra_helpers.rb +10 -0
  28. data/lib/roda/plugins/static.rb +2 -0
  29. data/lib/roda/plugins/static_routing.rb +1 -1
  30. data/lib/roda/plugins/status_303.rb +6 -3
  31. data/lib/roda/plugins/status_handler.rb +35 -9
  32. data/lib/roda/plugins/symbol_status.rb +2 -0
  33. data/lib/roda/plugins/unescape_path.rb +2 -0
  34. data/lib/roda/request.rb +35 -1
  35. data/lib/roda/response.rb +5 -0
  36. data/lib/roda/version.rb +1 -1
  37. metadata +30 -6
data/lib/roda/request.rb CHANGED
@@ -1,6 +1,19 @@
1
1
  # frozen-string-literal: true
2
2
 
3
- require "rack"
3
+ # :nocov:
4
+ begin
5
+ require "rack/version"
6
+ rescue LoadError
7
+ require "rack"
8
+ else
9
+ if Rack.release >= '2.3'
10
+ require "rack/request"
11
+ else
12
+ require "rack"
13
+ end
14
+ end
15
+ # :nocov:
16
+
4
17
  require_relative "cache"
5
18
 
6
19
  class Roda
@@ -116,6 +129,27 @@ class Roda
116
129
  "#<#{self.class.inspect} #{@env["REQUEST_METHOD"]} #{path}>"
117
130
  end
118
131
 
132
+ # :nocov:
133
+ if Rack.release >= '2.3'
134
+ def http_version
135
+ # Prefer SERVER_PROTOCOL as it is required in Rack 3.
136
+ # Still fall back to HTTP_VERSION if SERVER_PROTOCOL
137
+ # is not set, in case the server in use is not Rack 3
138
+ # compliant.
139
+ @env['SERVER_PROTOCOL'] || @env['HTTP_VERSION']
140
+ end
141
+ else
142
+ # :nocov:
143
+ # What HTTP version the request was submitted with.
144
+ def http_version
145
+ # Prefer HTTP_VERSION as it is backwards compatible
146
+ # with previous Roda versions. Fallback to
147
+ # SERVER_PROTOCOL for servers that do not set
148
+ # HTTP_VERSION.
149
+ @env['HTTP_VERSION'] || @env['SERVER_PROTOCOL']
150
+ end
151
+ end
152
+
119
153
  # Does a terminal match on the current path, matching only if the arguments
120
154
  # have fully matched the path. If it matches, the match block is
121
155
  # executed, and when the match block returns, the rack response is
data/lib/roda/response.rb CHANGED
@@ -1,5 +1,10 @@
1
1
  # frozen-string-literal: true
2
2
 
3
+ begin
4
+ require 'rack/headers'
5
+ rescue LoadError
6
+ end
7
+
3
8
  class Roda
4
9
  # Base class used for Roda responses. The instance methods for this
5
10
  # class are added by Roda::RodaPlugins::Base::ResponseMethods, the class
data/lib/roda/version.rb CHANGED
@@ -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 = 54
7
+ RodaMinorVersion = 57
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.54.0
4
+ version: 3.57.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: 2022-03-14 00:00:00.000000000 Z
11
+ date: 2022-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: 5.7.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: minitest-hooks
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: minitest-global_expectations
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -109,7 +123,7 @@ dependencies:
109
123
  - !ruby/object:Gem::Version
110
124
  version: '0'
111
125
  - !ruby/object:Gem::Dependency
112
- name: sass
126
+ name: sassc
113
127
  requirement: !ruby/object:Gem::Requirement
114
128
  requirements:
115
129
  - - ">="
@@ -212,6 +226,9 @@ extra_rdoc_files:
212
226
  - doc/release_notes/3.52.0.txt
213
227
  - doc/release_notes/3.53.0.txt
214
228
  - doc/release_notes/3.54.0.txt
229
+ - doc/release_notes/3.55.0.txt
230
+ - doc/release_notes/3.56.0.txt
231
+ - doc/release_notes/3.57.0.txt
215
232
  - doc/release_notes/3.6.0.txt
216
233
  - doc/release_notes/3.7.0.txt
217
234
  - doc/release_notes/3.8.0.txt
@@ -273,6 +290,9 @@ files:
273
290
  - doc/release_notes/3.52.0.txt
274
291
  - doc/release_notes/3.53.0.txt
275
292
  - doc/release_notes/3.54.0.txt
293
+ - doc/release_notes/3.55.0.txt
294
+ - doc/release_notes/3.56.0.txt
295
+ - doc/release_notes/3.57.0.txt
276
296
  - doc/release_notes/3.6.0.txt
277
297
  - doc/release_notes/3.7.0.txt
278
298
  - doc/release_notes/3.8.0.txt
@@ -319,7 +339,10 @@ files:
319
339
  - lib/roda/plugins/flash.rb
320
340
  - lib/roda/plugins/h.rb
321
341
  - lib/roda/plugins/halt.rb
342
+ - lib/roda/plugins/hash_branch_view_subdir.rb
343
+ - lib/roda/plugins/hash_branches.rb
322
344
  - lib/roda/plugins/hash_matcher.rb
345
+ - lib/roda/plugins/hash_paths.rb
323
346
  - lib/roda/plugins/hash_routes.rb
324
347
  - lib/roda/plugins/head.rb
325
348
  - lib/roda/plugins/header_matchers.rb
@@ -372,6 +395,7 @@ files:
372
395
  - lib/roda/plugins/route_csrf.rb
373
396
  - lib/roda/plugins/run_append_slash.rb
374
397
  - lib/roda/plugins/run_handler.rb
398
+ - lib/roda/plugins/run_require_slash.rb
375
399
  - lib/roda/plugins/sessions.rb
376
400
  - lib/roda/plugins/shared_vars.rb
377
401
  - lib/roda/plugins/sinatra_helpers.rb
@@ -394,13 +418,13 @@ files:
394
418
  - lib/roda/response.rb
395
419
  - lib/roda/session_middleware.rb
396
420
  - lib/roda/version.rb
397
- homepage: http://roda.jeremyevans.net
421
+ homepage: https://roda.jeremyevans.net
398
422
  licenses:
399
423
  - MIT
400
424
  metadata:
401
425
  bug_tracker_uri: https://github.com/jeremyevans/roda/issues
402
- changelog_uri: http://roda.jeremyevans.net/rdoc/files/CHANGELOG.html
403
- documentation_uri: http://roda.jeremyevans.net/documentation.html
426
+ changelog_uri: https://roda.jeremyevans.net/rdoc/files/CHANGELOG.html
427
+ documentation_uri: https://roda.jeremyevans.net/documentation.html
404
428
  mailing_list_uri: https://github.com/jeremyevans/roda/discussions
405
429
  source_code_uri: https://github.com/jeremyevans/roda
406
430
  post_install_message: