-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinit.rb
More file actions
52 lines (43 loc) · 1.68 KB
/
Copy pathinit.rb
File metadata and controls
52 lines (43 loc) · 1.68 KB
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
# frozen_string_literal: true
require 'redmine'
require_relative 'lib/issue_details_hook_listener'
def check_env
ENV['GITHUB_WEBHOOK_SECRET'].present? ||
ENV['GITHUB_ACCESS_TOKEN'].present? ||
ENV['SEMAPHORE_WEBHOOK_SECRET'].present? ||
ENV['GITHUB_ORGANIZATION_NAME'].present?
end
# :nocov:
if !check_env && !Rails.env.test?
yaml_data = if Rails.root.join('plugins/gnosis/config/application.yml').exist?
YAML.safe_load(ERB.new(Rails.root.join('plugins/gnosis/config/application.yml').read).result)
else
Rails.logger.warn 'application.yml not found'
YAML.safe_load(ERB.new(Rails.root.join('plugins/gnosis/config/application.example.yml').read).result)
end
ENV.merge!(ActiveSupport::HashWithIndifferentAccess.new(yaml_data))
end
# :nocov:
raise 'GITHUB_ACCESS_TOKEN is not set' if ENV['GITHUB_ACCESS_TOKEN'].blank? && !Rails.env.test?
Redmine::Plugin.register :gnosis do
name 'Gnosis plugin'
author 'Anes Hodza'
description 'This Plugin allows you to see the status of issues in a project'
version '2.0.0'
url 'https://github.com/renuo/gnosis/'
author_url 'https://www.renuo.ch/'
settings default: { }, partial: 'settings/gnosis_settings'
project_module :gnosis do
permission :view_list, {}
permission :view_deployments, {
'gnosis/deployments': [:index]
}
end
project_module :gnosis do
permission :sync_pull_requests, {
'gnosis/sync': %i[sync_pull_requests]
}, require: :loggedin
end
menu :project_menu, :gnosis_deployments, { controller: 'gnosis/deployments', action: 'index' },
caption: :label_gnosis_deployments, after: :activity, param: :project_id
end