activesupport 3.2.12 → 3.2.13.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: 7d9e10f770a63094a1ed7ef249e8e2a6853baf5c
4
- data.tar.gz: e3d2f97afa141a4e8381c61fa60886f5f28f0998
3
+ metadata.gz: 47027e783b124b2c126eba075f4ee4150eda02c0
4
+ data.tar.gz: fb96cee753de360a7108cb7e3be1c23ce21a7a48
5
5
  SHA512:
6
- metadata.gz: 28de98b6e759f71b4636f844e82e3f5a205eec56b466cb668b706895b443e1f9072d0af70b6bb597ea457caac288152dc75d7a41682a51e2840655d3e601838a
7
- data.tar.gz: 01ad11626b2bf1d30e83938d2d4f1d22a28cb5e5d00a8fac192b231c968fc3deda366c2d66ce2579f3a86b26c8d094980cae27845ec395a04293a21a42e15226
6
+ metadata.gz: 29e5d4110310851cabe87d9fb291da1a94be8ed6975a104f4c9973fac33244d1d179e634ae91cec996154dbe16928e8f9714ca7bee1b296b6bdadb1008b792bd
7
+ data.tar.gz: 827eed6d4b59236372c6bee2614376a0d9721dc3c8ad99f7dbf4fdcf8ded6b319223078e45331d6f2ea19f333be272c8bd2967bcfc69b5b05e8679623528261d
@@ -1,4 +1,41 @@
1
- ## Rails 3.2.10 (Jan 8, 2012) ##
1
+ ## unreleased ##
2
+
3
+ * No changes.
4
+
5
+
6
+ ## Rails 3.2.13 (Feb 17, 2013) ##
7
+
8
+
9
+ * Fix DateTime comparison with DateTime::Infinity object.
10
+
11
+ *Dan Kubb*
12
+
13
+ * Remove surrogate unicode character encoding from ActiveSupport::JSON.encode
14
+ The encoding scheme was broken for unicode characters outside the basic
15
+ multilingual plane; since json is assumed to be UTF-8, and we already force the
16
+ encoding to UTF-8 simply pass through the un-encoded characters.
17
+
18
+ *Brett Carter*
19
+
20
+ * Fix mocha v0.13.0 compatibility. *James Mead*
21
+
22
+ * `#as_json` isolates options when encoding a hash. [Backport #8185]
23
+ Fix #8182
24
+
25
+ *Yves Senn*
26
+
27
+ * Handle the possible Permission Denied errors atomic.rb might trigger due to
28
+ its chown and chmod calls. [Backport #8027]
29
+
30
+ *Daniele Sluijters*
31
+
32
+
33
+ ## Rails 3.2.12 (Feb 11, 2013) ##
34
+
35
+ * No changes.
36
+
37
+
38
+ ## Rails 3.2.11 (Jan 8, 2012) ##
2
39
 
3
40
  * Hash.from_xml raises when it encounters type="symbol" or type="yaml".
4
41
  Use Hash.from_trusted_xml to parse this XML.
@@ -7,6 +44,12 @@
7
44
 
8
45
  *Jeremy Kemper*
9
46
 
47
+
48
+ ## Rails 3.2.10 (Jan 2, 2013) ##
49
+
50
+ * No changes.
51
+
52
+
10
53
  ## Rails 3.2.9 (Nov 12, 2012) ##
11
54
 
12
55
  * Add logger.push_tags and .pop_tags to complement logger.tagged:
@@ -25,6 +68,7 @@
25
68
 
26
69
  * Add %:z and %::z format string support to ActiveSupport::TimeWithZone#strftime. [fixes #6962] *kennyj*
27
70
 
71
+
28
72
  ## Rails 3.2.8 (Aug 9, 2012) ##
29
73
 
30
74
  * Fix ActiveSupport integration with Mocha > 0.12.1. *Mike Gunderloy*
@@ -33,6 +77,7 @@
33
77
 
34
78
  * ERB::Util.html_escape now escapes single quotes. *Santiago Pastorino*
35
79
 
80
+
36
81
  ## Rails 3.2.7 (Jul 26, 2012) ##
37
82
 
38
83
  * Hash#fetch(fetch) is not the same as doing hash[key]
@@ -45,10 +90,12 @@
45
90
 
46
91
  * bump AS deprecation_horizon to 4.0
47
92
 
93
+
48
94
  ## Rails 3.2.6 (Jun 12, 2012) ##
49
95
 
50
96
  * No changes.
51
97
 
98
+
52
99
  ## Rails 3.2.5 (Jun 1, 2012) ##
53
100
 
54
101
  * ActiveSupport::JSON::Variable is deprecated. Define your own #as_json and #encode_json methods
@@ -6,7 +6,9 @@ module ActiveSupport
6
6
  # module M
7
7
  # def self.included(base)
8
8
  # base.extend ClassMethods
9
- # scope :disabled, where(:disabled => true)
9
+ # base.class_eval do
10
+ # scope :disabled, where(:disabled => true)
11
+ # end
10
12
  # end
11
13
  #
12
14
  # module ClassMethods
@@ -138,6 +138,6 @@ class DateTime
138
138
 
139
139
  # Layers additional behavior on DateTime#<=> so that Time and ActiveSupport::TimeWithZone instances can be compared with a DateTime
140
140
  def <=>(other)
141
- super other.to_datetime
141
+ super other.kind_of?(Infinity) ? other : other.to_datetime
142
142
  end
143
143
  end
@@ -36,7 +36,12 @@ class File
36
36
  FileUtils.mv(temp_file.path, file_name)
37
37
 
38
38
  # Set correct permissions on new file
39
- chown(old_stat.uid, old_stat.gid, file_name)
40
- chmod(old_stat.mode, file_name)
39
+ begin
40
+ chown(old_stat.uid, old_stat.gid, file_name)
41
+ # This operation will affect filesystem ACL's
42
+ chmod(old_stat.mode, file_name)
43
+ rescue Errno::EPERM
44
+ # Changing file ownership failed, moving on.
45
+ end
41
46
  end
42
47
  end
@@ -1,7 +1,6 @@
1
1
  require 'active_support/hash_with_indifferent_access'
2
2
 
3
3
  class Hash
4
-
5
4
  # Returns an <tt>ActiveSupport::HashWithIndifferentAccess</tt> out of its receiver:
6
5
  #
7
6
  # {:a => 1}.with_indifferent_access["a"] # => 1
@@ -13,7 +13,7 @@ class Hash
13
13
  # valid_keys = [:mass, :velocity, :time]
14
14
  # search(options.slice(*valid_keys))
15
15
  def slice(*keys)
16
- keys = keys.map! { |key| convert_key(key) } if respond_to?(:convert_key)
16
+ keys = keys.map! { |key| convert_key(key) } if respond_to?(:convert_key, true)
17
17
  hash = self.class.new
18
18
  keys.each { |k| hash[k] = self[k] if has_key?(k) }
19
19
  hash
@@ -23,7 +23,7 @@ class Hash
23
23
  # Returns a hash contained the removed key/value pairs
24
24
  # {:a => 1, :b => 2, :c => 3, :d => 4}.slice!(:a, :b) # => {:c => 3, :d => 4}
25
25
  def slice!(*keys)
26
- keys = keys.map! { |key| convert_key(key) } if respond_to?(:convert_key)
26
+ keys = keys.map! { |key| convert_key(key) } if respond_to?(:convert_key, true)
27
27
  omit = slice(*self.keys - keys)
28
28
  hash = slice(*keys)
29
29
  replace(hash)
@@ -1,4 +1,6 @@
1
1
  require 'rbconfig'
2
+ require 'stringio'
3
+
2
4
  module Kernel
3
5
  # Sets $VERBOSE to nil for the duration of the block and back to its original value afterwards.
4
6
  #
@@ -217,7 +217,7 @@ class Time
217
217
 
218
218
  # Returns a new Time representing the end of the day, 23:59:59.999999 (.999999999 in ruby1.9)
219
219
  def end_of_day
220
- change(:hour => 23, :min => 59, :sec => 59, :usec => 999999.999)
220
+ change(:hour => 23, :min => 59, :sec => 59, :usec => Rational(999999999, 1000))
221
221
  end
222
222
 
223
223
  # Returns a new Time representing the start of the hour (x:00)
@@ -228,11 +228,7 @@ class Time
228
228
 
229
229
  # Returns a new Time representing the end of the hour, x:59:59.999999 (.999999999 in ruby1.9)
230
230
  def end_of_hour
231
- change(
232
- :min => 59,
233
- :sec => 59,
234
- :usec => 999999.999
235
- )
231
+ change(:min => 59, :sec => 59, :usec => Rational(999999999, 1000))
236
232
  end
237
233
 
238
234
  # Returns a new Time representing the start of the month (1st of the month, 0:00)
@@ -246,7 +242,7 @@ class Time
246
242
  def end_of_month
247
243
  #self - ((self.mday-1).days + self.seconds_since_midnight)
248
244
  last_day = ::Time.days_in_month(month, year)
249
- change(:day => last_day, :hour => 23, :min => 59, :sec => 59, :usec => 999999.999)
245
+ change(:day => last_day, :hour => 23, :min => 59, :sec => 59, :usec => Rational(999999999, 1000))
250
246
  end
251
247
  alias :at_end_of_month :end_of_month
252
248
 
@@ -270,7 +266,7 @@ class Time
270
266
 
271
267
  # Returns a new Time representing the end of the year (end of the 31st of december)
272
268
  def end_of_year
273
- change(:month => 12, :day => 31, :hour => 23, :min => 59, :sec => 59, :usec => 999999.999)
269
+ change(:month => 12, :day => 31, :hour => 23, :min => 59, :sec => 59, :usec => Rational(999999999, 1000))
274
270
  end
275
271
  alias :at_end_of_year :end_of_year
276
272
 
@@ -13,6 +13,8 @@ class Time
13
13
  :rfc822 => lambda { |time| time.strftime("%a, %d %b %Y %H:%M:%S #{time.formatted_offset(false)}") }
14
14
  }
15
15
 
16
+ DATE_FORMATS[:nsec] = '%Y%m%d%H%M%S%9N' if RUBY_VERSION >= '1.9'
17
+
16
18
  # Converts to a formatted string. See DATE_FORMATS for builtin formats.
17
19
  #
18
20
  # This method is aliased to <tt>to_s</tt>.
@@ -20,7 +20,7 @@ if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
20
20
  def _dump(*args)
21
21
  obj = dup
22
22
  obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23
- obj._dump_without_utc_flag(*args)
23
+ obj.send :_dump_without_utc_flag, *args
24
24
  end
25
25
  end
26
26
  end
@@ -51,7 +51,7 @@ if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
51
51
  def _dump(*args)
52
52
  obj = dup
53
53
  obj.instance_variable_set('@_zone', zone)
54
- obj._dump_without_zone(*args)
54
+ obj.send :_dump_without_zone, *args
55
55
  end
56
56
  end
57
57
  end
@@ -6,7 +6,7 @@ require 'active_support/core_ext/hash/keys'
6
6
 
7
7
  module ActiveSupport
8
8
  class HashWithIndifferentAccess < Hash
9
-
9
+
10
10
  # Always returns true, so that <tt>Array#extract_options!</tt> finds members of this class.
11
11
  def extractable_options?
12
12
  true
@@ -61,7 +61,7 @@ module ActiveSupport
61
61
  # hashes and arrays need to get encoder in the options, so that they can detect circular references
62
62
  options.merge(:encoder => self)
63
63
  else
64
- options
64
+ options.dup
65
65
  end
66
66
  end
67
67
 
@@ -122,13 +122,7 @@ module ActiveSupport
122
122
  if string.respond_to?(:force_encoding)
123
123
  string = string.encode(::Encoding::UTF_8, :undef => :replace).force_encoding(::Encoding::BINARY)
124
124
  end
125
- json = string.
126
- gsub(escape_regex) { |s| ESCAPED_CHARS[s] }.
127
- gsub(/([\xC0-\xDF][\x80-\xBF]|
128
- [\xE0-\xEF][\x80-\xBF]{2}|
129
- [\xF0-\xF7][\x80-\xBF]{3})+/nx) { |s|
130
- s.unpack("U*").pack("n*").unpack("H*")[0].gsub(/.{4}/n, '\\\\u\&')
131
- }
125
+ json = string.gsub(escape_regex) { |s| ESCAPED_CHARS[s] }
132
126
  json = %("#{json}")
133
127
  json.force_encoding(::Encoding::UTF_8) if json.respond_to?(:force_encoding)
134
128
  json
@@ -10,7 +10,7 @@ require 'active_support/core_ext/kernel/reporting'
10
10
 
11
11
  module ActiveSupport
12
12
  class TestCase < ::Test::Unit::TestCase
13
- if defined? MiniTest
13
+ if defined?(MiniTest::Assertions) && TestCase < MiniTest::Assertions
14
14
  Assertion = MiniTest::Assertion
15
15
  alias_method :method_name, :name if method_defined? :name
16
16
  alias_method :method_name, :__name__ if method_defined? :__name__
@@ -12,8 +12,8 @@ module ActiveSupport
12
12
  end
13
13
 
14
14
  class ProxyTestResult
15
- def initialize
16
- @calls = []
15
+ def initialize(calls = [])
16
+ @calls = calls
17
17
  end
18
18
 
19
19
  def add_error(e)
@@ -27,6 +27,14 @@ module ActiveSupport
27
27
  end
28
28
  end
29
29
 
30
+ def marshal_dump
31
+ @calls
32
+ end
33
+
34
+ def marshal_load(calls)
35
+ initialize(calls)
36
+ end
37
+
30
38
  def method_missing(name, *args)
31
39
  @calls << [name, args]
32
40
  end
@@ -1,7 +1,7 @@
1
1
  begin
2
- silence_warnings { require 'mocha' }
2
+ silence_warnings { require 'mocha/setup' }
3
3
  rescue LoadError
4
4
  # Fake Mocha::ExpectationError so we can rescue it in #run. Bleh.
5
5
  Object.const_set :Mocha, Module.new
6
6
  Mocha.const_set :ExpectationError, Class.new(StandardError)
7
- end
7
+ end
@@ -142,7 +142,7 @@ module ActiveSupport
142
142
  end
143
143
  end
144
144
 
145
- if RUBY_VERSION.between?('1.9.2', '2.0')
145
+ if RUBY_VERSION.between?('1.9.2', '2.0.0')
146
146
  require 'active_support/testing/performance/ruby/yarv'
147
147
  elsif RUBY_VERSION.between?('1.8.6', '1.9')
148
148
  require 'active_support/testing/performance/ruby/mri'
@@ -61,7 +61,7 @@ module ActiveSupport
61
61
  def run(result)
62
62
  return if @method_name.to_s == "default_test"
63
63
 
64
- mocha_counter = retrieve_mocha_counter(result)
64
+ mocha_counter = retrieve_mocha_counter(self, result)
65
65
  yield(Test::Unit::TestCase::STARTED, name)
66
66
  @_result = result
67
67
 
@@ -83,6 +83,8 @@ module ActiveSupport
83
83
  begin
84
84
  teardown
85
85
  run_callbacks :teardown
86
+ rescue Mocha::ExpectationError => e
87
+ add_failure(e.message, e.backtrace)
86
88
  rescue Test::Unit::AssertionFailedError => e
87
89
  add_failure(e.message, e.backtrace)
88
90
  rescue Exception => e
@@ -100,19 +102,20 @@ module ActiveSupport
100
102
 
101
103
  protected
102
104
 
103
- def retrieve_mocha_counter(result) #:nodoc:
105
+ def retrieve_mocha_counter(test_case, result) #:nodoc:
104
106
  if respond_to?(:mocha_verify) # using mocha
105
107
  if defined?(Mocha::TestCaseAdapter::AssertionCounter)
106
108
  Mocha::TestCaseAdapter::AssertionCounter.new(result)
107
109
  elsif defined?(Mocha::Integration::TestUnit::AssertionCounter)
108
110
  Mocha::Integration::TestUnit::AssertionCounter.new(result)
109
- else
111
+ elsif defined?(Mocha::MonkeyPatching::TestUnit::AssertionCounter)
110
112
  Mocha::MonkeyPatching::TestUnit::AssertionCounter.new(result)
113
+ else
114
+ Mocha::Integration::AssertionCounter.new(test_case)
111
115
  end
112
116
  end
113
117
  end
114
118
  end
115
-
116
119
  end
117
120
  end
118
121
  end
@@ -329,8 +329,7 @@ module ActiveSupport
329
329
 
330
330
  # Send the missing method to +time+ instance, and wrap result in a new TimeWithZone with the existing +time_zone+.
331
331
  def method_missing(sym, *args, &block)
332
- result = time.__send__(sym, *args, &block)
333
- result.acts_like?(:time) ? self.class.new(nil, time_zone, result) : result
332
+ wrap_with_time_zone time.__send__(sym, *args, &block)
334
333
  end
335
334
 
336
335
  private
@@ -348,11 +347,22 @@ module ActiveSupport
348
347
  end
349
348
 
350
349
  def transfer_time_values_to_utc_constructor(time)
351
- ::Time.utc_time(time.year, time.month, time.day, time.hour, time.min, time.sec, time.respond_to?(:usec) ? time.usec : 0)
350
+ usec = time.respond_to?(:nsec) ? Rational(time.nsec, 1000) : (time.respond_to?(:usec) ? time.usec : 0)
351
+ ::Time.utc_time(time.year, time.month, time.day, time.hour, time.min, time.sec, usec)
352
352
  end
353
353
 
354
354
  def duration_of_variable_length?(obj)
355
355
  ActiveSupport::Duration === obj && obj.parts.any? {|p| p[0].in?([:years, :months, :days]) }
356
356
  end
357
+
358
+ def wrap_with_time_zone(time)
359
+ if time.acts_like?(:time)
360
+ self.class.new(nil, time_zone, time)
361
+ elsif time.is_a?(Range)
362
+ wrap_with_time_zone(time.begin)..wrap_with_time_zone(time.end)
363
+ else
364
+ time
365
+ end
366
+ end
357
367
  end
358
368
  end
@@ -2,8 +2,8 @@ module ActiveSupport
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 3
4
4
  MINOR = 2
5
- TINY = 12
6
- PRE = nil
5
+ TINY = 13
6
+ PRE = "rc1"
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
9
9
  end
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activesupport
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.12
4
+ version: 3.2.13.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: 2013-02-11 00:00:00.000000000 Z
11
+ date: 2013-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: '0.6'
19
+ version: 0.6.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: '0.6'
26
+ version: 0.6.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: multi_json
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.0'
41
41
  description: A toolkit of support libraries and Ruby core extensions extracted from
@@ -264,23 +264,23 @@ licenses: []
264
264
  metadata: {}
265
265
  post_install_message:
266
266
  rdoc_options:
267
- - "--encoding"
267
+ - --encoding
268
268
  - UTF-8
269
269
  require_paths:
270
270
  - lib
271
271
  required_ruby_version: !ruby/object:Gem::Requirement
272
272
  requirements:
273
- - - ">="
273
+ - - '>='
274
274
  - !ruby/object:Gem::Version
275
275
  version: 1.8.7
276
276
  required_rubygems_version: !ruby/object:Gem::Requirement
277
277
  requirements:
278
- - - ">="
278
+ - - '>'
279
279
  - !ruby/object:Gem::Version
280
- version: '0'
280
+ version: 1.3.1
281
281
  requirements: []
282
282
  rubyforge_project:
283
- rubygems_version: 2.0.0.rc.2
283
+ rubygems_version: 2.0.0
284
284
  signing_key:
285
285
  specification_version: 4
286
286
  summary: A toolkit of support libraries and Ruby core extensions extracted from the