-
Notifications
You must be signed in to change notification settings - Fork 20
/
init.rb
43 lines (33 loc) · 1.32 KB
/
init.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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'
Redmine::Scm::Base.add 'GitMirror'
Redmine::Plugin.register :redmine_git_mirror do
name 'Git Mirror'
author 'Sergey Linnik'
description 'Add ability to create readonly mirror of remote git repository'
version '0.8.0'
url 'https://github.com/linniksa/redmine_git_mirror'
author_url 'https://github.com/linniksa'
requires_redmine :version_or_higher => '3.3.0'
settings :default => RedmineGitMirror::Settings::DEFAULT, :partial => 'git_mirror/settings'
end
redmine_git_mirror_patches = proc do
require 'repositories_helper'
require 'redmine_git_mirror/patches/repositories_helper_patch'
def include(klass, patch)
klass.send(:include, patch) unless klass.included_modules.include?(patch)
end
include(RepositoriesHelper, RedmineGitMirror::Patches::RepositoriesHelperPatch)
end
# Patches to the Redmine core.
require 'dispatcher' unless Rails::VERSION::MAJOR >= 3
if Rails::VERSION::MAJOR >= 5
ActiveSupport::Reloader.to_prepare &redmine_git_mirror_patches
elsif Rails::VERSION::MAJOR >= 3
ActionDispatch::Callbacks.to_prepare &redmine_git_mirror_patches
else
Dispatcher.to_prepare &redmine_git_mirror_patches
end