diff options
author | José Valim <jose.valim@gmail.com> | 2009-07-04 17:34:48 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2009-07-04 20:17:32 +0200 |
commit | 35925a8995e4b3522e4a4e4e52a3a18c9c1cee52 (patch) | |
tree | df14728fca2bd545e68b87113e837917bafb92e2 /railties/lib/generators/actions.rb | |
parent | 8ff214e0db31a6827b52f738c409d97d70b363d5 (diff) | |
download | rails-35925a8995e4b3522e4a4e4e52a3a18c9c1cee52.tar.gz rails-35925a8995e4b3522e4a4e4e52a3a18c9c1cee52.tar.bz2 rails-35925a8995e4b3522e4a4e4e52a3a18c9c1cee52.zip |
Ensure that rails templates methods are invoked with the proper extensions [#2531 status:resolved]
Diffstat (limited to 'railties/lib/generators/actions.rb')
-rw-r--r-- | railties/lib/generators/actions.rb | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/railties/lib/generators/actions.rb b/railties/lib/generators/actions.rb index 080d374a2f..b6a3eb95e4 100644 --- a/railties/lib/generators/actions.rb +++ b/railties/lib/generators/actions.rb @@ -78,7 +78,6 @@ module Rails # def environment(data=nil, options={}, &block) sentinel = "Rails::Initializer.run do |config|" - data = block.call if !data && block_given? in_root do @@ -214,9 +213,9 @@ module Rails # def rake(command, options={}) log :rake, command - env = options[:env] || 'development' - sudo = options[:sudo] ? 'sudo ' : '' - in_root { run("#{sudo}rake #{command} RAILS_ENV=#{env}", false) } + env = options[:env] || 'development' + sudo = options[:sudo] && RUBY_PLATFORM !~ /win32|mswin/ ? 'sudo ' : '' + in_root { run("#{sudo}#{extify(:rake)} #{command} RAILS_ENV=#{env}", false) } end # Just run the capify command in root @@ -227,7 +226,7 @@ module Rails # def capify! log :capify, "" - in_root { run('capify .', false) } + in_root { run("#{extify(:capify)} .", false) } end # Add Rails to /vendor/rails @@ -238,7 +237,7 @@ module Rails # def freeze!(args = {}) log :vendor, "rails" - in_root { run('rake rails:freeze:edge', false) } + in_root { run("#{extify(:rake)} rails:freeze:edge", false) } end # Make an entry in Rails routing file conifg/routes.rb @@ -269,6 +268,12 @@ module Rails end end + # Add the ruby command extension to the given name. + # + def extify(name) + "#{name}#{File.extname(Thor::Util.ruby_command)}" + end + end end end |