Merged r4743 from trunk.

scm: darcs: change io.gets to io.read and add darcs version unit test.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.1-stable@4746 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA
2011-01-23 04:02:41 +00:00
parent e47f1d5595
commit 9800469943
2 changed files with 22 additions and 9 deletions
+7 -9
View File
@@ -31,16 +31,14 @@ module Redmine
end
def darcs_binary_version
cmd = "#{DARCS_BIN} --version"
version = nil
shellout(cmd) do |io|
# Read darcs version in first returned line
if m = io.gets.match(%r{((\d+\.)+\d+)})
version = m[0].scan(%r{\d+}).collect(&:to_i)
end
darcsversion = darcs_binary_version_from_command_line
if m = darcsversion.match(%r{\A(.*?)((\d+\.)+\d+)})
m[2].scan(%r{\d+}).collect(&:to_i)
end
return nil if $? && $?.exitstatus != 0
version
end
def darcs_binary_version_from_command_line
shellout("#{DARCS_BIN} --version") { |io| io.read }.to_s
end
end