mirror of
https://github.com/redmine/redmine.git
synced 2026-03-05 20:11:36 +01:00
scm: subversion: refactor getting svn version and add lib test (#4273).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4825 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -38,19 +38,21 @@ module Redmine
|
||||
def client_version
|
||||
@@client_version ||= (svn_binary_version || [])
|
||||
end
|
||||
|
||||
def client_available
|
||||
!client_version.empty?
|
||||
end
|
||||
|
||||
def svn_binary_version
|
||||
cmd = "#{sq_bin} --version"
|
||||
version = nil
|
||||
shellout(cmd) do |io|
|
||||
# Read svn version in first returned line
|
||||
if m = io.read.to_s.match(%r{\A(.*?)((\d+\.)+\d+)})
|
||||
version = m[2].scan(%r{\d+}).collect(&:to_i)
|
||||
end
|
||||
end
|
||||
return nil if $? && $?.exitstatus != 0
|
||||
version
|
||||
scm_version = scm_version_from_command_line
|
||||
if m = scm_version.match(%r{\A(.*?)((\d+\.)+\d+)})
|
||||
m[2].scan(%r{\d+}).collect(&:to_i)
|
||||
end
|
||||
end
|
||||
|
||||
def scm_version_from_command_line
|
||||
shellout("#{sq_bin} --version") { |io| io.read }.to_s
|
||||
end
|
||||
end
|
||||
|
||||
# Get info about the svn repository
|
||||
|
||||
Reference in New Issue
Block a user