forked from ivyl/redmine-gitolite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.rb
37 lines (31 loc) · 1.38 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
require 'redmine'
require_dependency 'principal'
require_dependency 'user'
require_dependency 'gitolite-redmine'
require_dependency 'gitolite/patches/repositories_controller_patch'
require_dependency 'gitolite/patches/repositories_helper_patch'
require_dependency 'gitolite/patches/git_adapter_patch'
Redmine::Plugin.register :redmine_gitolite do
name 'Redmine Gitolite plugin'
author 'Arkadiusz Hiler, Joshua Hogendorn, Jan Schulz-Hofen, Kah Seng Tay, Jakob Skjerning'
description 'Enables Redmine to manage gitolite repositorie.'
version '0.0.1'
settings :default => {
'gitoliteUrl' => 'gitolite@localhost:gitolite-admin.git',
'developerBaseUrls' => "[email protected]:%{name}.git",
'readOnlyBaseUrls' => 'http://example.com/git/%{name}',
'basePath' => '/home/redmine/repositories/',
},
:partial => 'redmine_gitolite'
end
# initialize hook
class GitolitePublicKeyHook < Redmine::Hook::ViewListener
render_on :view_my_account_contextual, :inline => "| <%= link_to(l(:label_public_keys), public_keys_path) %>"
end
class GitoliteProjectShowHook < Redmine::Hook::ViewListener
render_on :view_projects_show_left, :partial => 'redmine_gitolite'
end
# initialize association from user -> public keys
User.send(:has_many, :gitolite_public_keys, :dependent => :destroy)
# initialize observer
ActiveRecord::Base.observers = ActiveRecord::Base.observers << GitoliteObserver