forked from gugod/redmine-gollum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.rb
51 lines (40 loc) · 2.12 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
require 'redmine'
require 'debugger'
Rails.configuration.to_prepare do
require 'rugged' # deprecated 'grit'
require 'gollum'
require_dependency 'gollum_project_model_patch'
require_dependency 'gollum_projects_helper_patch'
require_dependency 'gollum_projects_controller_patch'
# project model should be patched before projects controller
Project.send(:include, GollumProjectModelPatch) unless Project.included_modules.include?(GollumProjectModelPatch)
ProjectsController.send(:include, GollumProjectsControllerPatch) unless ProjectsController.included_modules.include?(GollumProjectsControllerPatch)
ProjectsHelper.send(:include, GollumProjectsHelperPatch) unless ProjectsHelper.included_modules.include?(GollumProjectsHelperPatch)
end
Redmine::Plugin.register :redmine_gollum do
name 'Redmine Gollum plugin (fork)'
author 'Rob Jentzema (org.work Kang-min Liu)'
description 'A gollum plugin for redmine'
# use git to get version name
#repo = Grit::Repo.new("#{Rails.root}/plugins/redmine_gollum/.git")
repo = Rugged::Repository.new(File.join(Rails.root, "plugins", "redmine_gollum", ".git"))
# Wait for https://github.com/libgit2/rugged/pull/255
# Probably get a much nicer Reference::Tag collection in the API
# So we can get the proper version number from our git repo tag
version "alpha1"
url 'https://github.com/greenwellness/redmine-gollum/'
author_url 'http://gugod.org'
requires_redmine :version_or_higher => '2.0.2'
settings :default => {
:gollum_base_path => Pathname.new(Rails.root + "gollum")
},
:partial => 'shared/settings'
project_module :gollum do
permission :view_gollum_pages, :gollum => [:index, :show]
permission :add_gollum_pages, :gollum => [:new, :create]
permission :edit_gollum_pages, :gollum => [:edit, :update]
permission :delete_gollum_pages, :gollum => [:destroy]
permission :manage_gollum_wiki, :gollum_wikis => [:index,:show, :create, :update]
end
menu :project_menu, :gollum, { :controller => :gollum, :action => :index }, :caption => 'Gollum', :before => :wiki, :param => :project_id
end