From 7460e5a6bcd23d1c21ba3767e97b2798d0b5030b Mon Sep 17 00:00:00 2001 From: Felip Manyer i Ballester Date: Fri, 20 Jan 2023 20:56:20 +0100 Subject: [PATCH] Compatibility with Redmine 5 (#25) --- init.rb | 8 ++++---- lib/redmine_git_mirror/git.rb | 6 +++--- lib/redmine_git_mirror/ssh.rb | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/init.rb b/init.rb index be7e8aa..205e695 100644 --- a/init.rb +++ b/init.rb @@ -1,8 +1,8 @@ require 'redmine' -require_dependency 'redmine_git_mirror/git' -require_dependency 'redmine_git_mirror/ssh' -require_dependency 'redmine_git_mirror/url' -require_dependency 'redmine_git_mirror/settings' +require_dependency File.dirname(__FILE__) + '/lib/redmine_git_mirror/git' +require_dependency File.dirname(__FILE__) + '/lib/redmine_git_mirror/ssh' +require_dependency File.dirname(__FILE__) + '/lib/redmine_git_mirror/url' +require_dependency File.dirname(__FILE__) + '/lib/redmine_git_mirror/settings' Redmine::Scm::Base.add 'GitMirror' diff --git a/lib/redmine_git_mirror/git.rb b/lib/redmine_git_mirror/git.rb index 03d35c1..3a99f27 100644 --- a/lib/redmine_git_mirror/git.rb +++ b/lib/redmine_git_mirror/git.rb @@ -7,7 +7,7 @@ class << self def check_remote_url(url) url = RedmineGitMirror::URL.parse(url) - RedmineGitMirror::SSH.ensure_host_known(url.host) if url.uses_ssh? + RedmineGitMirror::Ssh.ensure_host_known(url.host) if url.uses_ssh? _, e = git 'ls-remote', '-h', url.to_s, 'master' e @@ -34,7 +34,7 @@ def prune(path) def init(clone_path, url) url = RedmineGitMirror::URL.parse(url) - RedmineGitMirror::SSH.ensure_host_known(url.host) if url.uses_ssh? + RedmineGitMirror::Ssh.ensure_host_known(url.host) if url.uses_ssh? if Dir.exists? clone_path o, e = get_remote_url(clone_path) @@ -102,7 +102,7 @@ def set_remote_url(clone_path, url) private def git(*cmd) s, e, status = Open3.capture3({ - 'GIT_SSH_COMMAND' => RedmineGitMirror::SSH.command.to_s + 'GIT_SSH_COMMAND' => RedmineGitMirror::Ssh.command.to_s }, GIT_BIN, *cmd) s.to_s.strip! diff --git a/lib/redmine_git_mirror/ssh.rb b/lib/redmine_git_mirror/ssh.rb index 8c2939d..b8085cc 100644 --- a/lib/redmine_git_mirror/ssh.rb +++ b/lib/redmine_git_mirror/ssh.rb @@ -1,6 +1,6 @@ module RedmineGitMirror - module SSH + module Ssh class << self def ensure_host_known(host) return unless host