activesupport 4.2.6 → 4.2.7.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 182d466f939e8441e48114c049a954ddc3795f83
4
- data.tar.gz: dd969f16fd37128141e89893c927d63fc1248071
3
+ metadata.gz: 34314963e7f66f921d4059735ec65874f4647730
4
+ data.tar.gz: c5558821b13b6f6e49f25c6db4a37555f7ea2d9d
5
5
  SHA512:
6
- metadata.gz: 8c35bc97c010ec0758da46b173ccf793aac085f4e44fd149843be47279debf087475983d7247fe873839a6cd716d48874bee0cc6ad4d9378da9a0302c455daf0
7
- data.tar.gz: 38c3b1e81798671bd982341447c389ddb17e36c026ea619dc89946931b1913b0d0ee2414248283326cb1a53e702639a7f69984eafafe8c3250caa3741f59d3b5
6
+ metadata.gz: 76c1e89e71f4a1f60277c3c47a7474629db7442060d5464b2f1df0d677563410a843bbf07c2ae73efb6b64fbb7b85c5cc43d719e6e86b06fc7b5e61ab587c8ad
7
+ data.tar.gz: d60ee0b3fc3d8f58bf6c51a17f1f3697227b56be406c3d86a1ac2e4fe5d67e43103edfe5fc73195b74a1f28bf4bbd495a1bbba95332d0cd7fffad492c128a02d
@@ -1,3 +1,33 @@
1
+ ## Rails 4.2.7.rc1 (June 30, 2016) ##
2
+
3
+ * Fixed `ActiveSupport::Logger.broadcast` so that calls to `#silence` now
4
+ properly delegate to all loggers. Silencing now properly suppresses logging
5
+ to both the log and the console.
6
+
7
+ *Kevin McPhillips*
8
+
9
+ * Backported `ActiveSupport::LoggerThreadSafeLevel`. Assigning the
10
+ `Rails.logger.level` is now thread safe.
11
+
12
+ *Kevin McPhillips*
13
+
14
+ * Fixed a problem with ActiveSupport::SafeBuffer.titleize calling capitalize
15
+ on nil.
16
+
17
+ *Brian McManus*
18
+
19
+ * Time zones: Ensure that the UTC offset reflects DST changes that occurred
20
+ since the app started. Removes UTC offset caching, reducing performance,
21
+ but this is still relatively quick and isn't in any hot paths.
22
+
23
+ *Alexey Shein*
24
+
25
+ * Prevent `Marshal.load` from looping infinitely when trying to autoload a constant
26
+ which resolves to a different name.
27
+
28
+ *Olek Janiszewski*
29
+
30
+
1
31
  ## Rails 4.2.6 (March 07, 2016) ##
2
32
 
3
33
  * No changes.
@@ -5,10 +5,13 @@ module Marshal
5
5
  def load_with_autoloading(source)
6
6
  load_without_autoloading(source)
7
7
  rescue ArgumentError, NameError => exc
8
- if exc.message.match(%r|undefined class/module (.+)|)
8
+ if exc.message.match(%r|undefined class/module (.+?)(::)?\z|)
9
9
  # try loading the class/module
10
- $1.constantize
11
- # if it is a IO we need to go back to read the object
10
+ loaded = $1.constantize
11
+
12
+ raise unless $1 == loaded.name
13
+
14
+ # if it is an IO we need to go back to read the object
12
15
  source.rewind if source.respond_to?(:rewind)
13
16
  retry
14
17
  else
@@ -7,8 +7,8 @@ module ActiveSupport
7
7
  module VERSION
8
8
  MAJOR = 4
9
9
  MINOR = 2
10
- TINY = 6
11
- PRE = nil
10
+ TINY = 7
11
+ PRE = "rc1"
12
12
 
13
13
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
14
14
  end
@@ -153,7 +153,7 @@ module ActiveSupport
153
153
  # 'TheManWithoutAPast'.titleize # => "The Man Without A Past"
154
154
  # 'raiders_of_the_lost_ark'.titleize # => "Raiders Of The Lost Ark"
155
155
  def titleize(word)
156
- humanize(underscore(word)).gsub(/\b(?<!['’`])[a-z]/) { $&.capitalize }
156
+ humanize(underscore(word)).gsub(/\b(?<!['’`])[a-z]/) { |match| match.capitalize }
157
157
  end
158
158
 
159
159
  # Create the name of a table like Rails does for models to table names. This
@@ -1,9 +1,11 @@
1
1
  require 'active_support/core_ext/module/attribute_accessors'
2
2
  require 'active_support/logger_silence'
3
+ require 'active_support/logger_thread_safe_level'
3
4
  require 'logger'
4
5
 
5
6
  module ActiveSupport
6
7
  class Logger < ::Logger
8
+ include ActiveSupport::LoggerThreadSafeLevel
7
9
  include LoggerSilence
8
10
 
9
11
  # Broadcasts logs to multiple loggers.
@@ -38,6 +40,29 @@ module ActiveSupport
38
40
  logger.level = level
39
41
  super(level)
40
42
  end
43
+
44
+ define_method(:local_level=) do |level|
45
+ logger.local_level = level if logger.respond_to?(:local_level=)
46
+ super(level) if respond_to?(:local_level=)
47
+ end
48
+
49
+ define_method(:silence) do |level = Logger::ERROR, &block|
50
+ if logger.respond_to?(:silence) && logger.method(:silence).owner != ::Kernel
51
+ logger.silence(level) do
52
+ if respond_to?(:silence) && method(:silence).owner != ::Kernel
53
+ super(level, &block)
54
+ else
55
+ block.call(self)
56
+ end
57
+ end
58
+ else
59
+ if respond_to?(:silence) && method(:silence).owner != ::Kernel
60
+ super(level, &block)
61
+ else
62
+ block.call(self)
63
+ end
64
+ end
65
+ end
41
66
  end
42
67
  end
43
68
 
@@ -3,43 +3,25 @@ require 'thread_safe'
3
3
 
4
4
  module LoggerSilence
5
5
  extend ActiveSupport::Concern
6
-
6
+
7
7
  included do
8
8
  cattr_accessor :silencer
9
- attr_reader :local_levels
10
9
  self.silencer = true
11
10
  end
12
11
 
13
-
14
- def after_initialize
15
- @local_levels = ThreadSafe::Cache.new(:initial_capacity => 2)
16
- end
17
-
18
- def local_log_id
19
- Thread.current.__id__
20
- end
21
-
22
- def level
23
- local_levels[local_log_id] || super
24
- end
25
-
26
12
  # Silences the logger for the duration of the block.
27
13
  def silence(temporary_level = Logger::ERROR)
28
14
  if silencer
29
15
  begin
30
- old_local_level = local_levels[local_log_id]
31
- local_levels[local_log_id] = temporary_level
16
+ old_local_level = local_level
17
+ self.local_level = temporary_level
32
18
 
33
19
  yield self
34
20
  ensure
35
- if old_local_level
36
- local_levels[local_log_id] = old_local_level
37
- else
38
- local_levels.delete(local_log_id)
39
- end
21
+ self.local_level = old_local_level
40
22
  end
41
23
  else
42
24
  yield self
43
25
  end
44
26
  end
45
- end
27
+ end
@@ -0,0 +1,32 @@
1
+ require 'active_support/concern'
2
+ require 'concurrent'
3
+
4
+ module ActiveSupport
5
+ module LoggerThreadSafeLevel
6
+ extend ActiveSupport::Concern
7
+
8
+ def after_initialize
9
+ @local_levels = Concurrent::Map.new(:initial_capacity => 2)
10
+ end
11
+
12
+ def local_log_id
13
+ Thread.current.__id__
14
+ end
15
+
16
+ def local_level
17
+ @local_levels[local_log_id]
18
+ end
19
+
20
+ def local_level=(level)
21
+ if level
22
+ @local_levels[local_log_id] = level
23
+ else
24
+ @local_levels.delete(local_log_id)
25
+ end
26
+ end
27
+
28
+ def level
29
+ local_level || super
30
+ end
31
+ end
32
+ end
@@ -271,7 +271,6 @@ module ActiveSupport
271
271
  @name = name
272
272
  @utc_offset = utc_offset
273
273
  @tzinfo = tzinfo || TimeZone.find_tzinfo(name)
274
- @current_period = nil
275
274
  end
276
275
 
277
276
  # Returns the offset of this time zone from UTC in seconds.
@@ -279,8 +278,7 @@ module ActiveSupport
279
278
  if @utc_offset
280
279
  @utc_offset
281
280
  else
282
- @current_period ||= tzinfo.current_period if tzinfo
283
- @current_period.utc_offset if @current_period
281
+ tzinfo.current_period.utc_offset if tzinfo && tzinfo.current_period
284
282
  end
285
283
  end
286
284
 
@@ -20,11 +20,9 @@ module ActiveSupport
20
20
  data = StringIO.new(data || '')
21
21
  end
22
22
 
23
- char = data.getc
24
- if char.nil?
23
+ if data.eof?
25
24
  {}
26
25
  else
27
- data.ungetc(char)
28
26
  silence_warnings { require 'rexml/document' } unless defined?(REXML::Document)
29
27
  doc = REXML::Document.new(data)
30
28
 
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: 4.2.6
4
+ version: 4.2.7.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: 2016-03-07 00:00:00.000000000 Z
11
+ date: 2016-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -266,6 +266,7 @@ files:
266
266
  - lib/active_support/log_subscriber/test_helper.rb
267
267
  - lib/active_support/logger.rb
268
268
  - lib/active_support/logger_silence.rb
269
+ - lib/active_support/logger_thread_safe_level.rb
269
270
  - lib/active_support/message_encryptor.rb
270
271
  - lib/active_support/message_verifier.rb
271
272
  - lib/active_support/multibyte.rb
@@ -334,12 +335,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
334
335
  version: 1.9.3
335
336
  required_rubygems_version: !ruby/object:Gem::Requirement
336
337
  requirements:
337
- - - ">="
338
+ - - ">"
338
339
  - !ruby/object:Gem::Version
339
- version: '0'
340
+ version: 1.3.1
340
341
  requirements: []
341
342
  rubyforge_project:
342
- rubygems_version: 2.5.1
343
+ rubygems_version: 2.6.6
343
344
  signing_key:
344
345
  specification_version: 4
345
346
  summary: A toolkit of support libraries and Ruby core extensions extracted from the