activesupport 7.0.5 → 7.0.8.6
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 +101 -0
- data/README.rdoc +2 -2
- data/lib/active_support/cache/redis_cache_store.rb +9 -7
- data/lib/active_support/cache/strategy/local_cache.rb +1 -1
- data/lib/active_support/core_ext/date/deprecated_conversions.rb +15 -1
- data/lib/active_support/core_ext/date_time/deprecated_conversions.rb +15 -1
- data/lib/active_support/core_ext/enumerable.rb +20 -15
- data/lib/active_support/core_ext/object/duplicable.rb +24 -15
- data/lib/active_support/core_ext/object/to_query.rb +0 -2
- data/lib/active_support/core_ext/range/deprecated_conversions.rb +11 -1
- data/lib/active_support/core_ext/string/inflections.rb +0 -4
- data/lib/active_support/core_ext/time/deprecated_conversions.rb +52 -1
- data/lib/active_support/encrypted_configuration.rb +1 -1
- data/lib/active_support/encrypted_file.rb +8 -9
- data/lib/active_support/evented_file_update_checker.rb +17 -2
- data/lib/active_support/gem_version.rb +2 -2
- data/lib/active_support/inflector/methods.rb +1 -3
- data/lib/active_support/time_with_zone.rb +2 -21
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dd59d1b979fdef6110c5b9968fd134094f5efa954426f51c147fba4896c5b48a
|
|
4
|
+
data.tar.gz: eb7816a795348ea5a26a10fa4d181e4ad54ec4fbd1c61a9d80ef418488d36055
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 831f69a677589ce36aeecb0905d22e95a4d6bf92900df22b090c40c00c993f55f15d94c7aa4c1fd102d756464750df48e8c3e9d067dac9b51afed1d49d8b0705
|
|
7
|
+
data.tar.gz: 831ac6a239d6145e20745e5fc0c32a4431bd9a34673c484bc03291d73a274df5d1f92b3ac1512e2b7845700436d8ab58260361fa7000bf6e4539e2ac43358e4d
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,104 @@
|
|
|
1
|
+
## Rails 7.0.8.6 (October 23, 2024) ##
|
|
2
|
+
|
|
3
|
+
* No changes.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Rails 7.0.8.5 (October 15, 2024) ##
|
|
7
|
+
|
|
8
|
+
* No changes.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## Rails 7.0.8.4 (June 04, 2024) ##
|
|
12
|
+
|
|
13
|
+
* No changes.
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## Rails 7.0.8.3 (May 17, 2024) ##
|
|
17
|
+
|
|
18
|
+
* No changes.
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## Rails 7.0.8.2 (May 16, 2024) ##
|
|
22
|
+
|
|
23
|
+
* No changes.
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## Rails 7.0.8.1 (February 21, 2024) ##
|
|
27
|
+
|
|
28
|
+
* No changes.
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
## Rails 7.0.8 (September 09, 2023) ##
|
|
32
|
+
|
|
33
|
+
* Fix `TimeWithZone` still using deprecated `#to_s` when `ENV` or `config` to
|
|
34
|
+
disable it are set.
|
|
35
|
+
|
|
36
|
+
*Hartley McGuire*
|
|
37
|
+
|
|
38
|
+
* Fix CacheStore#write_multi when using a distributed Redis cache with a connection pool.
|
|
39
|
+
|
|
40
|
+
Fixes [#48938](https://github.com/rails/rails/issues/48938).
|
|
41
|
+
|
|
42
|
+
*Jonathan del Strother*
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
## Rails 7.0.7.2 (August 22, 2023) ##
|
|
46
|
+
|
|
47
|
+
* No changes.
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
## Rails 7.0.7.1 (August 22, 2023) ##
|
|
51
|
+
|
|
52
|
+
* Use a temporary file for storing unencrypted files while editing
|
|
53
|
+
|
|
54
|
+
[CVE-2023-38037]
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
## Rails 7.0.7 (August 09, 2023) ##
|
|
58
|
+
|
|
59
|
+
* Fix `Cache::NullStore` with local caching for repeated reads.
|
|
60
|
+
|
|
61
|
+
*fatkodima*
|
|
62
|
+
|
|
63
|
+
* Fix `to_s` with no arguments not respecting custom `:default` formats
|
|
64
|
+
|
|
65
|
+
*Hartley McGuire*
|
|
66
|
+
|
|
67
|
+
* Fix `ActiveSupport::Inflector.humanize(nil)` raising ``NoMethodError: undefined method `end_with?' for nil:NilClass``.
|
|
68
|
+
|
|
69
|
+
*James Robinson*
|
|
70
|
+
|
|
71
|
+
* Fix `Enumerable#sum` for `Enumerator#lazy`.
|
|
72
|
+
|
|
73
|
+
*fatkodima*, *Matthew Draper*, *Jonathan Hefner*
|
|
74
|
+
|
|
75
|
+
* Improve error message when EventedFileUpdateChecker is used without a
|
|
76
|
+
compatible version of the Listen gem
|
|
77
|
+
|
|
78
|
+
*Hartley McGuire*
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
## Rails 7.0.6 (June 29, 2023) ##
|
|
82
|
+
|
|
83
|
+
* Fix `EncryptedConfiguration` returning incorrect values for some `Hash`
|
|
84
|
+
methods
|
|
85
|
+
|
|
86
|
+
*Hartley McGuire*
|
|
87
|
+
|
|
88
|
+
* Fix arguments being destructed `Enumerable#many?` with block.
|
|
89
|
+
|
|
90
|
+
*Andrew Novoselac*
|
|
91
|
+
|
|
92
|
+
* Fix humanize for strings ending with id.
|
|
93
|
+
|
|
94
|
+
*fatkodima*
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
## Rails 7.0.5.1 (June 26, 2023) ##
|
|
98
|
+
|
|
99
|
+
* No changes.
|
|
100
|
+
|
|
101
|
+
|
|
1
102
|
## Rails 7.0.5 (May 24, 2023) ##
|
|
2
103
|
|
|
3
104
|
* Fixes TimeWithZone ArgumentError.
|
data/README.rdoc
CHANGED
|
@@ -13,7 +13,7 @@ The latest version of Active Support can be installed with RubyGems:
|
|
|
13
13
|
|
|
14
14
|
$ gem install activesupport
|
|
15
15
|
|
|
16
|
-
Source code can be downloaded as part of the Rails project on GitHub:
|
|
16
|
+
Source code can be downloaded as part of the \Rails project on GitHub:
|
|
17
17
|
|
|
18
18
|
* https://github.com/rails/rails/tree/main/activesupport
|
|
19
19
|
|
|
@@ -31,7 +31,7 @@ API documentation is at:
|
|
|
31
31
|
|
|
32
32
|
* https://api.rubyonrails.org
|
|
33
33
|
|
|
34
|
-
Bug reports for the Ruby on Rails project can be filed here:
|
|
34
|
+
Bug reports for the Ruby on \Rails project can be filed here:
|
|
35
35
|
|
|
36
36
|
* https://github.com/rails/rails/issues
|
|
37
37
|
|
|
@@ -313,13 +313,15 @@ module ActiveSupport
|
|
|
313
313
|
|
|
314
314
|
private
|
|
315
315
|
def set_redis_capabilities
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
316
|
+
redis.with do |c|
|
|
317
|
+
case c
|
|
318
|
+
when Redis::Distributed
|
|
319
|
+
@mget_capable = true
|
|
320
|
+
@mset_capable = false
|
|
321
|
+
else
|
|
322
|
+
@mget_capable = true
|
|
323
|
+
@mset_capable = true
|
|
324
|
+
end
|
|
323
325
|
end
|
|
324
326
|
end
|
|
325
327
|
|
|
@@ -124,7 +124,7 @@ module ActiveSupport
|
|
|
124
124
|
|
|
125
125
|
local_entries = local_cache.read_multi_entries(keys)
|
|
126
126
|
local_entries.transform_values! do |payload|
|
|
127
|
-
deserialize_entry(payload)
|
|
127
|
+
deserialize_entry(payload)&.value
|
|
128
128
|
end
|
|
129
129
|
missed_keys = keys - local_entries.keys
|
|
130
130
|
|
|
@@ -15,7 +15,21 @@ class Date
|
|
|
15
15
|
strftime(formatter)
|
|
16
16
|
end
|
|
17
17
|
elsif format == NOT_SET
|
|
18
|
-
|
|
18
|
+
if formatter = DATE_FORMATS[:default]
|
|
19
|
+
ActiveSupport::Deprecation.warn(<<-MSG.squish)
|
|
20
|
+
Using a :default format for Date#to_s is deprecated. Please use Date#to_fs instead. If you fixed all places
|
|
21
|
+
inside your application that you see this deprecation, you can set
|
|
22
|
+
`ENV['RAILS_DISABLE_DEPRECATED_TO_S_CONVERSION']` to `"true"` in the `config/application.rb` file before
|
|
23
|
+
the `Bundler.require` call to fix all the callers outside of your application.
|
|
24
|
+
MSG
|
|
25
|
+
if formatter.respond_to?(:call)
|
|
26
|
+
formatter.call(self).to_s
|
|
27
|
+
else
|
|
28
|
+
strftime(formatter)
|
|
29
|
+
end
|
|
30
|
+
else
|
|
31
|
+
to_default_s
|
|
32
|
+
end
|
|
19
33
|
else
|
|
20
34
|
ActiveSupport::Deprecation.warn(
|
|
21
35
|
"Date#to_s(#{format.inspect}) is deprecated. Please use Date#to_fs(#{format.inspect}) instead."
|
|
@@ -11,7 +11,21 @@ class DateTime
|
|
|
11
11
|
)
|
|
12
12
|
formatter.respond_to?(:call) ? formatter.call(self).to_s : strftime(formatter)
|
|
13
13
|
elsif format == NOT_SET
|
|
14
|
-
|
|
14
|
+
if formatter = ::Time::DATE_FORMATS[:default]
|
|
15
|
+
ActiveSupport::Deprecation.warn(<<-MSG.squish)
|
|
16
|
+
Using a :default format for DateTime#to_s is deprecated. Please use DateTime#to_fs instead. If you fixed all
|
|
17
|
+
places inside your application that you see this deprecation, you can set
|
|
18
|
+
`ENV['RAILS_DISABLE_DEPRECATED_TO_S_CONVERSION']` to `"true"` in the `config/application.rb` file before
|
|
19
|
+
the `Bundler.require` call to fix all the callers outside of your application.
|
|
20
|
+
MSG
|
|
21
|
+
if formatter.respond_to?(:call)
|
|
22
|
+
formatter.call(self).to_s
|
|
23
|
+
else
|
|
24
|
+
strftime(formatter)
|
|
25
|
+
end
|
|
26
|
+
else
|
|
27
|
+
to_default_s
|
|
28
|
+
end
|
|
15
29
|
else
|
|
16
30
|
ActiveSupport::Deprecation.warn(
|
|
17
31
|
"DateTime#to_s(#{format.inspect}) is deprecated. Please use DateTime#to_fs(#{format.inspect}) instead."
|
|
@@ -76,19 +76,24 @@ module Enumerable
|
|
|
76
76
|
_original_sum_with_required_identity(identity, &block)
|
|
77
77
|
elsif block_given?
|
|
78
78
|
map(&block).sum
|
|
79
|
-
# we check `first(1) == []` to check if we have an
|
|
80
|
-
# empty Enumerable; checking `empty?` would return
|
|
81
|
-
# true for `[nil]`, which we want to deprecate to
|
|
82
|
-
# keep consistent with Ruby
|
|
83
|
-
elsif first.is_a?(Numeric) || first(1) == [] || first.respond_to?(:coerce)
|
|
84
|
-
identity ||= 0
|
|
85
|
-
_original_sum_with_required_identity(identity, &block)
|
|
86
79
|
else
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
80
|
+
first = true
|
|
81
|
+
|
|
82
|
+
reduce(nil) do |sum, value|
|
|
83
|
+
if first
|
|
84
|
+
first = false
|
|
85
|
+
|
|
86
|
+
unless value.is_a?(Numeric) || value.respond_to?(:coerce)
|
|
87
|
+
ActiveSupport::Deprecation.warn(<<-MSG.squish)
|
|
88
|
+
Rails 7.0 has deprecated Enumerable.sum in favor of Ruby's native implementation available since 2.4.
|
|
89
|
+
Sum of non-numeric elements requires an initial argument.
|
|
90
|
+
MSG
|
|
91
|
+
end
|
|
92
|
+
value
|
|
93
|
+
else
|
|
94
|
+
sum + value
|
|
95
|
+
end
|
|
96
|
+
end || 0
|
|
92
97
|
end
|
|
93
98
|
end
|
|
94
99
|
|
|
@@ -144,8 +149,8 @@ module Enumerable
|
|
|
144
149
|
def many?
|
|
145
150
|
cnt = 0
|
|
146
151
|
if block_given?
|
|
147
|
-
any? do
|
|
148
|
-
cnt += 1 if yield
|
|
152
|
+
any? do |*args|
|
|
153
|
+
cnt += 1 if yield(*args)
|
|
149
154
|
cnt > 1
|
|
150
155
|
end
|
|
151
156
|
else
|
|
@@ -245,7 +250,7 @@ module Enumerable
|
|
|
245
250
|
# If the +series+ include keys that have no corresponding element in the Enumerable, these are ignored.
|
|
246
251
|
# If the Enumerable has additional elements that aren't named in the +series+, these are not included in the result.
|
|
247
252
|
def in_order_of(key, series)
|
|
248
|
-
group_by(&key).values_at(*series).flatten.compact
|
|
253
|
+
group_by(&key).values_at(*series).flatten(1).compact
|
|
249
254
|
end
|
|
250
255
|
|
|
251
256
|
# Returns the sole item in the enumerable. If there are no items, or more
|
|
@@ -28,23 +28,32 @@ class Object
|
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
def duplicable?
|
|
37
|
-
false
|
|
38
|
-
end
|
|
31
|
+
methods_are_duplicable = begin
|
|
32
|
+
Object.instance_method(:duplicable?).dup
|
|
33
|
+
true
|
|
34
|
+
rescue TypeError
|
|
35
|
+
false
|
|
39
36
|
end
|
|
40
37
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
38
|
+
unless methods_are_duplicable
|
|
39
|
+
class Method
|
|
40
|
+
# Methods are not duplicable:
|
|
41
|
+
#
|
|
42
|
+
# method(:puts).duplicable? # => false
|
|
43
|
+
# method(:puts).dup # => TypeError: allocator undefined for Method
|
|
44
|
+
def duplicable?
|
|
45
|
+
false
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
class UnboundMethod
|
|
50
|
+
# Unbound methods are not duplicable:
|
|
51
|
+
#
|
|
52
|
+
# method(:puts).unbind.duplicable? # => false
|
|
53
|
+
# method(:puts).unbind.dup # => TypeError: allocator undefined for UnboundMethod
|
|
54
|
+
def duplicable?
|
|
55
|
+
false
|
|
56
|
+
end
|
|
48
57
|
end
|
|
49
58
|
end
|
|
50
59
|
|
|
@@ -72,8 +72,6 @@ class Hash
|
|
|
72
72
|
#
|
|
73
73
|
# The string pairs "key=value" that conform the query string
|
|
74
74
|
# are sorted lexicographically in ascending order.
|
|
75
|
-
#
|
|
76
|
-
# This method is also aliased as +to_param+.
|
|
77
75
|
def to_query(namespace = nil)
|
|
78
76
|
query = filter_map do |key, value|
|
|
79
77
|
unless (value.is_a?(Hash) || value.is_a?(Array)) && value.empty?
|
|
@@ -10,7 +10,17 @@ module ActiveSupport
|
|
|
10
10
|
)
|
|
11
11
|
formatter.call(first, last)
|
|
12
12
|
elsif format == NOT_SET
|
|
13
|
-
|
|
13
|
+
if formatter = RangeWithFormat::RANGE_FORMATS[:default]
|
|
14
|
+
ActiveSupport::Deprecation.warn(<<-MSG.squish)
|
|
15
|
+
Using a :default format for Range#to_s is deprecated. Please use Range#to_fs instead. If you fixed all
|
|
16
|
+
places inside your application that you see this deprecation, you can set
|
|
17
|
+
`ENV['RAILS_DISABLE_DEPRECATED_TO_S_CONVERSION']` to `"true"` in the `config/application.rb` file before
|
|
18
|
+
the `Bundler.require` call to fix all the callers outside of your application.
|
|
19
|
+
MSG
|
|
20
|
+
formatter.call(first, last)
|
|
21
|
+
else
|
|
22
|
+
super()
|
|
23
|
+
end
|
|
14
24
|
else
|
|
15
25
|
ActiveSupport::Deprecation.warn(
|
|
16
26
|
"Range#to_s(#{format.inspect}) is deprecated. Please use Range#to_fs(#{format.inspect}) instead."
|
|
@@ -97,8 +97,6 @@ class String
|
|
|
97
97
|
# 'active_record/errors'.camelize # => "ActiveRecord::Errors"
|
|
98
98
|
# 'active_record/errors'.camelize(:lower) # => "activeRecord::Errors"
|
|
99
99
|
#
|
|
100
|
-
# +camelize+ is also aliased as +camelcase+.
|
|
101
|
-
#
|
|
102
100
|
# See ActiveSupport::Inflector.camelize.
|
|
103
101
|
def camelize(first_letter = :upper)
|
|
104
102
|
case first_letter
|
|
@@ -124,8 +122,6 @@ class String
|
|
|
124
122
|
# 'x-men: the last stand'.titleize # => "X Men: The Last Stand"
|
|
125
123
|
# 'string_ending_with_id'.titleize(keep_id_suffix: true) # => "String Ending With Id"
|
|
126
124
|
#
|
|
127
|
-
# +titleize+ is also aliased as +titlecase+.
|
|
128
|
-
#
|
|
129
125
|
# See ActiveSupport::Inflector.titleize.
|
|
130
126
|
def titleize(keep_id_suffix: false)
|
|
131
127
|
ActiveSupport::Inflector.titleize(self, keep_id_suffix: keep_id_suffix)
|
|
@@ -11,7 +11,21 @@ class Time
|
|
|
11
11
|
)
|
|
12
12
|
formatter.respond_to?(:call) ? formatter.call(self).to_s : strftime(formatter)
|
|
13
13
|
elsif format == NOT_SET
|
|
14
|
-
|
|
14
|
+
if formatter = ::Time::DATE_FORMATS[:default]
|
|
15
|
+
ActiveSupport::Deprecation.warn(<<-MSG.squish)
|
|
16
|
+
Using a :default format for Time#to_s is deprecated. Please use Time#to_fs instead. If you fixed all places
|
|
17
|
+
inside your application that you see this deprecation, you can set
|
|
18
|
+
`ENV['RAILS_DISABLE_DEPRECATED_TO_S_CONVERSION']` to `"true"` in the `config/application.rb` file before
|
|
19
|
+
the `Bundler.require` call to fix all the callers outside of your application.
|
|
20
|
+
MSG
|
|
21
|
+
if formatter.respond_to?(:call)
|
|
22
|
+
formatter.call(self).to_s
|
|
23
|
+
else
|
|
24
|
+
strftime(formatter)
|
|
25
|
+
end
|
|
26
|
+
else
|
|
27
|
+
to_default_s
|
|
28
|
+
end
|
|
15
29
|
else
|
|
16
30
|
ActiveSupport::Deprecation.warn(
|
|
17
31
|
"Time#to_s(#{format.inspect}) is deprecated. Please use Time#to_fs(#{format.inspect}) instead."
|
|
@@ -20,3 +34,40 @@ class Time
|
|
|
20
34
|
end
|
|
21
35
|
end
|
|
22
36
|
end
|
|
37
|
+
|
|
38
|
+
module ActiveSupport
|
|
39
|
+
class TimeWithZone
|
|
40
|
+
NOT_SET = Object.new # :nodoc:
|
|
41
|
+
|
|
42
|
+
def to_s(format = NOT_SET) # :nodoc:
|
|
43
|
+
if format == :db
|
|
44
|
+
ActiveSupport::Deprecation.warn(
|
|
45
|
+
"TimeWithZone#to_s(:db) is deprecated. Please use TimeWithZone#to_fs(:db) instead."
|
|
46
|
+
)
|
|
47
|
+
utc.to_fs(format)
|
|
48
|
+
elsif formatter = ::Time::DATE_FORMATS[format]
|
|
49
|
+
ActiveSupport::Deprecation.warn(
|
|
50
|
+
"TimeWithZone#to_s(#{format.inspect}) is deprecated. Please use TimeWithZone#to_fs(#{format.inspect}) instead."
|
|
51
|
+
)
|
|
52
|
+
formatter.respond_to?(:call) ? formatter.call(self).to_s : strftime(formatter)
|
|
53
|
+
elsif format == NOT_SET
|
|
54
|
+
if formatter = ::Time::DATE_FORMATS[:default]
|
|
55
|
+
ActiveSupport::Deprecation.warn(<<-MSG.squish)
|
|
56
|
+
Using a :default format for TimeWithZone#to_s is deprecated. Please use TimeWithZone#to_fs instead.
|
|
57
|
+
If you fixed all places inside your application that you see this deprecation, you can set
|
|
58
|
+
`ENV['RAILS_DISABLE_DEPRECATED_TO_S_CONVERSION']` to `"true"` in the `config/application.rb` file before
|
|
59
|
+
the `Bundler.require` call to fix all the callers outside of your application.
|
|
60
|
+
MSG
|
|
61
|
+
formatter.respond_to?(:call) ? formatter.call(self).to_s : strftime(formatter)
|
|
62
|
+
else
|
|
63
|
+
"#{time.strftime("%Y-%m-%d %H:%M:%S")} #{formatted_offset(false, 'UTC')}" # mimicking Ruby Time#to_s format
|
|
64
|
+
end
|
|
65
|
+
else
|
|
66
|
+
ActiveSupport::Deprecation.warn(
|
|
67
|
+
"TimeWithZone#to_s(#{format.inspect}) is deprecated. Please use TimeWithZone#to_fs(#{format.inspect}) instead."
|
|
68
|
+
)
|
|
69
|
+
"#{time.strftime("%Y-%m-%d %H:%M:%S")} #{formatted_offset(false, 'UTC')}" # mimicking Ruby Time#to_s format
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "pathname"
|
|
4
|
-
require "
|
|
4
|
+
require "tempfile"
|
|
5
5
|
require "active_support/message_encryptor"
|
|
6
6
|
|
|
7
7
|
module ActiveSupport
|
|
@@ -81,17 +81,16 @@ module ActiveSupport
|
|
|
81
81
|
|
|
82
82
|
private
|
|
83
83
|
def writing(contents)
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
Tempfile.create(["", "-" + content_path.basename.to_s.chomp(".enc")]) do |tmp_file|
|
|
85
|
+
tmp_path = Pathname.new(tmp_file)
|
|
86
|
+
tmp_path.binwrite contents
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
yield tmp_path
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
updated_contents = tmp_path.binread
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
FileUtils.rm(tmp_path) if tmp_path&.exist?
|
|
92
|
+
write(updated_contents) if updated_contents != contents
|
|
93
|
+
end
|
|
95
94
|
end
|
|
96
95
|
|
|
97
96
|
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
gem "listen", "~> 3.5"
|
|
4
|
+
require "listen"
|
|
5
|
+
|
|
3
6
|
require "set"
|
|
4
7
|
require "pathname"
|
|
5
8
|
require "concurrent/atomic/atomic_boolean"
|
|
6
|
-
require "listen"
|
|
7
9
|
require "active_support/fork_tracker"
|
|
8
10
|
|
|
9
11
|
module ActiveSupport
|
|
@@ -43,6 +45,10 @@ module ActiveSupport
|
|
|
43
45
|
ObjectSpace.define_finalizer(self, @core.finalizer)
|
|
44
46
|
end
|
|
45
47
|
|
|
48
|
+
def inspect
|
|
49
|
+
"#<ActiveSupport::EventedFileUpdateChecker:#{object_id} @files=#{@core.files.to_a.inspect}"
|
|
50
|
+
end
|
|
51
|
+
|
|
46
52
|
def updated?
|
|
47
53
|
if @core.restart?
|
|
48
54
|
@core.thread_safely(&:restart)
|
|
@@ -66,7 +72,7 @@ module ActiveSupport
|
|
|
66
72
|
end
|
|
67
73
|
|
|
68
74
|
class Core
|
|
69
|
-
attr_reader :updated
|
|
75
|
+
attr_reader :updated, :files
|
|
70
76
|
|
|
71
77
|
def initialize(files, dirs)
|
|
72
78
|
@files = files.map { |file| Pathname(file).expand_path }.to_set
|
|
@@ -84,6 +90,10 @@ module ActiveSupport
|
|
|
84
90
|
@mutex = Mutex.new
|
|
85
91
|
|
|
86
92
|
start
|
|
93
|
+
# inotify / FSEvents file descriptors are inherited on fork, so
|
|
94
|
+
# we need to reopen them otherwise only the parent or the child
|
|
95
|
+
# will be notified.
|
|
96
|
+
# FIXME: this callback is keeping a reference on the instance
|
|
87
97
|
@after_fork = ActiveSupport::ForkTracker.after_fork { start }
|
|
88
98
|
end
|
|
89
99
|
|
|
@@ -105,6 +115,11 @@ module ActiveSupport
|
|
|
105
115
|
@dtw, @missing = [*@dtw, *@missing].partition(&:exist?)
|
|
106
116
|
@listener = @dtw.any? ? Listen.to(*@dtw, &method(:changed)) : nil
|
|
107
117
|
@listener&.start
|
|
118
|
+
|
|
119
|
+
# Wait for the listener to be ready to avoid race conditions
|
|
120
|
+
# Unfortunately this isn't quite enough on macOS because the Darwin backend
|
|
121
|
+
# has an extra private thread we can't wait on.
|
|
122
|
+
@listener&.wait_for_state(:processing_events)
|
|
108
123
|
end
|
|
109
124
|
|
|
110
125
|
def stop
|
|
@@ -136,7 +136,7 @@ module ActiveSupport
|
|
|
136
136
|
|
|
137
137
|
result.tr!("_", " ")
|
|
138
138
|
result.lstrip!
|
|
139
|
-
|
|
139
|
+
if !keep_id_suffix && lower_case_and_underscored_word&.end_with?("_id")
|
|
140
140
|
result.delete_suffix!(" id")
|
|
141
141
|
end
|
|
142
142
|
|
|
@@ -172,8 +172,6 @@ module ActiveSupport
|
|
|
172
172
|
# optional parameter +keep_id_suffix+ to true.
|
|
173
173
|
# By default, this parameter is false.
|
|
174
174
|
#
|
|
175
|
-
# +titleize+ is also aliased as +titlecase+.
|
|
176
|
-
#
|
|
177
175
|
# titleize('man from the boondocks') # => "Man From The Boondocks"
|
|
178
176
|
# titleize('x-men: the last stand') # => "X Men: The Last Stand"
|
|
179
177
|
# titleize('TheManWithoutAPast') # => "The Man Without A Past"
|
|
@@ -206,28 +206,9 @@ module ActiveSupport
|
|
|
206
206
|
end
|
|
207
207
|
alias_method :rfc822, :rfc2822
|
|
208
208
|
|
|
209
|
-
NOT_SET = Object.new # :nodoc:
|
|
210
|
-
|
|
211
209
|
# Returns a string of the object's date and time.
|
|
212
|
-
def to_s
|
|
213
|
-
|
|
214
|
-
ActiveSupport::Deprecation.warn(
|
|
215
|
-
"TimeWithZone#to_s(:db) is deprecated. Please use TimeWithZone#to_fs(:db) instead."
|
|
216
|
-
)
|
|
217
|
-
utc.to_fs(format)
|
|
218
|
-
elsif formatter = ::Time::DATE_FORMATS[format]
|
|
219
|
-
ActiveSupport::Deprecation.warn(
|
|
220
|
-
"TimeWithZone#to_s(#{format.inspect}) is deprecated. Please use TimeWithZone#to_fs(#{format.inspect}) instead."
|
|
221
|
-
)
|
|
222
|
-
formatter.respond_to?(:call) ? formatter.call(self).to_s : strftime(formatter)
|
|
223
|
-
elsif format == NOT_SET
|
|
224
|
-
"#{time.strftime("%Y-%m-%d %H:%M:%S")} #{formatted_offset(false, 'UTC')}" # mimicking Ruby Time#to_s format
|
|
225
|
-
else
|
|
226
|
-
ActiveSupport::Deprecation.warn(
|
|
227
|
-
"TimeWithZone#to_s(#{format.inspect}) is deprecated. Please use TimeWithZone#to_fs(#{format.inspect}) instead."
|
|
228
|
-
)
|
|
229
|
-
"#{time.strftime("%Y-%m-%d %H:%M:%S")} #{formatted_offset(false, 'UTC')}" # mimicking Ruby Time#to_s format
|
|
230
|
-
end
|
|
210
|
+
def to_s
|
|
211
|
+
"#{time.strftime("%Y-%m-%d %H:%M:%S")} #{formatted_offset(false, 'UTC')}" # mimicking Ruby Time#to_s format
|
|
231
212
|
end
|
|
232
213
|
|
|
233
214
|
# Returns a string of the object's date and time.
|
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: 7.0.
|
|
4
|
+
version: 7.0.8.6
|
|
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:
|
|
11
|
+
date: 2024-10-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: i18n
|
|
@@ -359,10 +359,10 @@ licenses:
|
|
|
359
359
|
- MIT
|
|
360
360
|
metadata:
|
|
361
361
|
bug_tracker_uri: https://github.com/rails/rails/issues
|
|
362
|
-
changelog_uri: https://github.com/rails/rails/blob/v7.0.
|
|
363
|
-
documentation_uri: https://api.rubyonrails.org/v7.0.
|
|
362
|
+
changelog_uri: https://github.com/rails/rails/blob/v7.0.8.6/activesupport/CHANGELOG.md
|
|
363
|
+
documentation_uri: https://api.rubyonrails.org/v7.0.8.6/
|
|
364
364
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
|
365
|
-
source_code_uri: https://github.com/rails/rails/tree/v7.0.
|
|
365
|
+
source_code_uri: https://github.com/rails/rails/tree/v7.0.8.6/activesupport
|
|
366
366
|
rubygems_mfa_required: 'true'
|
|
367
367
|
post_install_message:
|
|
368
368
|
rdoc_options:
|
|
@@ -381,7 +381,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
381
381
|
- !ruby/object:Gem::Version
|
|
382
382
|
version: '0'
|
|
383
383
|
requirements: []
|
|
384
|
-
rubygems_version: 3.
|
|
384
|
+
rubygems_version: 3.5.16
|
|
385
385
|
signing_key:
|
|
386
386
|
specification_version: 4
|
|
387
387
|
summary: A toolkit of support libraries and Ruby core extensions extracted from the
|