roda 3.89.0 → 3.90.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5c056e15afde950dcb27063296ba5b911fe3b900d16c121dd8833374731cdbaa
4
- data.tar.gz: 95225a9c11b07979b50359df7451283eff570557c926f82c49cc34b67d1868fb
3
+ metadata.gz: c42c5f4d45d0f7fe64602e9d2a32bec3c690606c98709f7bd0bde537dd7a6463
4
+ data.tar.gz: c5f4edfdf88244770bd0184220df443ea5183c017f11c7342b4192db158d8d6c
5
5
  SHA512:
6
- metadata.gz: e38354627d456f2b2bd593703d4ef64f5e934c071d439f1d9647cc8ef010de5fb463d001068ce2e06fd57b0cbccd926005d199b76761ebadefeda699937f5501
7
- data.tar.gz: d542a024a5dd63bfa069baa38d2929bc0925d410641e303839f4a408139614249f223c3054f1f827550522aa21c0f52429184d3484001f7ed6996bbb9b366add
6
+ metadata.gz: 19ccf7e44d75f36bc372f2dcad01bb9bf23831c12397d142ea94d1e5f10d0cfe1be3f62f8f45e584ab9e4d0510c8d6acba7dd13e5d9df0680dece3838a43f5a6
7
+ data.tar.gz: 48e7c8fc21d75df1adfb616fa5fa88c2b410b290168b2fa1b14ab2c53f8f33167e039f310007dc19831e0571c4ce2b2d34c023b8b88c07d4ff666afe4b426ce9
@@ -56,14 +56,15 @@ class Roda
56
56
 
57
57
  env = @_request.env
58
58
 
59
- line = "#{env['HTTP_X_FORWARDED_FOR'] || env["REMOTE_ADDR"] || "-"} - #{env["REMOTE_USER"] || "-"} [#{Time.now.strftime("%d/%b/%Y:%H:%M:%S %z")}] \"#{env["REQUEST_METHOD"]} #{env["SCRIPT_NAME"]}#{env["PATH_INFO"]}#{"?#{env["QUERY_STRING"]}" if ((qs = env["QUERY_STRING"]) && !qs.empty?)} #{@_request.http_version}\" #{status} #{((length = headers[RodaResponseHeaders::CONTENT_LENGTH]) && (length unless length == '0')) || '-'} #{elapsed_time}\n"
59
+ line = "#{env['HTTP_X_FORWARDED_FOR'] || env["REMOTE_ADDR"] || "-"} - #{env["REMOTE_USER"] || "-"} [#{Time.now.strftime("%d/%b/%Y:%H:%M:%S %z")}] \"#{env["REQUEST_METHOD"]} #{env["SCRIPT_NAME"]}#{env["PATH_INFO"]}#{"?#{env["QUERY_STRING"]}" if ((qs = env["QUERY_STRING"]) && !qs.empty?)} #{@_request.http_version}\" #{status} #{((length = headers[RodaResponseHeaders::CONTENT_LENGTH]) && (length unless length == '0')) || '-'} #{elapsed_time} "
60
60
  if MUTATE_LINE
61
- line.gsub!(/[^[:print:]\n]/){|c| sprintf("\\x%x", c.ord)}
61
+ line.gsub!(/[^[:print:]]/){|c| sprintf("\\x%x", c.ord)}
62
62
  # :nocov:
63
63
  else
64
- line = line.gsub(/[^[:print:]\n]/){|c| sprintf("\\x%x", c.ord)}
64
+ line = line.gsub(/[^[:print:]]/){|c| sprintf("\\x%x", c.ord)}
65
65
  # :nocov:
66
66
  end
67
+ line[-1] = "\n"
67
68
  opts[:common_logger_meth].call(line)
68
69
  end
69
70
 
@@ -134,9 +134,7 @@ class Roda
134
134
  # and store +app+ as the next middleware to call.
135
135
  def initialize(mid, app, *args, &block)
136
136
  @mid = Class.new(mid)
137
- # :nocov:
138
- @mid.set_temporary_name("#{mid.name}(middleware)") if mid.name && RUBY_VERSION >= "3.3"
139
- # :nocov:
137
+ RodaPlugins.set_temp_name(@mid){"#{mid}::middleware_subclass"}
140
138
  if @mid.opts[:middleware_next_if_not_found]
141
139
  @mid.plugin(:not_found, &NEXT_PROC)
142
140
  end
@@ -79,6 +79,7 @@ class Roda
79
79
  mod = instance_variable_get(iv)
80
80
  else
81
81
  mod = instance_variable_set(iv, Module.new)
82
+ RodaPlugins.set_temp_name(mod){"#{klass}::module_include"}
82
83
  klass.send(:include, mod)
83
84
  end
84
85
 
@@ -354,9 +354,7 @@ class Roda
354
354
  res.status = opts[:status] || s
355
355
  headers.delete(RodaResponseHeaders::CONTENT_LENGTH)
356
356
  headers.replace(h.merge!(headers))
357
- res.body = b
358
-
359
- halt
357
+ halt res.finish_with_body(b)
360
358
  rescue Errno::ENOENT
361
359
  not_found
362
360
  end
data/lib/roda/plugins.rb CHANGED
@@ -49,5 +49,20 @@ class Roda
49
49
  end
50
50
  # :nocov:
51
51
  end
52
+
53
+ if RUBY_VERSION >= '3.3'
54
+ # Create a new module using the block, and set the temporary name
55
+ # on it using the given a containing module and name.
56
+ def self.set_temp_name(mod)
57
+ mod.set_temporary_name(yield)
58
+ mod
59
+ end
60
+ # :nocov:
61
+ else
62
+ def self.set_temp_name(mod)
63
+ mod
64
+ end
65
+ end
66
+ # :nocov:
52
67
  end
53
68
  end
@@ -159,6 +159,7 @@ class RodaSessionMiddleware
159
159
  # Setup the middleware, passing +opts+ as the Roda sessions plugin options.
160
160
  def initialize(app, opts)
161
161
  mid = Class.new(Roda)
162
+ Roda::RodaPlugins.set_temp_name(mid){"RodaSessionMiddleware::_RodaSubclass"}
162
163
  mid.plugin :sessions, opts
163
164
  @req_class = mid::RodaRequest
164
165
  @req_class.send(:include, RequestMethods)
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 = 89
7
+ RodaMinorVersion = 90
8
8
 
9
9
  # The patch version of Roda, updated only for bug fixes from the last
10
10
  # feature release.
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roda
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.89.0
4
+ version: 3.90.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Evans
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-02-12 00:00:00.000000000 Z
10
+ date: 2025-03-11 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rack