activesupport 6.0.0.beta1 → 6.0.1.rc1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of activesupport might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +302 -1
- data/README.rdoc +2 -1
- data/lib/active_support.rb +1 -0
- data/lib/active_support/actionable_error.rb +48 -0
- data/lib/active_support/backtrace_cleaner.rb +5 -1
- data/lib/active_support/cache.rb +5 -5
- data/lib/active_support/cache/file_store.rb +3 -10
- data/lib/active_support/cache/memory_store.rb +4 -2
- data/lib/active_support/cache/redis_cache_store.rb +9 -6
- data/lib/active_support/concern.rb +24 -1
- data/lib/active_support/configurable.rb +3 -3
- data/lib/active_support/core_ext/array/access.rb +18 -6
- data/lib/active_support/core_ext/class/attribute.rb +10 -15
- data/lib/active_support/core_ext/date_and_time/calculations.rb +0 -30
- data/lib/active_support/core_ext/digest.rb +3 -0
- data/lib/active_support/core_ext/enumerable.rb +24 -4
- data/lib/active_support/core_ext/hash.rb +1 -0
- data/lib/active_support/core_ext/hash/deep_transform_values.rb +46 -0
- data/lib/active_support/core_ext/hash/except.rb +1 -1
- data/lib/active_support/core_ext/kernel.rb +0 -1
- data/lib/active_support/core_ext/module/attribute_accessors.rb +5 -5
- data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +5 -5
- data/lib/active_support/core_ext/module/delegation.rb +6 -0
- data/lib/active_support/core_ext/object/duplicable.rb +7 -117
- data/lib/active_support/core_ext/range/compare_range.rb +27 -12
- data/lib/active_support/core_ext/range/include_time_with_zone.rb +2 -2
- data/lib/active_support/core_ext/string/filters.rb +1 -1
- data/lib/active_support/core_ext/string/inflections.rb +7 -2
- data/lib/active_support/core_ext/string/output_safety.rb +51 -4
- data/lib/active_support/core_ext/time/calculations.rb +31 -2
- data/lib/active_support/current_attributes.rb +6 -0
- data/lib/active_support/dependencies.rb +41 -5
- data/lib/active_support/dependencies/zeitwerk_integration.rb +118 -0
- data/lib/active_support/deprecation/method_wrappers.rb +7 -18
- data/lib/active_support/deprecation/proxy_wrappers.rb +24 -3
- data/lib/active_support/descendants_tracker.rb +52 -6
- data/lib/active_support/duration.rb +2 -3
- data/lib/active_support/encrypted_file.rb +2 -1
- data/lib/active_support/evented_file_update_checker.rb +14 -2
- data/lib/active_support/gem_version.rb +2 -2
- data/lib/active_support/hash_with_indifferent_access.rb +19 -3
- data/lib/active_support/i18n_railtie.rb +2 -1
- data/lib/active_support/inflector/transliterate.rb +43 -14
- data/lib/active_support/logger_thread_safe_level.rb +2 -1
- data/lib/active_support/message_encryptor.rb +1 -1
- data/lib/active_support/message_verifier.rb +1 -1
- data/lib/active_support/notifications.rb +9 -0
- data/lib/active_support/notifications/fanout.rb +60 -13
- data/lib/active_support/notifications/instrumenter.rb +11 -10
- data/lib/active_support/ordered_hash.rb +1 -1
- data/lib/active_support/ordered_options.rb +1 -1
- data/lib/active_support/parameter_filter.rb +6 -1
- data/lib/active_support/security_utils.rb +1 -1
- data/lib/active_support/subscriber.rb +55 -6
- data/lib/active_support/testing/parallelization.rb +21 -2
- metadata +27 -7
- data/lib/active_support/core_ext/kernel/agnostics.rb +0 -13
@@ -16,7 +16,7 @@ module ActiveSupport
|
|
16
16
|
# oh.keys # => [:a, :b], this order is guaranteed
|
17
17
|
#
|
18
18
|
# Also, maps the +omap+ feature for YAML files
|
19
|
-
# (See
|
19
|
+
# (See https://yaml.org/type/omap.html) to support ordered items
|
20
20
|
# when loading from yaml.
|
21
21
|
#
|
22
22
|
# <tt>ActiveSupport::OrderedHash</tt> is namespaced to prevent conflicts
|
@@ -110,7 +110,12 @@ module ActiveSupport
|
|
110
110
|
elsif value.is_a?(Hash)
|
111
111
|
value = call(value, parents, original_params)
|
112
112
|
elsif value.is_a?(Array)
|
113
|
-
|
113
|
+
# If we don't pop the current parent it will be duplicated as we
|
114
|
+
# process each array value.
|
115
|
+
parents.pop if deep_regexps
|
116
|
+
value = value.map { |v| value_for_key(key, v, parents, original_params) }
|
117
|
+
# Restore the parent stack after processing the array.
|
118
|
+
parents.push(key) if deep_regexps
|
114
119
|
elsif blocks.any?
|
115
120
|
key = key.dup if key.duplicable?
|
116
121
|
value = value.dup if value.duplicable?
|
@@ -24,7 +24,7 @@ module ActiveSupport
|
|
24
24
|
# The values are first processed by SHA256, so that we don't leak length info
|
25
25
|
# via timing attacks.
|
26
26
|
def secure_compare(a, b)
|
27
|
-
fixed_length_secure_compare(::Digest::SHA256.
|
27
|
+
fixed_length_secure_compare(::Digest::SHA256.digest(a), ::Digest::SHA256.digest(b)) && a == b
|
28
28
|
end
|
29
29
|
module_function :secure_compare
|
30
30
|
end
|
@@ -24,6 +24,10 @@ module ActiveSupport
|
|
24
24
|
# After configured, whenever a "sql.active_record" notification is published,
|
25
25
|
# it will properly dispatch the event (ActiveSupport::Notifications::Event) to
|
26
26
|
# the +sql+ method.
|
27
|
+
#
|
28
|
+
# We can detach a subscriber as well:
|
29
|
+
#
|
30
|
+
# ActiveRecord::StatsSubscriber.detach_from(:active_record)
|
27
31
|
class Subscriber
|
28
32
|
class << self
|
29
33
|
# Attach the subscriber to a namespace.
|
@@ -40,6 +44,25 @@ module ActiveSupport
|
|
40
44
|
end
|
41
45
|
end
|
42
46
|
|
47
|
+
# Detach the subscriber from a namespace.
|
48
|
+
def detach_from(namespace, notifier = ActiveSupport::Notifications)
|
49
|
+
@namespace = namespace
|
50
|
+
@subscriber = find_attached_subscriber
|
51
|
+
@notifier = notifier
|
52
|
+
|
53
|
+
return unless subscriber
|
54
|
+
|
55
|
+
subscribers.delete(subscriber)
|
56
|
+
|
57
|
+
# Remove event subscribers of all existing methods on the class.
|
58
|
+
subscriber.public_methods(false).each do |event|
|
59
|
+
remove_event_subscriber(event)
|
60
|
+
end
|
61
|
+
|
62
|
+
# Reset notifier so that event subscribers will not add for new methods added to the class.
|
63
|
+
@notifier = nil
|
64
|
+
end
|
65
|
+
|
43
66
|
# Adds event subscribers for all new methods added to the class.
|
44
67
|
def method_added(event)
|
45
68
|
# Only public methods are added as subscribers, and only if a notifier
|
@@ -58,15 +81,41 @@ module ActiveSupport
|
|
58
81
|
attr_reader :subscriber, :notifier, :namespace
|
59
82
|
|
60
83
|
def add_event_subscriber(event) # :doc:
|
61
|
-
return if
|
84
|
+
return if invalid_event?(event.to_s)
|
62
85
|
|
63
|
-
pattern =
|
86
|
+
pattern = prepare_pattern(event)
|
64
87
|
|
65
88
|
# Don't add multiple subscribers (eg. if methods are redefined).
|
66
|
-
return if
|
89
|
+
return if pattern_subscribed?(pattern)
|
90
|
+
|
91
|
+
subscriber.patterns[pattern] = notifier.subscribe(pattern, subscriber)
|
92
|
+
end
|
93
|
+
|
94
|
+
def remove_event_subscriber(event) # :doc:
|
95
|
+
return if invalid_event?(event.to_s)
|
96
|
+
|
97
|
+
pattern = prepare_pattern(event)
|
98
|
+
|
99
|
+
return unless pattern_subscribed?(pattern)
|
100
|
+
|
101
|
+
notifier.unsubscribe(subscriber.patterns[pattern])
|
102
|
+
subscriber.patterns.delete(pattern)
|
103
|
+
end
|
104
|
+
|
105
|
+
def find_attached_subscriber
|
106
|
+
subscribers.find { |attached_subscriber| attached_subscriber.instance_of?(self) }
|
107
|
+
end
|
108
|
+
|
109
|
+
def invalid_event?(event)
|
110
|
+
%w{ start finish }.include?(event.to_s)
|
111
|
+
end
|
112
|
+
|
113
|
+
def prepare_pattern(event)
|
114
|
+
"#{event}.#{namespace}"
|
115
|
+
end
|
67
116
|
|
68
|
-
|
69
|
-
|
117
|
+
def pattern_subscribed?(pattern)
|
118
|
+
subscriber.patterns.key?(pattern)
|
70
119
|
end
|
71
120
|
end
|
72
121
|
|
@@ -74,7 +123,7 @@ module ActiveSupport
|
|
74
123
|
|
75
124
|
def initialize
|
76
125
|
@queue_key = [self.class.name, object_id].join "-"
|
77
|
-
@patterns =
|
126
|
+
@patterns = {}
|
78
127
|
super
|
79
128
|
end
|
80
129
|
|
@@ -27,6 +27,10 @@ module ActiveSupport
|
|
27
27
|
@queue << o
|
28
28
|
end
|
29
29
|
|
30
|
+
def length
|
31
|
+
@queue.length
|
32
|
+
end
|
33
|
+
|
30
34
|
def pop; @queue.pop; end
|
31
35
|
end
|
32
36
|
|
@@ -71,7 +75,9 @@ module ActiveSupport
|
|
71
75
|
fork do
|
72
76
|
DRb.stop_service
|
73
77
|
|
74
|
-
|
78
|
+
begin
|
79
|
+
after_fork(worker)
|
80
|
+
rescue => setup_exception; end
|
75
81
|
|
76
82
|
queue = DRbObject.new_with_uri(@url)
|
77
83
|
|
@@ -79,7 +85,11 @@ module ActiveSupport
|
|
79
85
|
klass = job[0]
|
80
86
|
method = job[1]
|
81
87
|
reporter = job[2]
|
82
|
-
result
|
88
|
+
result = klass.with_info_handler reporter do
|
89
|
+
Minitest.run_one_method(klass, method)
|
90
|
+
end
|
91
|
+
|
92
|
+
add_setup_exception(result, setup_exception) if setup_exception
|
83
93
|
|
84
94
|
begin
|
85
95
|
queue.record(reporter, result)
|
@@ -103,7 +113,16 @@ module ActiveSupport
|
|
103
113
|
def shutdown
|
104
114
|
@queue_size.times { @queue << nil }
|
105
115
|
@pool.each { |pid| Process.waitpid pid }
|
116
|
+
|
117
|
+
if @queue.length > 0
|
118
|
+
raise "Queue not empty, but all workers have finished. This probably means that a worker crashed and #{@queue.length} tests were missed."
|
119
|
+
end
|
106
120
|
end
|
121
|
+
|
122
|
+
private
|
123
|
+
def add_setup_exception(result, setup_exception)
|
124
|
+
result.failures.prepend Minitest::UnexpectedError.new(setup_exception)
|
125
|
+
end
|
107
126
|
end
|
108
127
|
end
|
109
128
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activesupport
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.0.
|
4
|
+
version: 6.0.1.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
@@ -78,6 +78,20 @@ dependencies:
|
|
78
78
|
- - ">="
|
79
79
|
- !ruby/object:Gem::Version
|
80
80
|
version: 1.0.2
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: zeitwerk
|
83
|
+
requirement: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - "~>"
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '2.2'
|
88
|
+
type: :runtime
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - "~>"
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '2.2'
|
81
95
|
description: A toolkit of support libraries and Ruby core extensions extracted from
|
82
96
|
the Rails framework. Rich support for multibyte strings, internationalization, time
|
83
97
|
zones, and testing.
|
@@ -90,6 +104,7 @@ files:
|
|
90
104
|
- MIT-LICENSE
|
91
105
|
- README.rdoc
|
92
106
|
- lib/active_support.rb
|
107
|
+
- lib/active_support/actionable_error.rb
|
93
108
|
- lib/active_support/all.rb
|
94
109
|
- lib/active_support/array_inquirer.rb
|
95
110
|
- lib/active_support/backtrace_cleaner.rb
|
@@ -140,6 +155,7 @@ files:
|
|
140
155
|
- lib/active_support/core_ext/date_time/calculations.rb
|
141
156
|
- lib/active_support/core_ext/date_time/compatibility.rb
|
142
157
|
- lib/active_support/core_ext/date_time/conversions.rb
|
158
|
+
- lib/active_support/core_ext/digest.rb
|
143
159
|
- lib/active_support/core_ext/digest/uuid.rb
|
144
160
|
- lib/active_support/core_ext/enumerable.rb
|
145
161
|
- lib/active_support/core_ext/file.rb
|
@@ -148,6 +164,7 @@ files:
|
|
148
164
|
- lib/active_support/core_ext/hash/compact.rb
|
149
165
|
- lib/active_support/core_ext/hash/conversions.rb
|
150
166
|
- lib/active_support/core_ext/hash/deep_merge.rb
|
167
|
+
- lib/active_support/core_ext/hash/deep_transform_values.rb
|
151
168
|
- lib/active_support/core_ext/hash/except.rb
|
152
169
|
- lib/active_support/core_ext/hash/indifferent_access.rb
|
153
170
|
- lib/active_support/core_ext/hash/keys.rb
|
@@ -159,7 +176,6 @@ files:
|
|
159
176
|
- lib/active_support/core_ext/integer/multiple.rb
|
160
177
|
- lib/active_support/core_ext/integer/time.rb
|
161
178
|
- lib/active_support/core_ext/kernel.rb
|
162
|
-
- lib/active_support/core_ext/kernel/agnostics.rb
|
163
179
|
- lib/active_support/core_ext/kernel/concern.rb
|
164
180
|
- lib/active_support/core_ext/kernel/reporting.rb
|
165
181
|
- lib/active_support/core_ext/kernel/singleton_class.rb
|
@@ -231,6 +247,7 @@ files:
|
|
231
247
|
- lib/active_support/dependencies.rb
|
232
248
|
- lib/active_support/dependencies/autoload.rb
|
233
249
|
- lib/active_support/dependencies/interlock.rb
|
250
|
+
- lib/active_support/dependencies/zeitwerk_integration.rb
|
234
251
|
- lib/active_support/deprecation.rb
|
235
252
|
- lib/active_support/deprecation/behaviors.rb
|
236
253
|
- lib/active_support/deprecation/constant_accessor.rb
|
@@ -331,12 +348,15 @@ files:
|
|
331
348
|
- lib/active_support/xml_mini/nokogiri.rb
|
332
349
|
- lib/active_support/xml_mini/nokogirisax.rb
|
333
350
|
- lib/active_support/xml_mini/rexml.rb
|
334
|
-
homepage:
|
351
|
+
homepage: https://rubyonrails.org
|
335
352
|
licenses:
|
336
353
|
- MIT
|
337
354
|
metadata:
|
338
|
-
|
339
|
-
changelog_uri: https://github.com/rails/rails/blob/v6.0.
|
355
|
+
bug_tracker_uri: https://github.com/rails/rails/issues
|
356
|
+
changelog_uri: https://github.com/rails/rails/blob/v6.0.1.rc1/activesupport/CHANGELOG.md
|
357
|
+
documentation_uri: https://api.rubyonrails.org/v6.0.1.rc1/
|
358
|
+
mailing_list_uri: https://groups.google.com/forum/#!forum/rubyonrails-talk
|
359
|
+
source_code_uri: https://github.com/rails/rails/tree/v6.0.1.rc1/activesupport
|
340
360
|
post_install_message:
|
341
361
|
rdoc_options:
|
342
362
|
- "--encoding"
|
@@ -354,7 +374,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
354
374
|
- !ruby/object:Gem::Version
|
355
375
|
version: 1.3.1
|
356
376
|
requirements: []
|
357
|
-
rubygems_version: 3.0.
|
377
|
+
rubygems_version: 3.0.3
|
358
378
|
signing_key:
|
359
379
|
specification_version: 4
|
360
380
|
summary: A toolkit of support libraries and Ruby core extensions extracted from the
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class Object
|
4
|
-
# Makes backticks behave (somewhat more) similarly on all platforms.
|
5
|
-
# On win32 `nonexistent_command` raises Errno::ENOENT; on Unix, the
|
6
|
-
# spawned shell prints a message to stderr and sets $?. We emulate
|
7
|
-
# Unix on the former but not the latter.
|
8
|
-
def `(command) #:nodoc:
|
9
|
-
super
|
10
|
-
rescue Errno::ENOENT => e
|
11
|
-
STDERR.puts "#$0: #{e}"
|
12
|
-
end
|
13
|
-
end
|