summaryrefslogtreecommitdiffstats
path: root/lib/redmine/scm/adapters/abstract_adapter.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/redmine/scm/adapters/abstract_adapter.rb')
-rw-r--r--lib/redmine/scm/adapters/abstract_adapter.rb32
1 files changed, 22 insertions, 10 deletions
diff --git a/lib/redmine/scm/adapters/abstract_adapter.rb b/lib/redmine/scm/adapters/abstract_adapter.rb
index f98e90958..3442276b1 100644
--- a/lib/redmine/scm/adapters/abstract_adapter.rb
+++ b/lib/redmine/scm/adapters/abstract_adapter.rb
@@ -25,6 +25,10 @@ module Redmine
class AbstractAdapter #:nodoc:
class << self
+ def client_command
+ ""
+ end
+
# Returns the version of the scm client
# Eg: [1, 5, 0] or [] if unknown
def client_version
@@ -45,8 +49,20 @@ module Redmine
def client_version_above?(v, options={})
((client_version <=> v) >= 0) || (client_version.empty? && options[:unknown])
end
+
+ def client_available
+ true
+ end
+
+ def shell_quote(str)
+ if Redmine::Platform.mswin?
+ '"' + str.gsub(/"/, '\\"') + '"'
+ else
+ "'" + str.gsub(/'/, "'\"'\"'") + "'"
+ end
+ end
end
-
+
def initialize(url, root_url=nil, login=nil, password=nil)
@url = url
@login = login if login && !login.empty?
@@ -138,7 +154,7 @@ module Redmine
path ||= ''
(path[-1,1] == "/") ? path : "#{path}/"
end
-
+
def without_leading_slash(path)
path ||= ''
path.gsub(%r{^/+}, '')
@@ -148,13 +164,9 @@ module Redmine
path ||= ''
(path[-1,1] == "/") ? path[0..-2] : path
end
-
+
def shell_quote(str)
- if Redmine::Platform.mswin?
- '"' + str.gsub(/"/, '\\"') + '"'
- else
- "'" + str.gsub(/'/, "'\"'\"'") + "'"
- end
+ self.class.shell_quote(str)
end
private
@@ -168,11 +180,11 @@ module Redmine
base = path.match(/^\//) ? root_url : url
shell_quote("#{base}/#{path}".gsub(/[?<>\*]/, ''))
end
-
+
def logger
self.class.logger
end
-
+
def shellout(cmd, &block)
self.class.shellout(cmd, &block)
end