diff options
author | Aditya Chadha <aditya@sublucid.com> | 2009-05-02 18:32:45 -0400 |
---|---|---|
committer | Aditya Chadha <aditya@sublucid.com> | 2009-05-02 18:32:45 -0400 |
commit | 7a17ad3f2b89baea94450af8e63a640ace570938 (patch) | |
tree | 89cd60c05d4a812b3c8636373a05689b1df5bf75 /railties/lib/tasks/misc.rake | |
parent | 5469a0be1a517a0c2d8ee553b704df4e6f7df306 (diff) | |
parent | 1b32f882091ed7744654f74238f3f3b1ba6701ae (diff) | |
download | rails-7a17ad3f2b89baea94450af8e63a640ace570938.tar.gz rails-7a17ad3f2b89baea94450af8e63a640ace570938.tar.bz2 rails-7a17ad3f2b89baea94450af8e63a640ace570938.zip |
Merge branch 'master' of git@github.com:lifo/docrails
Diffstat (limited to 'railties/lib/tasks/misc.rake')
-rw-r--r-- | railties/lib/tasks/misc.rake | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/railties/lib/tasks/misc.rake b/railties/lib/tasks/misc.rake index 9e6f96db5b..a2c338aa5b 100644 --- a/railties/lib/tasks/misc.rake +++ b/railties/lib/tasks/misc.rake @@ -12,10 +12,10 @@ end desc 'Generate a crytographically secure secret key. This is typically used to generate a secret for cookie sessions.' task :secret do + require 'active_support/secure_random' puts ActiveSupport::SecureRandom.hex(64) end -require 'active_support' namespace :time do namespace :zones do desc 'Displays names of all time zones recognized by the Rails TimeZone class, grouped by offset. Results can be filtered with optional OFFSET parameter, e.g., OFFSET=-6' @@ -30,6 +30,8 @@ namespace :time do desc 'Displays names of time zones recognized by the Rails TimeZone class with the same offset as the system local time' task :local do + require 'active_support' + require 'active_support/core/time' jan_offset = Time.now.beginning_of_year.utc_offset jul_offset = Time.now.beginning_of_year.change(:month => 7).utc_offset offset = jan_offset < jul_offset ? jan_offset : jul_offset @@ -38,6 +40,8 @@ namespace :time do # to find UTC -06:00 zones, OFFSET can be set to either -6, -6:00 or 21600 def build_time_zone_list(method, offset = ENV['OFFSET']) + require 'active_support' + require 'active_support/core/time' if offset offset = if offset.to_s.match(/(\+|-)?(\d+):(\d+)/) sign = $1 == '-' ? -1 : 1 |