diff options
author | Rick Olson <technoweenie@gmail.com> | 2007-02-24 22:36:52 +0000 |
---|---|---|
committer | Rick Olson <technoweenie@gmail.com> | 2007-02-24 22:36:52 +0000 |
commit | ad9bacb189e82816bf333cdbae329f199a171c9f (patch) | |
tree | 2483b3974842ba9a6e3cece598f4be9971294015 /railties/lib/rails_generator/generators | |
parent | 08a533645eb2bb15aeb91528c3c01ea6fc742569 (diff) | |
download | rails-ad9bacb189e82816bf333cdbae329f199a171c9f.tar.gz rails-ad9bacb189e82816bf333cdbae329f199a171c9f.tar.bz2 rails-ad9bacb189e82816bf333cdbae329f199a171c9f.zip |
fix app generator
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6224 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/lib/rails_generator/generators')
-rw-r--r-- | railties/lib/rails_generator/generators/applications/app/app_generator.rb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/railties/lib/rails_generator/generators/applications/app/app_generator.rb b/railties/lib/rails_generator/generators/applications/app/app_generator.rb index 288e1cea84..06c4b0ce28 100644 --- a/railties/lib/rails_generator/generators/applications/app/app_generator.rb +++ b/railties/lib/rails_generator/generators/applications/app/app_generator.rb @@ -1,4 +1,5 @@ require 'rbconfig' +require 'digest/md5' class AppGenerator < Rails::Generator::Base DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'], @@ -22,6 +23,15 @@ class AppGenerator < Rails::Generator::Base script_options = { :chmod => 0755, :shebang => options[:shebang] == DEFAULT_SHEBANG ? nil : options[:shebang] } dispatcher_options = { :chmod => 0755, :shebang => options[:shebang] } + # duplicate CGI::Session#generate_unique_id + md5 = Digest::MD5.new + now = Time.now + md5 << now.to_s + md5 << String(now.usec) + md5 << String(rand(0)) + md5 << String($$) + md5 << @app_name + record do |m| # Root directory and all subdirectories. m.directory '' @@ -46,11 +56,11 @@ class AppGenerator < Rails::Generator::Base # Initializers m.template "configs/initializers/inflections.rb", "config/initializers/inflections.rb" - m.template "configs/initializers/mime_types.rb", "configs/initializers/mime_types.rb" + m.template "configs/initializers/mime_types.rb", "config/initializers/mime_types.rb" # Environments m.file "environments/boot.rb", "config/boot.rb" - m.template "environments/environment.rb", "config/environment.rb", :assigns => { :freeze => options[:freeze] } + m.template "environments/environment.rb", "config/environment.rb", :assigns => { :freeze => options[:freeze], :app_name => @app_name, :app_secret => md5.hexdigest } m.file "environments/production.rb", "config/environments/production.rb" m.file "environments/development.rb", "config/environments/development.rb" m.file "environments/test.rb", "config/environments/test.rb" |