restify 2.0.0 → 2.0.2
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 +4 -4
- data/CHANGELOG.md +17 -0
- data/lib/restify/adapter/typhoeus.rb +28 -13
- data/lib/restify/relation.rb +6 -2
- data/lib/restify/version.rb +1 -1
- data/spec/restify/features/opentelemetry_spec.rb +46 -0
- data/spec/restify/features/webmock_spec.rb +27 -0
- data/spec/restify/relation_spec.rb +54 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/support/opentelemetry.rb +29 -0
- data/spec/support/stub_server.rb +4 -0
- data/vendor/bundle/ruby/3.4.0/bundler/gems/my-rubocop-3bcd2110ca87/LICENSE +21 -0
- data/vendor/bundle/ruby/3.4.0/bundler/gems/my-rubocop-3bcd2110ca87/README.md +23 -0
- data/vendor/bundle/ruby/3.4.0/gems/activesupport-8.0.2/CHANGELOG.md +255 -0
- data/vendor/bundle/ruby/3.4.0/gems/activesupport-8.0.2/MIT-LICENSE +20 -0
- data/vendor/bundle/ruby/3.4.0/gems/activesupport-8.0.2/README.rdoc +40 -0
- data/vendor/bundle/ruby/3.4.0/gems/addressable-2.8.7/CHANGELOG.md +301 -0
- data/vendor/bundle/ruby/3.4.0/gems/addressable-2.8.7/LICENSE.txt +202 -0
- data/vendor/bundle/ruby/3.4.0/gems/addressable-2.8.7/README.md +121 -0
- data/vendor/bundle/ruby/3.4.0/gems/base64-0.2.0/LICENSE.txt +22 -0
- data/vendor/bundle/ruby/3.4.0/gems/base64-0.2.0/README.md +48 -0
- data/vendor/bundle/ruby/3.4.0/gems/benchmark-0.4.0/README.md +138 -0
- data/vendor/bundle/ruby/3.4.0/gems/bigdecimal-3.1.9/LICENSE +56 -0
- data/vendor/bundle/ruby/3.4.0/gems/concurrent-ruby-1.3.5/CHANGELOG.md +603 -0
- data/vendor/bundle/ruby/3.4.0/gems/concurrent-ruby-1.3.5/LICENSE.txt +21 -0
- data/vendor/bundle/ruby/3.4.0/gems/concurrent-ruby-1.3.5/README.md +407 -0
- data/vendor/bundle/ruby/3.4.0/gems/connection_pool-2.5.3/LICENSE +20 -0
- data/vendor/bundle/ruby/3.4.0/gems/connection_pool-2.5.3/README.md +167 -0
- data/vendor/bundle/ruby/3.4.0/gems/drb-2.2.1/LICENSE.txt +22 -0
- data/vendor/bundle/ruby/3.4.0/gems/ethon-0.16.0/CHANGELOG.md +375 -0
- data/vendor/bundle/ruby/3.4.0/gems/ethon-0.16.0/LICENSE +20 -0
- data/vendor/bundle/ruby/3.4.0/gems/ethon-0.16.0/README.md +118 -0
- data/vendor/bundle/ruby/3.4.0/gems/ffi-1.17.2-x86_64-linux-gnu/CHANGELOG.md +473 -0
- data/vendor/bundle/ruby/3.4.0/gems/ffi-1.17.2-x86_64-linux-gnu/LICENSE +24 -0
- data/vendor/bundle/ruby/3.4.0/gems/ffi-1.17.2-x86_64-linux-gnu/LICENSE.SPECS +22 -0
- data/vendor/bundle/ruby/3.4.0/gems/ffi-1.17.2-x86_64-linux-gnu/README.md +137 -0
- data/vendor/bundle/ruby/3.4.0/gems/hitimes-3.1.0/LICENSE.txt +16 -0
- data/vendor/bundle/ruby/3.4.0/gems/hitimes-3.1.0/README.md +187 -0
- data/vendor/bundle/ruby/3.4.0/gems/i18n-1.14.7/MIT-LICENSE +20 -0
- data/vendor/bundle/ruby/3.4.0/gems/i18n-1.14.7/README.md +127 -0
- data/vendor/bundle/ruby/3.4.0/gems/little-plugger-1.1.4/README.rdoc +53 -0
- data/vendor/bundle/ruby/3.4.0/gems/logger-1.7.0/README.md +104 -0
- data/vendor/bundle/ruby/3.4.0/gems/logging-2.4.0/LICENSE +22 -0
- data/vendor/bundle/ruby/3.4.0/gems/logging-2.4.0/README.md +140 -0
- data/vendor/bundle/ruby/3.4.0/gems/minitest-5.25.5/README.rdoc +842 -0
- data/vendor/bundle/ruby/3.4.0/gems/msgpack-1.8.0/ChangeLog +368 -0
- data/vendor/bundle/ruby/3.4.0/gems/msgpack-1.8.0/LICENSE +177 -0
- data/vendor/bundle/ruby/3.4.0/gems/msgpack-1.8.0/README.md +302 -0
- data/vendor/bundle/ruby/3.4.0/gems/multi_json-1.15.0/CHANGELOG.md +275 -0
- data/vendor/bundle/ruby/3.4.0/gems/multi_json-1.15.0/LICENSE.md +20 -0
- data/vendor/bundle/ruby/3.4.0/gems/multi_json-1.15.0/README.md +121 -0
- data/vendor/bundle/ruby/3.4.0/gems/opentelemetry-api-1.5.0/CHANGELOG.md +193 -0
- data/vendor/bundle/ruby/3.4.0/gems/opentelemetry-api-1.5.0/LICENSE +201 -0
- data/vendor/bundle/ruby/3.4.0/gems/opentelemetry-api-1.5.0/README.md +68 -0
- data/vendor/bundle/ruby/3.4.0/gems/opentelemetry-common-0.22.0/CHANGELOG.md +98 -0
- data/vendor/bundle/ruby/3.4.0/gems/opentelemetry-common-0.22.0/LICENSE +201 -0
- data/vendor/bundle/ruby/3.4.0/gems/opentelemetry-common-0.22.0/README.md +62 -0
- data/vendor/bundle/ruby/3.4.0/gems/public_suffix-6.0.2/CHANGELOG.md +498 -0
- data/vendor/bundle/ruby/3.4.0/gems/public_suffix-6.0.2/LICENSE.txt +22 -0
- data/vendor/bundle/ruby/3.4.0/gems/public_suffix-6.0.2/README.md +222 -0
- data/vendor/bundle/ruby/3.4.0/gems/rack-3.1.15/CHANGELOG.md +1146 -0
- data/vendor/bundle/ruby/3.4.0/gems/rack-3.1.15/MIT-LICENSE +20 -0
- data/vendor/bundle/ruby/3.4.0/gems/rack-3.1.15/README.md +355 -0
- data/vendor/bundle/ruby/3.4.0/gems/rake-13.2.1/MIT-LICENSE +21 -0
- data/vendor/bundle/ruby/3.4.0/gems/rake-13.2.1/README.rdoc +155 -0
- data/vendor/bundle/ruby/3.4.0/gems/rake-release-1.3.0/LICENSE +21 -0
- data/vendor/bundle/ruby/3.4.0/gems/rake-release-1.3.0/README.md +107 -0
- data/vendor/bundle/ruby/3.4.0/gems/securerandom-0.4.1/README.md +72 -0
- data/vendor/bundle/ruby/3.4.0/gems/typhoeus-1.4.1/CHANGELOG.md +410 -0
- data/vendor/bundle/ruby/3.4.0/gems/typhoeus-1.4.1/LICENSE +22 -0
- data/vendor/bundle/ruby/3.4.0/gems/typhoeus-1.4.1/README.md +588 -0
- data/vendor/bundle/ruby/3.4.0/gems/tzinfo-2.0.6/LICENSE +19 -0
- data/vendor/bundle/ruby/3.4.0/gems/tzinfo-2.0.6/README.md +406 -0
- data/vendor/bundle/ruby/3.4.0/gems/uri-1.0.3/README.md +55 -0
- metadata +69 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c32d65b5a967073cd132c4ef1217feac5f5cb4a0939f85169f85342100bac323
|
4
|
+
data.tar.gz: 62a20c92f6fc2d1385a0deda66b45c1f47e160261825c2cef7441da45d1e05d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63e6635b67901b641c942993a158b05a2882298f6d51c909f7a35dbc3c911228091fd8eba961c89a1ff730ee32269e3cf7cd995868a5853495c43804dc931818
|
7
|
+
data.tar.gz: e762a1ecfd02c4f74c913f224e13fd9ae5d7d0d405f8861ad2b809be8c29956ba0b994cbad997801e16416bfa3fa02d7a0308a4b689ed5159cc40a8d7a1d9f6f
|
data/CHANGELOG.md
CHANGED
@@ -17,6 +17,23 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
17
17
|
|
18
18
|
### Breaks
|
19
19
|
|
20
|
+
## 2.0.2 - (2025-05-19)
|
21
|
+
|
22
|
+
---
|
23
|
+
|
24
|
+
### Fixes
|
25
|
+
|
26
|
+
- Restore literal false in parameter expansion (#68)
|
27
|
+
|
28
|
+
## 2.0.1 - (2025-02-16)
|
29
|
+
|
30
|
+
---
|
31
|
+
|
32
|
+
### Fixes
|
33
|
+
|
34
|
+
- Restore compatibility with WebMocks Typhoeus instrumentation
|
35
|
+
- Catch WebMock exception and bubble them to the request promises
|
36
|
+
|
20
37
|
## 2.0.0 - (2025-02-14)
|
21
38
|
|
22
39
|
---
|
@@ -23,19 +23,21 @@ module Restify
|
|
23
23
|
tcp_keepintvl: 5,
|
24
24
|
}.freeze
|
25
25
|
|
26
|
-
# Patch to
|
27
|
-
#
|
28
|
-
#
|
29
|
-
#
|
30
|
-
#
|
26
|
+
# Patch Hydra to restore the correct OpenTelemetry span when
|
27
|
+
# adding the request, so that the Ethon instrumentation can
|
28
|
+
# properly pick up the context where the Restify request
|
29
|
+
# originated from.
|
30
|
+
#
|
31
|
+
# Handle exception from Ethon or WebMock too, and reject the
|
32
|
+
# promise, so that the errors can be handled in user code.
|
33
|
+
# Otherwise, the user would only receive a Promise timeout.
|
31
34
|
module EasyOverride
|
32
|
-
def
|
33
|
-
request.
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
multi.add(handle)
|
35
|
+
def add(request)
|
36
|
+
OpenTelemetry::Trace.with_span(request._otel_span) do
|
37
|
+
super(request)
|
38
|
+
rescue Exception => e # rubocop:disable Lint/RescueException
|
39
|
+
request._restify_writer.reject(e)
|
40
|
+
end
|
39
41
|
end
|
40
42
|
end
|
41
43
|
|
@@ -78,7 +80,7 @@ module Restify
|
|
78
80
|
private
|
79
81
|
|
80
82
|
def convert(request, writer)
|
81
|
-
|
83
|
+
Request.new(
|
82
84
|
request.uri,
|
83
85
|
**@options,
|
84
86
|
method: request.method,
|
@@ -87,6 +89,9 @@ module Restify
|
|
87
89
|
timeout: request.timeout,
|
88
90
|
connecttimeout: request.timeout,
|
89
91
|
).tap do |req|
|
92
|
+
req._otel_span = OpenTelemetry::Trace.current_span
|
93
|
+
req._restify_writer = writer
|
94
|
+
|
90
95
|
req.on_complete do |response|
|
91
96
|
debug 'request:complete',
|
92
97
|
tag: request.object_id,
|
@@ -177,6 +182,16 @@ module Restify
|
|
177
182
|
def _log_prefix
|
178
183
|
"[#{object_id}/#{Thread.current.object_id}]"
|
179
184
|
end
|
185
|
+
|
186
|
+
class Request < ::Typhoeus::Request
|
187
|
+
# Keep track of the OTEL span and the restify promise in the
|
188
|
+
# queued Typhoeus request.
|
189
|
+
#
|
190
|
+
# We need to access these to restore the tracing context, or
|
191
|
+
# bubble up exception that happen in the background thread after
|
192
|
+
# queuing, but when Hydra adds the requests to libcurl.
|
193
|
+
attr_accessor :_otel_span, :_restify_writer
|
194
|
+
end
|
180
195
|
end
|
181
196
|
end
|
182
197
|
end
|
data/lib/restify/relation.rb
CHANGED
@@ -113,8 +113,12 @@ module Restify
|
|
113
113
|
|
114
114
|
def extract!(params)
|
115
115
|
@template.variables.each_with_object({}) do |var, hash|
|
116
|
-
|
117
|
-
|
116
|
+
sym = var.to_sym
|
117
|
+
if params.key?(var)
|
118
|
+
hash[var] = params.delete(var)
|
119
|
+
end
|
120
|
+
if params.key?(sym)
|
121
|
+
hash[sym] = params.delete(sym)
|
118
122
|
end
|
119
123
|
end
|
120
124
|
end
|
data/lib/restify/version.rb
CHANGED
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Restify do
|
6
|
+
subject(:echo) { resource.data }
|
7
|
+
|
8
|
+
let(:resource) { Restify.new('http://localhost:9292/echo').get.value! }
|
9
|
+
|
10
|
+
before do
|
11
|
+
expect(OTLE_EXPORTER.finished_spans).to be_empty
|
12
|
+
end
|
13
|
+
|
14
|
+
describe 'OpenTelemetry' do
|
15
|
+
it 'adds propagation header' do
|
16
|
+
expect(echo).to have_key('HTTP_TRACEPARENT')
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'adds spans' do
|
20
|
+
resource
|
21
|
+
|
22
|
+
spans = OTLE_EXPORTER.finished_spans
|
23
|
+
expect(spans.size).to eq 2
|
24
|
+
|
25
|
+
spans[1].tap do |span|
|
26
|
+
expect(span.instrumentation_scope.name).to eq 'restify'
|
27
|
+
expect(span.instrumentation_scope.version).to eq Restify::VERSION.to_s
|
28
|
+
expect(span.attributes).to eq({
|
29
|
+
'http.request.method' => 'GET',
|
30
|
+
'http.response.status_code' => 200,
|
31
|
+
'server.address' => 'localhost',
|
32
|
+
'server.port' => 9292,
|
33
|
+
'url.full' => 'http://localhost:9292/echo',
|
34
|
+
'url.scheme' => 'http',
|
35
|
+
})
|
36
|
+
end
|
37
|
+
|
38
|
+
# Latest span has to be from the Ethon instrumentation and must
|
39
|
+
# have the Restify span as a parent.
|
40
|
+
spans[0].tap do |span|
|
41
|
+
expect(span.instrumentation_scope.name).to match(/Ethon/)
|
42
|
+
expect(span.parent_span_id).to eq spans[1].span_id
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Restify do
|
6
|
+
before do
|
7
|
+
WebMock.enable!
|
8
|
+
end
|
9
|
+
|
10
|
+
after do
|
11
|
+
WebMock.disable!(except: %i[net_http])
|
12
|
+
end
|
13
|
+
|
14
|
+
describe 'WebMock' do
|
15
|
+
subject(:resource) { Restify.new('http://www.example.com/base').get.value! }
|
16
|
+
|
17
|
+
it 'can stub requests' do
|
18
|
+
stub_request(:any, 'http://www.example.com/base')
|
19
|
+
|
20
|
+
expect(resource.response.status).to eq(:ok)
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'raises error for not stubbed requests' do
|
24
|
+
expect { resource }.to raise_error WebMock::NetConnectNotAllowedError
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -38,7 +38,7 @@ describe Restify::Relation do
|
|
38
38
|
context 'with false' do
|
39
39
|
let(:params) { {id: false} }
|
40
40
|
|
41
|
-
it { expect(expanded.to_s).to eq 'http://test.host/resource/' }
|
41
|
+
it { expect(expanded.to_s).to eq 'http://test.host/resource/false' }
|
42
42
|
end
|
43
43
|
|
44
44
|
context 'with true' do
|
@@ -59,6 +59,27 @@ describe Restify::Relation do
|
|
59
59
|
it { expect(expanded.to_s).to eq 'http://test.host/resource/1,2' }
|
60
60
|
end
|
61
61
|
|
62
|
+
context 'with nil query parameter' do
|
63
|
+
let(:pattern) { '/resource{?abc}' }
|
64
|
+
let(:params) { {abc: nil} }
|
65
|
+
|
66
|
+
it { expect(expanded.to_s).to eq 'http://test.host/resource' }
|
67
|
+
end
|
68
|
+
|
69
|
+
context 'with false query parameter' do
|
70
|
+
let(:pattern) { '/resource{?abc}' }
|
71
|
+
let(:params) { {abc: false} }
|
72
|
+
|
73
|
+
it { expect(expanded.to_s).to eq 'http://test.host/resource?abc=false' }
|
74
|
+
end
|
75
|
+
|
76
|
+
context 'with true query parameter' do
|
77
|
+
let(:pattern) { '/resource{?abc}' }
|
78
|
+
let(:params) { {abc: true} }
|
79
|
+
|
80
|
+
it { expect(expanded.to_s).to eq 'http://test.host/resource?abc=true' }
|
81
|
+
end
|
82
|
+
|
62
83
|
context 'with unknown additional query parameter' do
|
63
84
|
let(:pattern) { '/resource{?a,b}' }
|
64
85
|
let(:params) { {a: 1, b: 2, c: 3} }
|
@@ -119,6 +140,38 @@ describe Restify::Relation do
|
|
119
140
|
|
120
141
|
it { expect { expanded }.to raise_exception TypeError, /Can't convert Hash into String./ }
|
121
142
|
end
|
143
|
+
|
144
|
+
context 'with string-keyed params' do
|
145
|
+
context 'with value' do
|
146
|
+
let(:params) { {'id' => 1} }
|
147
|
+
|
148
|
+
it { expect(expanded.to_s).to eq 'http://test.host/resource/1' }
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
context 'with mixed-keyed params' do
|
153
|
+
context 'non-overlapping' do
|
154
|
+
let(:params) { {'id' => 1, q: 2} }
|
155
|
+
|
156
|
+
it { expect(expanded.to_s).to eq 'http://test.host/resource/1?q=2' }
|
157
|
+
end
|
158
|
+
|
159
|
+
context 'overlapping (1)' do
|
160
|
+
let(:params) { {'id' => 1, id: 2} }
|
161
|
+
|
162
|
+
it 'prefers symbol value' do
|
163
|
+
expect(expanded.to_s).to eq 'http://test.host/resource/2'
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
context 'overlapping (2)' do
|
168
|
+
let(:params) { {id: 2, 'id' => 1} }
|
169
|
+
|
170
|
+
it 'prefers symbol value' do
|
171
|
+
expect(expanded.to_s).to eq 'http://test.host/resource/2'
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
122
175
|
end
|
123
176
|
|
124
177
|
shared_examples 'non-data-request' do |method|
|
data/spec/spec_helper.rb
CHANGED
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'opentelemetry/sdk'
|
4
|
+
require 'opentelemetry/instrumentation/ethon'
|
5
|
+
|
6
|
+
OTLE_EXPORTER = OpenTelemetry::SDK::Trace::Export::InMemorySpanExporter.new
|
7
|
+
span_processor = OpenTelemetry::SDK::Trace::Export::SimpleSpanProcessor.new(OTLE_EXPORTER)
|
8
|
+
|
9
|
+
OpenTelemetry::SDK.configure do |c|
|
10
|
+
c.error_handler = ->(exception:, message:) { raise(exception || message) }
|
11
|
+
c.logger = Logger.new($stderr, level: ENV.fetch('OTEL_LOG_LEVEL', 'fatal').to_sym)
|
12
|
+
c.add_span_processor span_processor
|
13
|
+
|
14
|
+
c.use 'OpenTelemetry::Instrumentation::Ethon'
|
15
|
+
end
|
16
|
+
|
17
|
+
RSpec.configure do |config|
|
18
|
+
config.around do |example|
|
19
|
+
OTLE_EXPORTER.reset
|
20
|
+
|
21
|
+
original_propagation = OpenTelemetry.propagation
|
22
|
+
propagator = OpenTelemetry::Trace::Propagation::TraceContext.text_map_propagator
|
23
|
+
OpenTelemetry.propagation = propagator
|
24
|
+
|
25
|
+
example.run
|
26
|
+
ensure
|
27
|
+
OpenTelemetry.propagation = original_propagation
|
28
|
+
end
|
29
|
+
end
|
data/spec/support/stub_server.rb
CHANGED
@@ -18,6 +18,10 @@ module Stub
|
|
18
18
|
# If no stub is found a special HTTP 599 error code will be returned.
|
19
19
|
class Handler
|
20
20
|
def call(env)
|
21
|
+
if env['REQUEST_URI'] == '/echo'
|
22
|
+
return [200, {'content-type': 'application/json'}, [env.to_json]]
|
23
|
+
end
|
24
|
+
|
21
25
|
signature = WebMock::RequestSignature.new(
|
22
26
|
env['REQUEST_METHOD'].downcase,
|
23
27
|
"http://stubserver#{env['REQUEST_URI']}",
|
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Jan Graichen
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Shared RuboCop Configuration
|
2
|
+
|
3
|
+
Shared RuboCop configuration and defaults for my libraries and projects.
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
# Gemfile
|
9
|
+
|
10
|
+
gem 'rubocop-config', github: 'jgraichen/rubocop-config', tag: 'v13', require: false
|
11
|
+
```
|
12
|
+
|
13
|
+
```yaml
|
14
|
+
# .rubocop.yml
|
15
|
+
|
16
|
+
inherit_gem:
|
17
|
+
rubocop-config: default.yml
|
18
|
+
|
19
|
+
AllCops:
|
20
|
+
TargetRubyVersion: 3.1
|
21
|
+
SuggestExtensions: False
|
22
|
+
NewCops: enable
|
23
|
+
```
|
@@ -0,0 +1,255 @@
|
|
1
|
+
## Rails 8.0.2 (March 12, 2025) ##
|
2
|
+
|
3
|
+
* No changes.
|
4
|
+
|
5
|
+
|
6
|
+
## Rails 8.0.2 (March 12, 2025) ##
|
7
|
+
|
8
|
+
* Fix setting `to_time_preserves_timezone` from `new_framework_defaults_8_0.rb`.
|
9
|
+
|
10
|
+
*fatkodima*
|
11
|
+
|
12
|
+
* Fix Active Support Cache `fetch_multi` when local store is active.
|
13
|
+
|
14
|
+
`fetch_multi` now properly yield to the provided block for missing entries
|
15
|
+
that have been recorded as such in the local store.
|
16
|
+
|
17
|
+
*Jean Boussier*
|
18
|
+
|
19
|
+
* Fix execution wrapping to report all exceptions, including `Exception`.
|
20
|
+
|
21
|
+
If a more serious error like `SystemStackError` or `NoMemoryError` happens,
|
22
|
+
the error reporter should be able to report these kinds of exceptions.
|
23
|
+
|
24
|
+
*Gannon McGibbon*
|
25
|
+
|
26
|
+
* Fix `RedisCacheStore` and `MemCacheStore` to also handle connection pool related errors.
|
27
|
+
|
28
|
+
These errors are rescued and reported to `Rails.error`.
|
29
|
+
|
30
|
+
*Jean Boussier*
|
31
|
+
|
32
|
+
* Fix `ActiveSupport::Cache#read_multi` to respect version expiry when using local cache.
|
33
|
+
|
34
|
+
*zzak*
|
35
|
+
|
36
|
+
* Fix `ActiveSupport::MessageVerifier` and `ActiveSupport::MessageEncryptor` configuration of `on_rotation` callback.
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
verifier.rotate(old_secret).on_rotation { ... }
|
40
|
+
```
|
41
|
+
|
42
|
+
Now both work as documented.
|
43
|
+
|
44
|
+
*Jean Boussier*
|
45
|
+
|
46
|
+
* Fix `ActiveSupport::MessageVerifier` to always be able to verify both URL-safe and URL-unsafe payloads.
|
47
|
+
|
48
|
+
This is to allow transitioning seemlessly from either configuration without immediately invalidating
|
49
|
+
all previously generated signed messages.
|
50
|
+
|
51
|
+
*Jean Boussier*, *Florent Beaurain*, *Ali Sepehri*
|
52
|
+
|
53
|
+
* Fix `cache.fetch` to honor the provided expiry when `:race_condition_ttl` is used.
|
54
|
+
|
55
|
+
```ruby
|
56
|
+
cache.fetch("key", expires_in: 1.hour, race_condition_ttl: 5.second) do
|
57
|
+
"something"
|
58
|
+
end
|
59
|
+
```
|
60
|
+
|
61
|
+
In the above example, the final cache entry would have a 10 seconds TTL instead
|
62
|
+
of the requested 1 hour.
|
63
|
+
|
64
|
+
*Dhia*
|
65
|
+
|
66
|
+
* Better handle procs with splat arguments in `set_callback`.
|
67
|
+
|
68
|
+
*Radamés Roriz*
|
69
|
+
|
70
|
+
* Fix `String#mb_chars` to not mutate the receiver.
|
71
|
+
|
72
|
+
Previously it would call `force_encoding` on the receiver,
|
73
|
+
now it dups the receiver first.
|
74
|
+
|
75
|
+
*Jean Boussier*
|
76
|
+
|
77
|
+
* Improve `ErrorSubscriber` to also mark error causes as reported.
|
78
|
+
|
79
|
+
This avoid some cases of errors being reported twice, notably in views because of how
|
80
|
+
errors are wrapped in `ActionView::Template::Error`.
|
81
|
+
|
82
|
+
*Jean Boussier*
|
83
|
+
|
84
|
+
* Fix `Module#module_parent_name` to return the correct name after the module has been named.
|
85
|
+
|
86
|
+
When called on an anonymous module, the return value wouldn't change after the module was given a name
|
87
|
+
later by being assigned to a constant.
|
88
|
+
|
89
|
+
```ruby
|
90
|
+
mod = Module.new
|
91
|
+
mod.module_parent_name # => "Object"
|
92
|
+
MyModule::Something = mod
|
93
|
+
mod.module_parent_name # => "MyModule"
|
94
|
+
```
|
95
|
+
|
96
|
+
*Jean Boussier*
|
97
|
+
|
98
|
+
|
99
|
+
## Rails 8.0.1 (December 13, 2024) ##
|
100
|
+
|
101
|
+
* Fix a bug in `ERB::Util.tokenize` that causes incorrect tokenization when ERB tags are preceeded by multibyte characters.
|
102
|
+
|
103
|
+
*Martin Emde*
|
104
|
+
|
105
|
+
* Restore the ability to decorate methods generated by `class_attribute`.
|
106
|
+
|
107
|
+
It always has been complicated to use Module#prepend or an alias method chain
|
108
|
+
to decorate methods defined by `class_attribute`, but became even harder in 8.0.
|
109
|
+
|
110
|
+
This capability is now supported for both reader and writer methods.
|
111
|
+
|
112
|
+
*Jean Boussier*
|
113
|
+
|
114
|
+
|
115
|
+
## Rails 8.0.0.1 (December 10, 2024) ##
|
116
|
+
|
117
|
+
* No changes.
|
118
|
+
|
119
|
+
|
120
|
+
## Rails 8.0.0 (November 07, 2024) ##
|
121
|
+
|
122
|
+
* No changes.
|
123
|
+
|
124
|
+
|
125
|
+
## Rails 8.0.0.rc2 (October 30, 2024) ##
|
126
|
+
|
127
|
+
* No changes.
|
128
|
+
|
129
|
+
|
130
|
+
## Rails 8.0.0.rc1 (October 19, 2024) ##
|
131
|
+
|
132
|
+
* Remove deprecated support to passing an array of strings to `ActiveSupport::Deprecation#warn`.
|
133
|
+
|
134
|
+
*Rafael Mendonça França*
|
135
|
+
|
136
|
+
* Remove deprecated support to setting `attr_internal_naming_format` with a `@` prefix.
|
137
|
+
|
138
|
+
*Rafael Mendonça França*
|
139
|
+
|
140
|
+
* Remove deprecated `ActiveSupport::ProxyObject`.
|
141
|
+
|
142
|
+
*Rafael Mendonça França*
|
143
|
+
|
144
|
+
* Don't execute i18n watcher on boot. It shouldn't catch any file changes initially,
|
145
|
+
and unnecessarily slows down boot of applications with lots of translations.
|
146
|
+
|
147
|
+
*Gannon McGibbon*, *David Stosik*
|
148
|
+
|
149
|
+
* Fix `ActiveSupport::HashWithIndifferentAccess#stringify_keys` to stringify all keys not just symbols.
|
150
|
+
|
151
|
+
Previously:
|
152
|
+
|
153
|
+
```ruby
|
154
|
+
{ 1 => 2 }.with_indifferent_access.stringify_keys[1] # => 2
|
155
|
+
```
|
156
|
+
|
157
|
+
After this change:
|
158
|
+
|
159
|
+
```ruby
|
160
|
+
{ 1 => 2 }.with_indifferent_access.stringify_keys["1"] # => 2
|
161
|
+
```
|
162
|
+
|
163
|
+
This change can be seen as a bug fix, but since it behaved like this for a very long time, we're deciding
|
164
|
+
to not backport the fix and to make the change in a major release.
|
165
|
+
|
166
|
+
*Jean Boussier*
|
167
|
+
|
168
|
+
## Rails 8.0.0.beta1 (September 26, 2024) ##
|
169
|
+
|
170
|
+
* Include options when instrumenting `ActiveSupport::Cache::Store#delete` and `ActiveSupport::Cache::Store#delete_multi`.
|
171
|
+
|
172
|
+
*Adam Renberg Tamm*
|
173
|
+
|
174
|
+
* Print test names when running `rails test -v` for parallel tests.
|
175
|
+
|
176
|
+
*John Hawthorn*, *Abeid Ahmed*
|
177
|
+
|
178
|
+
* Deprecate `Benchmark.ms` core extension.
|
179
|
+
|
180
|
+
The `benchmark` gem will become bundled in Ruby 3.5
|
181
|
+
|
182
|
+
*Earlopain*
|
183
|
+
|
184
|
+
* `ActiveSupport::TimeWithZone#inspect` now uses ISO 8601 style time like `Time#inspect`
|
185
|
+
|
186
|
+
*John Hawthorn*
|
187
|
+
|
188
|
+
* `ActiveSupport::ErrorReporter#report` now assigns a backtrace to unraised exceptions.
|
189
|
+
|
190
|
+
Previously reporting an un-raised exception would result in an error report without
|
191
|
+
a backtrace. Now it automatically generates one.
|
192
|
+
|
193
|
+
*Jean Boussier*
|
194
|
+
|
195
|
+
* Add `escape_html_entities` option to `ActiveSupport::JSON.encode`.
|
196
|
+
|
197
|
+
This allows for overriding the global configuration found at
|
198
|
+
`ActiveSupport.escape_html_entities_in_json` for specific calls to `to_json`.
|
199
|
+
|
200
|
+
This should be usable from controllers in the following manner:
|
201
|
+
```ruby
|
202
|
+
class MyController < ApplicationController
|
203
|
+
def index
|
204
|
+
render json: { hello: "world" }, escape_html_entities: false
|
205
|
+
end
|
206
|
+
end
|
207
|
+
```
|
208
|
+
|
209
|
+
*Nigel Baillie*
|
210
|
+
|
211
|
+
* Raise when using key which can't respond to `#to_sym` in `EncryptedConfiguration`.
|
212
|
+
|
213
|
+
As is the case when trying to use an Integer or Float as a key, which is unsupported.
|
214
|
+
|
215
|
+
*zzak*
|
216
|
+
|
217
|
+
* Deprecate addition and since between two `Time` and `ActiveSupport::TimeWithZone`.
|
218
|
+
|
219
|
+
Previously adding time instances together such as `10.days.ago + 10.days.ago` or `10.days.ago.since(10.days.ago)` produced a nonsensical future date. This behavior is deprecated and will be removed in Rails 8.1.
|
220
|
+
|
221
|
+
*Nick Schwaderer*
|
222
|
+
|
223
|
+
* Support rfc2822 format for Time#to_fs & Date#to_fs.
|
224
|
+
|
225
|
+
*Akshay Birajdar*
|
226
|
+
|
227
|
+
* Optimize load time for `Railtie#initialize_i18n`. Filter `I18n.load_path`s passed to the file watcher to only those
|
228
|
+
under `Rails.root`. Previously the watcher would grab all available locales, including those in gems
|
229
|
+
which do not require a watcher because they won't change.
|
230
|
+
|
231
|
+
*Nick Schwaderer*
|
232
|
+
|
233
|
+
* Add a `filter` option to `in_order_of` to prioritize certain values in the sorting without filtering the results
|
234
|
+
by these values.
|
235
|
+
|
236
|
+
*Igor Depolli*
|
237
|
+
|
238
|
+
* Improve error message when using `assert_difference` or `assert_changes` with a
|
239
|
+
proc by printing the proc's source code (MRI only).
|
240
|
+
|
241
|
+
*Richard Böhme*, *Jean Boussier*
|
242
|
+
|
243
|
+
* Add a new configuration value `:zone` for `ActiveSupport.to_time_preserves_timezone` and rename the previous `true` value to `:offset`. The new default value is `:zone`.
|
244
|
+
|
245
|
+
*Jason Kim*, *John Hawthorn*
|
246
|
+
|
247
|
+
* Align instrumentation `payload[:key]` in ActiveSupport::Cache to follow the same pattern, with namespaced and normalized keys.
|
248
|
+
|
249
|
+
*Frederik Erbs Spang Thomsen*
|
250
|
+
|
251
|
+
* Fix `travel_to` to set usec 0 when `with_usec` is `false` and the given argument String or DateTime.
|
252
|
+
|
253
|
+
*mopp*
|
254
|
+
|
255
|
+
Please check [7-2-stable](https://github.com/rails/rails/blob/7-2-stable/activesupport/CHANGELOG.md) for previous changes.
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) David Heinemeier Hansson
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|