From 230793baf6f0da326062359a472f39083bd7f686 Mon Sep 17 00:00:00 2001 From: Stefan Hirche Date: Thu, 2 Feb 2023 15:44:24 +0100 Subject: [PATCH] update to Redmine 5 --- after_init.rb | 2 ++ app/models/repository/git_remote.rb | 1 - init.rb | 18 ++++++++++++------ 3 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 after_init.rb diff --git a/after_init.rb b/after_init.rb new file mode 100644 index 0000000..aabc347 --- /dev/null +++ b/after_init.rb @@ -0,0 +1,2 @@ +require 'redmine' +require File.dirname(__FILE__) + '/lib/redmine_git_remote' diff --git a/app/models/repository/git_remote.rb b/app/models/repository/git_remote.rb index 7d4f84e..c7aa2d9 100644 --- a/app/models/repository/git_remote.rb +++ b/app/models/repository/git_remote.rb @@ -2,7 +2,6 @@ require 'redmine/scm/adapters/git_adapter' require 'pathname' require 'fileutils' # require 'open3' -require_dependency 'redmine_git_remote/poor_mans_capture3' class Repository::GitRemote < Repository::Git diff --git a/init.rb b/init.rb index 8906267..3048421 100644 --- a/init.rb +++ b/init.rb @@ -1,5 +1,3 @@ -require 'redmine' -require_dependency "redmine_git_remote/repositories_helper_patch" Redmine::Scm::Base.add "GitRemote" @@ -9,8 +7,16 @@ Redmine::Plugin.register :redmine_git_remote do url 'https://github.com/dergachev/redmine_git_remote' description 'Automatically clone and fetch remote git repositories' version '0.0.2' - - settings :default => { - 'git_remote_repo_clone_path' => Pathname.new(__FILE__).join("../").realpath.to_s + "/repos", - }, :partial => 'settings/git_remote_settings' + + requires_redmine version_or_higher: '5.0.0' + + settings partial: 'settings/git_remote_settings', + default: { + 'git_remote_repo_clone_path' => Pathname.new(__FILE__).join("../").realpath.to_s + "/repos" + } + end + +unless Redmine::Plugin.installed?(:easy_extensions) + require_relative 'after_init' +end \ No newline at end of file