diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-05-23 19:45:49 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2011-05-23 20:25:44 +0100 |
commit | 1170cceaaec8c0c8aef173913405be1456e4b2be (patch) | |
tree | 226e6eb1294b6490a9842d604330a948951e2135 | |
parent | d411c85a65baaf4ed268b1b1bb4df408cee4981a (diff) | |
download | rails-1170cceaaec8c0c8aef173913405be1456e4b2be.tar.gz rails-1170cceaaec8c0c8aef173913405be1456e4b2be.tar.bz2 rails-1170cceaaec8c0c8aef173913405be1456e4b2be.zip |
Removed ActiveSupport::SecureRandom in favour of SecureRandom from the standard library. (It has been deprecated in the 3-1-stable branch.)
-rw-r--r-- | activesupport/CHANGELOG | 6 | ||||
-rw-r--r-- | activesupport/lib/active_support.rb | 1 | ||||
-rw-r--r-- | activesupport/lib/active_support/notifications/instrumenter.rb | 1 | ||||
-rw-r--r-- | activesupport/lib/active_support/secure_random.rb | 6 | ||||
-rw-r--r-- | activesupport/test/secure_random_test.rb | 19 | ||||
-rw-r--r-- | railties/lib/rails/generators/app_base.rb | 2 | ||||
-rw-r--r-- | railties/lib/rails/tasks/misc.rake | 2 |
7 files changed, 8 insertions, 29 deletions
diff --git a/activesupport/CHANGELOG b/activesupport/CHANGELOG index 23b0df1d5c..bfd1e91bb5 100644 --- a/activesupport/CHANGELOG +++ b/activesupport/CHANGELOG @@ -1,5 +1,11 @@ +*Rails 3.2.0 (unreleased)* + +* Removed ActiveSupport::SecureRandom in favour of SecureRandom from the standard library [Jon Leighton] + *Rails 3.1.0 (unreleased)* +* Deprecated ActiveSupport::SecureRandom in favour of SecureRandom from the standard library [Jon Leighton] + * New reporting method Kernel#quietly. [fxn] * Add String#inquiry as a convenience method for turning a string into a StringInquirer object [DHH] diff --git a/activesupport/lib/active_support.rb b/activesupport/lib/active_support.rb index 63830d721a..cc9ea5cffa 100644 --- a/activesupport/lib/active_support.rb +++ b/activesupport/lib/active_support.rb @@ -70,7 +70,6 @@ module ActiveSupport autoload :OrderedHash autoload :OrderedOptions autoload :Rescuable - autoload :SecureRandom autoload :StringInquirer autoload :XmlMini end diff --git a/activesupport/lib/active_support/notifications/instrumenter.rb b/activesupport/lib/active_support/notifications/instrumenter.rb index 441fefb491..3941c285a2 100644 --- a/activesupport/lib/active_support/notifications/instrumenter.rb +++ b/activesupport/lib/active_support/notifications/instrumenter.rb @@ -1,4 +1,3 @@ -require 'active_support/secure_random' require 'active_support/core_ext/module/delegation' module ActiveSupport diff --git a/activesupport/lib/active_support/secure_random.rb b/activesupport/lib/active_support/secure_random.rb deleted file mode 100644 index 52f8c72b77..0000000000 --- a/activesupport/lib/active_support/secure_random.rb +++ /dev/null @@ -1,6 +0,0 @@ -require 'securerandom' - -module ActiveSupport - # Use Ruby's SecureRandom library. - SecureRandom = ::SecureRandom # :nodoc: -end diff --git a/activesupport/test/secure_random_test.rb b/activesupport/test/secure_random_test.rb deleted file mode 100644 index 799ac2a87b..0000000000 --- a/activesupport/test/secure_random_test.rb +++ /dev/null @@ -1,19 +0,0 @@ -require 'abstract_unit' - -class SecureRandomTest < Test::Unit::TestCase - def test_random_bytes - b1 = SecureRandom.random_bytes(64) - b2 = SecureRandom.random_bytes(64) - assert_not_equal b1, b2 - end - - def test_hex - b1 = SecureRandom.hex(64) - b2 = SecureRandom.hex(64) - assert_not_equal b1, b2 - end - - def test_random_number - assert SecureRandom.random_number(5000) < 5000 - end -end diff --git a/railties/lib/rails/generators/app_base.rb b/railties/lib/rails/generators/app_base.rb index 8512b1ca4a..caa9c1016c 100644 --- a/railties/lib/rails/generators/app_base.rb +++ b/railties/lib/rails/generators/app_base.rb @@ -1,5 +1,5 @@ require 'digest/md5' -require 'active_support/secure_random' +require 'securerandom' require 'active_support/core_ext/string/strip' require 'rails/version' unless defined?(Rails::VERSION) require 'rbconfig' diff --git a/railties/lib/rails/tasks/misc.rake b/railties/lib/rails/tasks/misc.rake index 53e479b924..833fcb6f72 100644 --- a/railties/lib/rails/tasks/misc.rake +++ b/railties/lib/rails/tasks/misc.rake @@ -9,7 +9,7 @@ end desc 'Generate a cryptographically secure secret key (this is typically used to generate a secret for cookie sessions).' task :secret do - require 'active_support/secure_random' + require 'securerandom' puts SecureRandom.hex(64) end |