forked from prmartinuk/redmine_impasse
-
Notifications
You must be signed in to change notification settings - Fork 4
/
init.rb
108 lines (90 loc) · 4.02 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
require 'redmine'
require 'impasse_projects_helper_patch'
if Rails::VERSION::MAJOR < 3
require 'dispatcher'
object_to_prepare = Dispatcher
else
object_to_prepare = Rails.configuration
end
object_to_prepare.to_prepare do
require_dependency 'impasse_hooks'
unless ProjectsHelper.included_modules.include? ImpasseProjectsHelperPatch
ProjectsHelper.send(:include, ImpasseProjectsHelperPatch)
end
unless VersionsController.included_modules.include? ImpasseVersionsControllerPatch
VersionsController.send(:include, ImpasseVersionsControllerPatch)
end
Project.class_eval do
has_and_belongs_to_many :test_case_custom_fields,
:class_name => 'Impasse::TestCaseCustomField',
:order => "#{CustomField.table_name}.position",
:join_table => "#{table_name_prefix}custom_fields_projects#{table_name_suffix}",
:foreign_key => 'project_id',
:association_foreign_key => 'custom_field_id'
has_and_belongs_to_many :test_suite_custom_fields,
:class_name => 'Impasse::TestSuiteCustomField',
:order => "#{CustomField.table_name}.position",
:join_table => "#{table_name_prefix}custom_fields_projects#{table_name_suffix}",
:foreign_key => 'project_id',
:association_foreign_key => 'custom_field_id'
has_and_belongs_to_many :test_plan_custom_fields,
:class_name => 'Impasse::TestPlanCustomField',
:order => "#{CustomField.table_name}.position",
:join_table => "#{table_name_prefix}custom_fields_projects#{table_name_suffix}",
:foreign_key => 'project_id',
:association_foreign_key => 'custom_field_id'
has_and_belongs_to_many :execution_custom_fields,
:class_name => 'Impasse::ExecutionCustomField',
:order => "#{CustomField.table_name}.position",
:join_table => "#{table_name_prefix}custom_fields_projects#{table_name_suffix}",
:foreign_key => 'project_id',
:association_foreign_key => 'custom_field_id'
end
Issue.class_eval do
has_many :requirement_issues,
:class_name => 'Impasse::RequirementIssue'
has_many :test_cases, :through => :requirement_issues,
:class_name => 'Impasse::TestCase'
end
end
Redmine::Plugin.register :redmine_impasse do
name 'Redmine Impasse plugin'
author 'kawasima'
description 'Test management tool integrated Redmine'
version File.read(File.dirname(__FILE__)+'/version.rdoc')
url 'http://unit8.net/redmine_impasse'
author_url 'http://unit8.net/'
requires_redmine :version_or_higher => '3.4.0'
settings :partial => 'redmine_impasse/setting'
project_module :impasse do
permission :view_testcases, {
'impasse_test_case' => [:index, :show, :list, :keywords],
'impasse_test_plans' => [:index, :show, :list, :tc_assign, :user_assign, :statistics, :autocomplete, :coverage],
'impasse_executions' => [:index, :get_list],
'impasse_requirement_issues' => [:index],
'impasse_screenshots' => [:show],
}
permission :manage_testcases, {
'impasse_test_case' => [:new, :edit, :destroy, :copy, :move, :copy_to_another_project, :screenshot],
'impasse_test_plans' => [:new, :edit, :destroy,:copy, :add_test_case, :remove_test_case, :coverage],
'impasse_executions' => [:new, :edit, :destroy, :put],
'impasse_execution_bugs' => [:new, :edit, :destroy, :upload_attachments],
'impasse_requirement_issues' => [:add_test_case, :remove_test_case, :traceability_report],
'impasse_screenshots' => [:new, :destroy],
}, :require => :member
permission :setting_testcases, {
'impasse_settings' => [:index, :show, :edit],
}, :require => :member
end
menu :project_menu, :impasse, { :controller => :impasse_test_case, :action => :index },
:caption => :label_impasse,
:param => :project_id
Redmine::MenuManager.map :impasse_admin_menu do |menu|
menu.push :custom_field, {:controller => 'impasse_custom_fields'}, :caption => :label_custom_field_plural,
:html => {:class => 'custom_fields'}
end
Mime::Type.register_alias "application/json", :json_impasse
end
Rails.configuration.to_prepare do
require 'impasse_issue_patch'
end