From 028d449fe9d727650ca47318d5e8615dfc7bc7a8 Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Thu, 27 Aug 2009 20:53:39 +0900 Subject: [PATCH] 1.9 compat: let -g option work with Ruby 1.9 [#3105 state:committed milestone:2.3.5] Signed-off-by: Jeremy Kemper --- railties/lib/rails_generator/options.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/railties/lib/rails_generator/options.rb b/railties/lib/rails_generator/options.rb index 5f6aefa92103a..c052891cc317f 100644 --- a/railties/lib/rails_generator/options.rb +++ b/railties/lib/rails_generator/options.rb @@ -137,10 +137,10 @@ def add_general_options!(opt) end end opt.on('-g', '--git', 'Modify files with git. (Note: git must be in path)') do - options[:git] = `git status`.inject({:new => {}, :modified => {}}) do |opt, e| - opt[:new][e.chomp[14..-1]] = true if e =~ /new file:/ - opt[:modified][e.chomp[14..-1]] = true if e =~ /modified:/ - opt + options[:git] = {:new => {}, :modified => {}} + `git status`.each_line do |line| + options[:git][:new][line.chomp[14..-1]] = true if line =~ /new file:/ + options[:git][:modified][line.chomp[14..-1]] = true if line =~ /modified:/ end end end