forked from gartz/redmine_git_hosting
-
Notifications
You must be signed in to change notification settings - Fork 3
/
init.rb
executable file
·38 lines (32 loc) · 1.44 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
require 'redmine'
require_dependency 'principal'
require_dependency 'user'
require_dependency 'gitolite'
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 'Christian Käser, Zsolt Parragi, Yunsang Choi, Joshua Hogendorn, Jan Schulz-Hofen and others'
description 'Enables Redmine to update a gitolite server.'
version '0.1.0'
settings :default => {
'gitoliteUrl' => 'git@localhost:gitolite-admin.git',
'gitoliteIdentityFile' => '/path/to/admin/id_rsa',
'developerBaseUrls' => '[email protected]:,https://[user]@example.com/git/',
'readOnlyBaseUrls' => 'http://example.com/git/',
'basePath' => '/var/lib/gitolite/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