scm: bazaar: add methods of getting bazaar version and add unit lib test (#4273).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4831 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -33,6 +33,25 @@ module Redmine
|
||||
def sq_bin
|
||||
@@sq_bin ||= shell_quote(BZR_BIN)
|
||||
end
|
||||
|
||||
def client_version
|
||||
@@client_version ||= (scm_command_version || [])
|
||||
end
|
||||
|
||||
def client_available
|
||||
!client_version.empty?
|
||||
end
|
||||
|
||||
def scm_command_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 repository
|
||||
|
||||
Reference in New Issue
Block a user