aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--railties/lib/rails_generator/generators/applications/app/template_runner.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/railties/lib/rails_generator/generators/applications/app/template_runner.rb b/railties/lib/rails_generator/generators/applications/app/template_runner.rb
index d9261ebe8f..3a4815c0dd 100644
--- a/railties/lib/rails_generator/generators/applications/app/template_runner.rb
+++ b/railties/lib/rails_generator/generators/applications/app/template_runner.rb
@@ -258,11 +258,14 @@ module Rails
# ==== Example
#
# rake("db:migrate")
- # rake("db:migrate", "production")
+ # rake("db:migrate", :env => "production")
+ # rake("gems:install", :sudo => true)
#
- def rake(command, env = 'development')
+ def rake(command, options = {})
puts "running rake task #{command}"
- in_root { `rake #{command} RAILS_ENV=#{env}` }
+ env = options[:env] || 'development'
+ sudo = options[:sudo] ? 'sudo ' : ''
+ in_root { `#{sudo}rake #{command} RAILS_ENV=#{env}` }
end
# Just run the capify command in root