Commit dd596d6d authored by Enrique García Cota's avatar Enrique García Cota

first release with git and svn

parent 59f92c97
...@@ -143,6 +143,10 @@ module Redmine ...@@ -143,6 +143,10 @@ module Redmine
return nil return nil
end end
def save_entry_to_temp_file(path, identifier)
return nil
end
def with_leading_slash(path) def with_leading_slash(path)
path ||= '' path ||= ''
(path[0,1]!="/") ? "/#{path}" : path (path[0,1]!="/") ? "/#{path}" : path
...@@ -183,34 +187,39 @@ module Redmine ...@@ -183,34 +187,39 @@ module Redmine
self.class.logger self.class.logger
end end
def shellout(cmd, &block) def shellout(cmd, output_path=nil, &block)
self.class.shellout(cmd, &block) self.class.shellout(cmd, output_path, &block)
end end
def self.logger def self.logger
RAILS_DEFAULT_LOGGER RAILS_DEFAULT_LOGGER
end end
def self.shellout(cmd, &block) def self.process_cmd(cmd, output_path)
logger.debug "Shelling out: #{strip_credential(cmd)}" if logger && logger.debug? cmd = Rails.env == 'development' ? "#{cmd} 2>>#{RAILS_ROOT}/log/scm.stderr.log" : cmd
if Rails.env == 'development' cmd = "#{cmd} >> #{output_path}" if output_path.present?
# Capture stderr when running in dev environment cmd
cmd = "#{cmd} 2>>#{RAILS_ROOT}/log/scm.stderr.log" end
end
def self.get_reading_mode_for_ruby_version
RUBY_VERSION < '1.9' ? 'r+' : 'r+:ASCII-8BIT'
end
def self.shellout(cmd, output_path=nil, &block)
logger.debug("Shelling out: #{strip_credential(cmd)}") if logger && logger.respond_to?(:debug)
cmd = process_cmd(cmd, output_path)
mode = get_reading_mode_for_ruby_version
begin begin
if RUBY_VERSION < '1.9' result = nil
mode = "r+"
else
mode = "r+:ASCII-8BIT"
end
IO.popen(cmd, mode) do |io| IO.popen(cmd, mode) do |io|
io.close_write io.close_write
block.call(io) if block_given? result = block.call(io) if block_given?
end end
result
rescue Errno::ENOENT => e rescue Errno::ENOENT => e
msg = strip_credential(e.message) msg = strip_credential(e.message)
# The command failed, log it and re-raise cmd = strip_credential(cmd)
logger.error("SCM command failed, make sure that your SCM binary (eg. svn) is in PATH (#{ENV['PATH']}): #{strip_credential(cmd)}\n with: #{msg}") logger.error("SCM command failed, make sure that your SCM binary (eg. svn) is in PATH (#{ENV['PATH']}): #{cmd}\n with: #{msg}")
raise CommandFailed.new(msg) raise CommandFailed.new(msg)
end end
end end
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
# See doc/COPYRIGHT.rdoc for more details. # See doc/COPYRIGHT.rdoc for more details.
#++ #++
require 'redmine/scm/adapters/abstract_adapter' require_dependency 'redmine/scm/adapters/abstract_adapter'
module Redmine module Redmine
module Scm module Scm
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
# See doc/COPYRIGHT.rdoc for more details. # See doc/COPYRIGHT.rdoc for more details.
#++ #++
require 'redmine/scm/adapters/abstract_adapter' require_dependency 'redmine/scm/adapters/abstract_adapter'
module Redmine module Redmine
module Scm module Scm
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
# See doc/COPYRIGHT.rdoc for more details. # See doc/COPYRIGHT.rdoc for more details.
#++ #++
require 'redmine/scm/adapters/abstract_adapter' require_dependency 'redmine/scm/adapters/abstract_adapter'
require 'rexml/document' require 'rexml/document'
module Redmine module Redmine
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
# See doc/COPYRIGHT.rdoc for more details. # See doc/COPYRIGHT.rdoc for more details.
#++ #++
require 'redmine/scm/adapters/abstract_adapter' require_dependency 'redmine/scm/adapters/abstract_adapter'
require 'find' require 'find'
module Redmine module Redmine
......
This diff is collapsed.
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
# See doc/COPYRIGHT.rdoc for more details. # See doc/COPYRIGHT.rdoc for more details.
#++ #++
require 'redmine/scm/adapters/abstract_adapter' require_dependency 'redmine/scm/adapters/abstract_adapter'
require 'cgi' require 'cgi'
module Redmine module Redmine
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment