forked from rocket-rentals/redmine-gitosis
-
Notifications
You must be signed in to change notification settings - Fork 5
/
init.rb
executable file
·52 lines (45 loc) · 1.89 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
44
45
46
47
48
49
50
51
52
require 'redmine'
require_dependency 'principal'
require_dependency 'user'
require_dependency 'git_hosting'
require_dependency 'git_hosting/hooks/git_adapter_hooks'
require_dependency 'git_hosting/patches/projects_controller_patch'
require_dependency 'git_hosting/patches/repositories_controller_patch'
require_dependency 'git_hosting/patches/groups_controller_patch'
require_dependency 'git_hosting/patches/repositories_helper_patch'
require_dependency 'git_hosting/patches/repository_patch'
require_dependency 'git_hosting/patches/git_adapter_patch'
Redmine::Plugin.register :redmine_git_hosting do
name 'Redmine Git Hosting Plugin'
author 'Eric Bishop, Christian Käser, Zsolt Parragi, Yunsang Choi, Joshua Hogendorn, Jan Schulz-Hofen and others'
description 'Enables Redmine / ChiliProject to control hosting of git repositories'
version '0.3.0'
settings :default => {
'allProjectsUseGit' => 'false',
'gitServer' => 'localhost',
'httpServer' => 'localhost',
'gitUser' => 'git',
'gitoliteIdentityFile' => RAILS_ROOT + '/.ssh/gitolite_admin_id_rsa',
'gitRepositoryBasePath' => 'repositories/',
'deleteGitRepositories' => 'false',
'gitRepositoriesShowUrl' => 'true',
'loggingEnabled' => 'false',
'gitCacheMaxTime' => '-1',
'gitCacheMaxElements' => '100',
'gitCacheMaxSize' => '16',
'gitDebugPostUpdateHook' => 'false',
'gitPostUpdateHookCurlIgnore' => 'false',
},
:partial => 'redmine_git_hosting'
end
# initialize hooks
class GitProjectShowHook < Redmine::Hook::ViewListener
render_on :view_projects_show_left, :partial => 'git_urls'
end
class GitRepoUrlHook < Redmine::Hook::ViewListener
render_on :view_repositories_show_contextual, :partial => 'git_urls'
end
# initialize association from user -> public keys
User.send(:has_many, :gitolite_public_keys, :dependent => :destroy)
# initialize observer
ActiveRecord::Base.observers = ActiveRecord::Base.observers << GitHostingObserver