提交 e52affb2 编写于 作者: P Pratik Naik

Add :env and :sudo options to TemplateRunner#rake.

Examples :

  rake("gems:install", :sudo => true)
  rake("db:migrate", :env => "production")
上级 ef0b1cbb
......@@ -258,11 +258,14 @@ def run(command)
# ==== 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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册