summaryrefslogtreecommitdiffstats
path: root/lib/redmine
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2017-06-17 07:42:54 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2017-06-17 07:42:54 +0000
commit5744bfc2c6490f1e861c7c206fc698c8e5a7a7f1 (patch)
treec997ef7098191506dbcc2e8ffe0ffac23c7ab79e /lib/redmine
parentf9ed43ee1543cec6c50fe9a70254a04fe4c4b44a (diff)
downloadredmine-5744bfc2c6490f1e861c7c206fc698c8e5a7a7f1.tar.gz
redmine-5744bfc2c6490f1e861c7c206fc698c8e5a7a7f1.zip
Removes duplicate shell_quote method (#26149).
Patch by Jens Krämer. git-svn-id: http://svn.redmine.org/redmine/trunk@16667 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine')
-rw-r--r--lib/redmine/scm/adapters/abstract_adapter.rb23
-rw-r--r--lib/redmine/utils.rb11
2 files changed, 18 insertions, 16 deletions
diff --git a/lib/redmine/scm/adapters/abstract_adapter.rb b/lib/redmine/scm/adapters/abstract_adapter.rb
index 68fea1da4..ecebba501 100644
--- a/lib/redmine/scm/adapters/abstract_adapter.rb
+++ b/lib/redmine/scm/adapters/abstract_adapter.rb
@@ -22,21 +22,23 @@ module Redmine
module Scm
module Adapters
class AbstractAdapter #:nodoc:
+ include Redmine::Utils::Shell
# raised if scm command exited with error, e.g. unknown revision.
class ScmCommandAborted < ::Redmine::Scm::Adapters::CommandFailed; end
class << self
+
def client_command
""
end
+ def shell_quote(str)
+ Redmine::Utils::Shell.shell_quote str
+ end
+
def shell_quote_command
- if Redmine::Platform.mswin? && RUBY_PLATFORM == 'java'
- client_command
- else
- shell_quote(client_command)
- end
+ Redmine::Utils::Shell.shell_quote_command client_command
end
# Returns the version of the scm client
@@ -64,13 +66,6 @@ module Redmine
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,
@@ -180,10 +175,6 @@ module Redmine
(path[-1,1] == "/") ? path[0..-2] : path
end
- def shell_quote(str)
- self.class.shell_quote(str)
- end
-
private
def retrieve_root_url
info = self.info
diff --git a/lib/redmine/utils.rb b/lib/redmine/utils.rb
index 85d3a4b33..b99849978 100644
--- a/lib/redmine/utils.rb
+++ b/lib/redmine/utils.rb
@@ -64,6 +64,9 @@ module Redmine
end
module Shell
+
+ module_function
+
def shell_quote(str)
if Redmine::Platform.mswin?
'"' + str.gsub(/"/, '\\"') + '"'
@@ -71,6 +74,14 @@ module Redmine
"'" + str.gsub(/'/, "'\"'\"'") + "'"
end
end
+
+ def shell_quote_command(command)
+ if Redmine::Platform.mswin? && RUBY_PLATFORM == 'java'
+ command
+ else
+ shell_quote(command)
+ end
+ end
end
module DateCalculation