aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2007-12-15 02:27:56 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2007-12-15 02:27:56 +0000
commit70117b02949ccd724735aec8f4f19db4171e9e05 (patch)
tree1522beaa7347ddd7f42f81b3932b8e6b237fd8ff /railties
parent887870f20c347179aef0545ee2019c02ed9f74d1 (diff)
downloadrails-70117b02949ccd724735aec8f4f19db4171e9e05.tar.gz
rails-70117b02949ccd724735aec8f4f19db4171e9e05.tar.bz2
rails-70117b02949ccd724735aec8f4f19db4171e9e05.zip
Introduce (in /Users/jeremy/rails/git/trunk) to output a crytographically secure secret key for use with cookie sessions.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8400 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties')
-rw-r--r--railties/CHANGELOG2
-rw-r--r--railties/lib/tasks/misc.rake10
2 files changed, 11 insertions, 1 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG
index 06f56d3928..36d03fe2db 100644
--- a/railties/CHANGELOG
+++ b/railties/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Introduce `rake generate:secret` to output a crytographically secure secret key for use with cookie sessions. #xxxx [update from Trac]
+
* Fixed that local database creation should consider 127.0.0.1 local #9026 [parcelbrat]
* Fixed that functional tests generated for scaffolds should use fixture calls instead of hard-coded IDs #10435 [boone]
diff --git a/railties/lib/tasks/misc.rake b/railties/lib/tasks/misc.rake
index 02ba886061..d145db0934 100644
--- a/railties/lib/tasks/misc.rake
+++ b/railties/lib/tasks/misc.rake
@@ -1,4 +1,12 @@
task :default => :test
task :environment do
require(File.join(RAILS_ROOT, 'config', 'environment'))
-end \ No newline at end of file
+end
+
+require 'rails_generator/secret_key_generator'
+namespace :generate do
+ desc 'Generate a crytographically secure secret key. This is typically used to generate a secret for cookie sessions. Pass a unique identifier to the generator using ID="some unique identifier" for greater security.'
+ task :secret do
+ puts Rails::SecretKeyGenerator.new(ENV['ID']).generate_secret
+ end
+end