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
return nil
end
def save_entry_to_temp_file(path, identifier)
return nil
end
def with_leading_slash(path)
path ||= ''
(path[0,1]!="/") ? "/#{path}" : path
......@@ -183,34 +187,39 @@ module Redmine
self.class.logger
end
def shellout(cmd, &block)
self.class.shellout(cmd, &block)
def shellout(cmd, output_path=nil, &block)
self.class.shellout(cmd, output_path, &block)
end
def self.logger
RAILS_DEFAULT_LOGGER
end
def self.shellout(cmd, &block)
logger.debug "Shelling out: #{strip_credential(cmd)}" if logger && logger.debug?
if Rails.env == 'development'
# Capture stderr when running in dev environment
cmd = "#{cmd} 2>>#{RAILS_ROOT}/log/scm.stderr.log"
end
def self.process_cmd(cmd, output_path)
cmd = Rails.env == 'development' ? "#{cmd} 2>>#{RAILS_ROOT}/log/scm.stderr.log" : cmd
cmd = "#{cmd} >> #{output_path}" if output_path.present?
cmd
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
if RUBY_VERSION < '1.9'
mode = "r+"
else
mode = "r+:ASCII-8BIT"
end
result = nil
IO.popen(cmd, mode) do |io|
io.close_write
block.call(io) if block_given?
result = block.call(io) if block_given?
end
result
rescue Errno::ENOENT => e
msg = strip_credential(e.message)
# The command failed, log it and re-raise
logger.error("SCM command failed, make sure that your SCM binary (eg. svn) is in PATH (#{ENV['PATH']}): #{strip_credential(cmd)}\n with: #{msg}")
cmd = strip_credential(cmd)
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)
end
end
......
......@@ -12,7 +12,7 @@
# See doc/COPYRIGHT.rdoc for more details.
#++
require 'redmine/scm/adapters/abstract_adapter'
require_dependency 'redmine/scm/adapters/abstract_adapter'
module Redmine
module Scm
......
......@@ -12,7 +12,7 @@
# See doc/COPYRIGHT.rdoc for more details.
#++
require 'redmine/scm/adapters/abstract_adapter'
require_dependency 'redmine/scm/adapters/abstract_adapter'
module Redmine
module Scm
......
......@@ -12,7 +12,7 @@
# See doc/COPYRIGHT.rdoc for more details.
#++
require 'redmine/scm/adapters/abstract_adapter'
require_dependency 'redmine/scm/adapters/abstract_adapter'
require 'rexml/document'
module Redmine
......
......@@ -12,7 +12,7 @@
# See doc/COPYRIGHT.rdoc for more details.
#++
require 'redmine/scm/adapters/abstract_adapter'
require_dependency 'redmine/scm/adapters/abstract_adapter'
require 'find'
module Redmine
......
This diff is collapsed.
......@@ -12,7 +12,7 @@
# See doc/COPYRIGHT.rdoc for more details.
#++
require 'redmine/scm/adapters/abstract_adapter'
require_dependency 'redmine/scm/adapters/abstract_adapter'
require 'cgi'
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