summaryrefslogtreecommitdiffstats
path: root/lib/redmine/scm
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-02-15 08:04:11 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-02-15 08:04:11 +0000
commit2afc8e8c952268540cda1058fca2cbac6234c546 (patch)
tree90f7341eb8641c03189a2eb18a358aa8ef18e0cb /lib/redmine/scm
parent50bbb97848dd09119f650d62544ccdbf1bdae933 (diff)
downloadredmine-2afc8e8c952268540cda1058fca2cbac6234c546.tar.gz
redmine-2afc8e8c952268540cda1058fca2cbac6234c546.zip
scm: cvs: add methods of getting cvs version and add unit lib test (#4273).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4832 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine/scm')
-rw-r--r--lib/redmine/scm/adapters/cvs_adapter.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/redmine/scm/adapters/cvs_adapter.rb b/lib/redmine/scm/adapters/cvs_adapter.rb
index c3d3bf726..676f5f7c9 100644
--- a/lib/redmine/scm/adapters/cvs_adapter.rb
+++ b/lib/redmine/scm/adapters/cvs_adapter.rb
@@ -33,6 +33,25 @@ module Redmine
def sq_bin
@@sq_bin ||= shell_quote(CVS_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)
+ 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
# Guidelines for the input: