git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4743 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
5ff1f6fdfa
commit
668b0c0e50
|
@ -31,16 +31,14 @@ module Redmine
|
||||||
end
|
end
|
||||||
|
|
||||||
def darcs_binary_version
|
def darcs_binary_version
|
||||||
cmd = "#{DARCS_BIN} --version"
|
darcsversion = darcs_binary_version_from_command_line
|
||||||
version = nil
|
if m = darcsversion.match(%r{\A(.*?)((\d+\.)+\d+)})
|
||||||
shellout(cmd) do |io|
|
m[2].scan(%r{\d+}).collect(&:to_i)
|
||||||
# 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
|
|
||||||
end
|
end
|
||||||
return nil if $? && $?.exitstatus != 0
|
end
|
||||||
version
|
|
||||||
|
def darcs_binary_version_from_command_line
|
||||||
|
shellout("#{DARCS_BIN} --version") { |io| io.read }.to_s
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,21 @@ begin
|
||||||
@adapter = Redmine::Scm::Adapters::DarcsAdapter.new(REPOSITORY_PATH)
|
@adapter = Redmine::Scm::Adapters::DarcsAdapter.new(REPOSITORY_PATH)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_darcsversion
|
||||||
|
to_test = { "1.0.9 (release)\n" => [1,0,9] ,
|
||||||
|
"2.2.0 (release)\n" => [2,2,0] }
|
||||||
|
to_test.each do |s, v|
|
||||||
|
test_darcsversion_for(s, v)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def test_darcsversion_for(darcsversion, version)
|
||||||
|
@adapter.class.expects(:darcs_binary_version_from_command_line).returns(darcsversion)
|
||||||
|
assert_equal version, @adapter.class.darcs_binary_version
|
||||||
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
puts "Darcs test repository NOT FOUND. Skipping unit tests !!!"
|
puts "Darcs test repository NOT FOUND. Skipping unit tests !!!"
|
||||||
def test_fake; assert true end
|
def test_fake; assert true end
|
||||||
|
|
Loading…
Reference in New Issue