activesupport 6.0.0.rc1 → 6.0.0.rc2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5824eb9bee53907d29aeb5fb77f421600014d77d12a1bde43f157d1d5800295d
4
- data.tar.gz: 7eba1dd34b2969d726c40864d0a5d3b0e001863bfef65a839f8cc98d3c920067
3
+ metadata.gz: 2f1a531964dc7b93ba5f951990c6aecc97470d1f4cedc602c3b080a25d7a076c
4
+ data.tar.gz: d6ff298a19a11b18945cfd5efb271319e488ddd50abf3792a150692f2c4cb838
5
5
  SHA512:
6
- metadata.gz: a1129a67ccf6eee1a76959d74161260dcaae3dc2e14af46996075ea6c5293dfe993f8575d98ac196a873d38e1d9256c70929d34b3d6655f7a92b4d2930dad188
7
- data.tar.gz: 69081cf5038e340c1cf8f8e5bbbd1f1481561954762041d724d38a3c887a566047d27ea418f8ca407b81f0508da5c9e22783f4f1eac4afca417d00735fea7341
6
+ metadata.gz: 134bf09fca6daf34f64319c1a283c279c49de42f2dc5958d2b62e7535986e916206831ee37651bcf1d7b819c615b777e07f7d1093ba77bcd9766dd21c2e2ccdf
7
+ data.tar.gz: 0eb981e0fa2485636863834524a3081af1f592a8db24e029faff8257c8aa0a17ad89950752cca2f9ea34b41868369cb0389a57a8216b3fbe585b51b647a98ae0
@@ -1,3 +1,27 @@
1
+ ## Rails 6.0.0.rc2 (July 22, 2019) ##
2
+
3
+ * `truncate` would return the original string if it was too short to be truncated
4
+ and a frozen string if it were long enough to be truncated. Now truncate will
5
+ consistently return an unfrozen string regardless. This behavior is consistent
6
+ with `gsub` and `strip`.
7
+
8
+ Before:
9
+
10
+ 'foobar'.truncate(5).frozen?
11
+ # => true
12
+ 'foobar'.truncate(6).frozen?
13
+ # => false
14
+
15
+ After:
16
+
17
+ 'foobar'.truncate(5).frozen?
18
+ # => false
19
+ 'foobar'.truncate(6).frozen?
20
+ # => false
21
+
22
+ *Jordan Thomas*
23
+
24
+
1
25
  ## Rails 6.0.0.rc1 (April 24, 2019) ##
2
26
 
3
27
  * Introduce `ActiveSupport::ActionableError`.
@@ -20,21 +20,11 @@ module DateAndTime
20
20
  advance(days: -1)
21
21
  end
22
22
 
23
- # Returns a new date/time the specified number of days ago.
24
- def prev_day(days = 1)
25
- advance(days: -days)
26
- end
27
-
28
23
  # Returns a new date/time representing tomorrow.
29
24
  def tomorrow
30
25
  advance(days: 1)
31
26
  end
32
27
 
33
- # Returns a new date/time the specified number of days in the future.
34
- def next_day(days = 1)
35
- advance(days: days)
36
- end
37
-
38
28
  # Returns true if the date/time is today.
39
29
  def today?
40
30
  to_date == ::Date.current
@@ -198,21 +188,11 @@ module DateAndTime
198
188
  end
199
189
  end
200
190
 
201
- # Returns a new date/time the specified number of months in the future.
202
- def next_month(months = 1)
203
- advance(months: months)
204
- end
205
-
206
191
  # Short-hand for months_since(3)
207
192
  def next_quarter
208
193
  months_since(3)
209
194
  end
210
195
 
211
- # Returns a new date/time the specified number of years in the future.
212
- def next_year(years = 1)
213
- advance(years: years)
214
- end
215
-
216
196
  # Returns a new date/time representing the given day in the previous week.
217
197
  # Week is assumed to start on +start_day+, default is
218
198
  # +Date.beginning_of_week+ or +config.beginning_of_week+ when set.
@@ -233,11 +213,6 @@ module DateAndTime
233
213
  end
234
214
  alias_method :last_weekday, :prev_weekday
235
215
 
236
- # Returns a new date/time the specified number of months ago.
237
- def prev_month(months = 1)
238
- advance(months: -months)
239
- end
240
-
241
216
  # Short-hand for months_ago(1).
242
217
  def last_month
243
218
  months_ago(1)
@@ -249,11 +224,6 @@ module DateAndTime
249
224
  end
250
225
  alias_method :last_quarter, :prev_quarter
251
226
 
252
- # Returns a new date/time the specified number of years ago.
253
- def prev_year(years = 1)
254
- advance(years: -years)
255
- end
256
-
257
227
  # Short-hand for years_ago(1).
258
228
  def last_year
259
229
  years_ago(1)
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "active_support/core_ext/digest/uuid"
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Hash
4
- # Returns a new hash with all keys converted by the block operation.
5
- # This includes the keys from the root hash and from all
4
+ # Returns a new hash with all values converted by the block operation.
5
+ # This includes the values from the root hash and from all
6
6
  # nested hashes and arrays.
7
7
  #
8
8
  # hash = { person: { name: 'Rob', age: '28' } }
@@ -28,96 +28,6 @@ class Object
28
28
  end
29
29
  end
30
30
 
31
- class NilClass
32
- begin
33
- nil.dup
34
- rescue TypeError
35
-
36
- # +nil+ is not duplicable:
37
- #
38
- # nil.duplicable? # => false
39
- # nil.dup # => TypeError: can't dup NilClass
40
- def duplicable?
41
- false
42
- end
43
- end
44
- end
45
-
46
- class FalseClass
47
- begin
48
- false.dup
49
- rescue TypeError
50
-
51
- # +false+ is not duplicable:
52
- #
53
- # false.duplicable? # => false
54
- # false.dup # => TypeError: can't dup FalseClass
55
- def duplicable?
56
- false
57
- end
58
- end
59
- end
60
-
61
- class TrueClass
62
- begin
63
- true.dup
64
- rescue TypeError
65
-
66
- # +true+ is not duplicable:
67
- #
68
- # true.duplicable? # => false
69
- # true.dup # => TypeError: can't dup TrueClass
70
- def duplicable?
71
- false
72
- end
73
- end
74
- end
75
-
76
- class Symbol
77
- begin
78
- :symbol.dup
79
-
80
- # Some symbols couldn't be duped in Ruby 2.4.0 only, due to a bug.
81
- # This feature check catches any regression.
82
- "symbol_from_string".to_sym.dup
83
- rescue TypeError
84
-
85
- # Symbols are not duplicable:
86
- #
87
- # :my_symbol.duplicable? # => false
88
- # :my_symbol.dup # => TypeError: can't dup Symbol
89
- def duplicable?
90
- false
91
- end
92
- end
93
- end
94
-
95
- class Numeric
96
- begin
97
- 1.dup
98
- rescue TypeError
99
-
100
- # Numbers are not duplicable:
101
- #
102
- # 3.duplicable? # => false
103
- # 3.dup # => TypeError: can't dup Integer
104
- def duplicable?
105
- false
106
- end
107
- end
108
- end
109
-
110
- require "bigdecimal"
111
- class BigDecimal
112
- # BigDecimals are duplicable:
113
- #
114
- # BigDecimal("1.2").duplicable? # => true
115
- # BigDecimal("1.2").dup # => #<BigDecimal:...,'0.12E1',18(18)>
116
- def duplicable?
117
- true
118
- end
119
- end
120
-
121
31
  class Method
122
32
  # Methods are not duplicable:
123
33
  #
@@ -128,32 +38,12 @@ class Method
128
38
  end
129
39
  end
130
40
 
131
- class Complex
132
- begin
133
- Complex(1).dup
134
- rescue TypeError
135
-
136
- # Complexes are not duplicable:
137
- #
138
- # Complex(1).duplicable? # => false
139
- # Complex(1).dup # => TypeError: can't copy Complex
140
- def duplicable?
141
- false
142
- end
143
- end
144
- end
145
-
146
- class Rational
147
- begin
148
- Rational(1).dup
149
- rescue TypeError
150
-
151
- # Rationals are not duplicable:
152
- #
153
- # Rational(1).duplicable? # => false
154
- # Rational(1).dup # => TypeError: can't copy Rational
155
- def duplicable?
156
- false
157
- end
41
+ class UnboundMethod
42
+ # Unbound methods are not duplicable:
43
+ #
44
+ # method(:puts).unbind.duplicable? # => false
45
+ # method(:puts).unbind.dup # => TypeError: allocator undefined for UnboundMethod
46
+ def duplicable?
47
+ false
158
48
  end
159
49
  end
@@ -75,7 +75,7 @@ class String
75
75
  length_with_room_for_omission
76
76
  end
77
77
 
78
- "#{self[0, stop]}#{omission}"
78
+ +"#{self[0, stop]}#{omission}"
79
79
  end
80
80
 
81
81
  # Truncates +text+ to at most <tt>bytesize</tt> bytes in length without
@@ -311,4 +311,34 @@ class Time
311
311
  end
312
312
  alias_method :eql_without_coercion, :eql?
313
313
  alias_method :eql?, :eql_with_coercion
314
+
315
+ # Returns a new time the specified number of days ago.
316
+ def prev_day(days = 1)
317
+ advance(days: -days)
318
+ end
319
+
320
+ # Returns a new time the specified number of days in the future.
321
+ def next_day(days = 1)
322
+ advance(days: days)
323
+ end
324
+
325
+ # Returns a new time the specified number of months ago.
326
+ def prev_month(months = 1)
327
+ advance(months: -months)
328
+ end
329
+
330
+ # Returns a new time the specified number of months in the future.
331
+ def next_month(months = 1)
332
+ advance(months: months)
333
+ end
334
+
335
+ # Returns a new time the specified number of years ago.
336
+ def prev_year(years = 1)
337
+ advance(years: -years)
338
+ end
339
+
340
+ # Returns a new time the specified number of years in the future.
341
+ def next_year(years = 1)
342
+ advance(years: years)
343
+ end
314
344
  end
@@ -201,6 +201,11 @@ module ActiveSupport #:nodoc:
201
201
  end
202
202
  end
203
203
 
204
+ def self.include_into(base)
205
+ base.include(self)
206
+ append_features(base)
207
+ end
208
+
204
209
  def const_missing(const_name)
205
210
  from_mod = anonymous? ? guess_for_anonymous(const_name) : self
206
211
  Dependencies.load_missing_constant(from_mod, const_name)
@@ -230,6 +235,21 @@ module ActiveSupport #:nodoc:
230
235
  base.class_eval do
231
236
  define_method(:load, Kernel.instance_method(:load))
232
237
  private :load
238
+
239
+ define_method(:require, Kernel.instance_method(:require))
240
+ private :require
241
+ end
242
+ end
243
+
244
+ def self.include_into(base)
245
+ base.include(self)
246
+
247
+ if base.instance_method(:load).owner == base
248
+ base.remove_method(:load)
249
+ end
250
+
251
+ if base.instance_method(:require).owner == base
252
+ base.remove_method(:require)
233
253
  end
234
254
  end
235
255
 
@@ -326,9 +346,9 @@ module ActiveSupport #:nodoc:
326
346
  end
327
347
 
328
348
  def hook!
329
- Object.class_eval { include Loadable }
330
- Module.class_eval { include ModuleConstMissing }
331
- Exception.class_eval { include Blamable }
349
+ Loadable.include_into(Object)
350
+ ModuleConstMissing.include_into(Module)
351
+ Exception.include(Blamable)
332
352
  end
333
353
 
334
354
  def unhook!
@@ -120,7 +120,14 @@ module ActiveSupport
120
120
  # # => DEPRECATION WARNING: PLANETS is deprecated! Use PLANETS_POST_2006 instead.
121
121
  # (Backtrace information…)
122
122
  # ["Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune"]
123
- class DeprecatedConstantProxy < DeprecationProxy
123
+ class DeprecatedConstantProxy < Module
124
+ def self.new(*args, &block)
125
+ object = args.first
126
+
127
+ return object unless object
128
+ super
129
+ end
130
+
124
131
  def initialize(old_const, new_const, deprecator = ActiveSupport::Deprecation.instance, message: "#{old_const} is deprecated! Use #{new_const} instead.")
125
132
  require "active_support/inflector/methods"
126
133
 
@@ -130,6 +137,14 @@ module ActiveSupport
130
137
  @message = message
131
138
  end
132
139
 
140
+ instance_methods.each { |m| undef_method m unless /^__|^object_id$/.match?(m) }
141
+
142
+ # Don't give a deprecation warning on inspect since test/unit and error
143
+ # logs rely on it for diagnostics.
144
+ def inspect
145
+ target.inspect
146
+ end
147
+
133
148
  # Returns the class of the new constant.
134
149
  #
135
150
  # PLANETS_POST_2006 = %w(mercury venus earth mars jupiter saturn uranus neptune)
@@ -144,8 +159,14 @@ module ActiveSupport
144
159
  ActiveSupport::Inflector.constantize(@new_const.to_s)
145
160
  end
146
161
 
147
- def warn(callstack, called, args)
148
- @deprecator.warn(@message, callstack)
162
+ def const_missing(name)
163
+ @deprecator.warn(@message, caller_locations)
164
+ target.const_get(name)
165
+ end
166
+
167
+ def method_missing(called, *args, &block)
168
+ @deprecator.warn(@message, caller_locations)
169
+ target.__send__(called, *args, &block)
149
170
  end
150
171
  end
151
172
  end
@@ -107,13 +107,23 @@ module ActiveSupport
107
107
 
108
108
  private
109
109
  def boot!
110
- Listen.to(*@dtw, &method(:changed)).start
110
+ normalize_dirs!
111
+
112
+ unless @dtw.empty?
113
+ Listen.to(*@dtw, &method(:changed)).start
114
+ end
111
115
  end
112
116
 
113
117
  def shutdown!
114
118
  Listen.stop
115
119
  end
116
120
 
121
+ def normalize_dirs!
122
+ @dirs.transform_keys! do |dir|
123
+ dir.exist? ? dir.realpath : dir
124
+ end
125
+ end
126
+
117
127
  def changed(modified, added, removed)
118
128
  unless updated?
119
129
  @updated.make_true if (modified + added + removed).any? { |f| watching?(f) }
@@ -10,7 +10,7 @@ module ActiveSupport
10
10
  MAJOR = 6
11
11
  MINOR = 0
12
12
  TINY = 0
13
- PRE = "rc1"
13
+ PRE = "rc2"
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
@@ -180,13 +180,13 @@ module ActiveSupport
180
180
 
181
181
  def start(name, id, payload)
182
182
  timestack = Thread.current[:_timestack] ||= []
183
- timestack.push Concurrent.monotonic_time
183
+ timestack.push Time.now
184
184
  end
185
185
 
186
186
  def finish(name, id, payload)
187
187
  timestack = Thread.current[:_timestack]
188
188
  started = timestack.pop
189
- @delegate.call(name, started, Concurrent.monotonic_time, id, payload)
189
+ @delegate.call(name, started, Time.now, id, payload)
190
190
  end
191
191
  end
192
192
 
@@ -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
 
@@ -109,6 +113,10 @@ module ActiveSupport
109
113
  def shutdown
110
114
  @queue_size.times { @queue << nil }
111
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
112
120
  end
113
121
 
114
122
  private
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.0.rc1
4
+ version: 6.0.0.rc2
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-04-24 00:00:00.000000000 Z
11
+ date: 2019-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -87,7 +87,7 @@ dependencies:
87
87
  version: '2.1'
88
88
  - - ">="
89
89
  - !ruby/object:Gem::Version
90
- version: 2.1.4
90
+ version: 2.1.8
91
91
  type: :runtime
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
@@ -97,7 +97,7 @@ dependencies:
97
97
  version: '2.1'
98
98
  - - ">="
99
99
  - !ruby/object:Gem::Version
100
- version: 2.1.4
100
+ version: 2.1.8
101
101
  description: A toolkit of support libraries and Ruby core extensions extracted from
102
102
  the Rails framework. Rich support for multibyte strings, internationalization, time
103
103
  zones, and testing.
@@ -161,6 +161,7 @@ files:
161
161
  - lib/active_support/core_ext/date_time/calculations.rb
162
162
  - lib/active_support/core_ext/date_time/compatibility.rb
163
163
  - lib/active_support/core_ext/date_time/conversions.rb
164
+ - lib/active_support/core_ext/digest.rb
164
165
  - lib/active_support/core_ext/digest/uuid.rb
165
166
  - lib/active_support/core_ext/enumerable.rb
166
167
  - lib/active_support/core_ext/file.rb
@@ -357,8 +358,8 @@ homepage: https://rubyonrails.org
357
358
  licenses:
358
359
  - MIT
359
360
  metadata:
360
- source_code_uri: https://github.com/rails/rails/tree/v6.0.0.rc1/activesupport
361
- changelog_uri: https://github.com/rails/rails/blob/v6.0.0.rc1/activesupport/CHANGELOG.md
361
+ source_code_uri: https://github.com/rails/rails/tree/v6.0.0.rc2/activesupport
362
+ changelog_uri: https://github.com/rails/rails/blob/v6.0.0.rc2/activesupport/CHANGELOG.md
362
363
  post_install_message:
363
364
  rdoc_options:
364
365
  - "--encoding"