@@ -5,12 +5,12 | |||||
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 |
# |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 |
# |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software |
|
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
@@ -21,7 +21,7 module Redmine | |||||
21 |
|
21 | |||
22 | module Loader |
|
22 | module Loader | |
23 | include Redmine::I18n |
|
23 | include Redmine::I18n | |
24 |
|
24 | |||
25 | class << self |
|
25 | class << self | |
26 | # Returns true if no data is already loaded in the database |
|
26 | # Returns true if no data is already loaded in the database | |
27 | # otherwise false |
|
27 | # otherwise false | |
@@ -31,24 +31,24 module Redmine | |||||
31 | !IssueStatus.find(:first) && |
|
31 | !IssueStatus.find(:first) && | |
32 | !Enumeration.find(:first) |
|
32 | !Enumeration.find(:first) | |
33 | end |
|
33 | end | |
34 |
|
34 | |||
35 | # Loads the default data |
|
35 | # Loads the default data | |
36 | # Raises a RecordNotSaved exception if something goes wrong |
|
36 | # Raises a RecordNotSaved exception if something goes wrong | |
37 | def load(lang=nil) |
|
37 | def load(lang=nil) | |
38 | raise DataAlreadyLoaded.new("Some configuration data is already loaded.") unless no_data? |
|
38 | raise DataAlreadyLoaded.new("Some configuration data is already loaded.") unless no_data? | |
39 | set_language_if_valid(lang) |
|
39 | set_language_if_valid(lang) | |
40 |
|
40 | |||
41 | Role.transaction do |
|
41 | Role.transaction do | |
42 | # Roles |
|
42 | # Roles | |
43 |
manager = Role.create! :name => l(:default_role_manager), |
|
43 | manager = Role.create! :name => l(:default_role_manager), | |
44 | :issues_visibility => 'all', |
|
44 | :issues_visibility => 'all', | |
45 | :position => 1 |
|
45 | :position => 1 | |
46 | manager.permissions = manager.setable_permissions.collect {|p| p.name} |
|
46 | manager.permissions = manager.setable_permissions.collect {|p| p.name} | |
47 | manager.save! |
|
47 | manager.save! | |
48 |
|
48 | |||
49 |
developer = Role.create! :name => l(:default_role_developer), |
|
49 | developer = Role.create! :name => l(:default_role_developer), | |
50 |
:position => 2, |
|
50 | :position => 2, | |
51 |
:permissions => [:manage_versions, |
|
51 | :permissions => [:manage_versions, | |
52 | :manage_categories, |
|
52 | :manage_categories, | |
53 | :view_issues, |
|
53 | :view_issues, | |
54 | :add_issues, |
|
54 | :add_issues, | |
@@ -74,7 +74,7 module Redmine | |||||
74 | :browse_repository, |
|
74 | :browse_repository, | |
75 | :view_changesets, |
|
75 | :view_changesets, | |
76 | :commit_access] |
|
76 | :commit_access] | |
77 |
|
77 | |||
78 | reporter = Role.create! :name => l(:default_role_reporter), |
|
78 | reporter = Role.create! :name => l(:default_role_reporter), | |
79 | :position => 3, |
|
79 | :position => 3, | |
80 | :permissions => [:view_issues, |
|
80 | :permissions => [:view_issues, | |
@@ -94,7 +94,7 module Redmine | |||||
94 | :view_files, |
|
94 | :view_files, | |
95 | :browse_repository, |
|
95 | :browse_repository, | |
96 | :view_changesets] |
|
96 | :view_changesets] | |
97 |
|
97 | |||
98 | Role.non_member.update_attribute :permissions, [:view_issues, |
|
98 | Role.non_member.update_attribute :permissions, [:view_issues, | |
99 | :add_issues, |
|
99 | :add_issues, | |
100 | :add_issue_notes, |
|
100 | :add_issue_notes, | |
@@ -110,7 +110,7 module Redmine | |||||
110 | :view_files, |
|
110 | :view_files, | |
111 | :browse_repository, |
|
111 | :browse_repository, | |
112 | :view_changesets] |
|
112 | :view_changesets] | |
113 |
|
113 | |||
114 | Role.anonymous.update_attribute :permissions, [:view_issues, |
|
114 | Role.anonymous.update_attribute :permissions, [:view_issues, | |
115 | :view_gantt, |
|
115 | :view_gantt, | |
116 | :view_calendar, |
|
116 | :view_calendar, | |
@@ -121,12 +121,12 module Redmine | |||||
121 | :view_files, |
|
121 | :view_files, | |
122 | :browse_repository, |
|
122 | :browse_repository, | |
123 | :view_changesets] |
|
123 | :view_changesets] | |
124 |
|
124 | |||
125 | # Trackers |
|
125 | # Trackers | |
126 | Tracker.create!(:name => l(:default_tracker_bug), :is_in_chlog => true, :is_in_roadmap => false, :position => 1) |
|
126 | Tracker.create!(:name => l(:default_tracker_bug), :is_in_chlog => true, :is_in_roadmap => false, :position => 1) | |
127 | Tracker.create!(:name => l(:default_tracker_feature), :is_in_chlog => true, :is_in_roadmap => true, :position => 2) |
|
127 | Tracker.create!(:name => l(:default_tracker_feature), :is_in_chlog => true, :is_in_roadmap => true, :position => 2) | |
128 | Tracker.create!(:name => l(:default_tracker_support), :is_in_chlog => false, :is_in_roadmap => false, :position => 3) |
|
128 | Tracker.create!(:name => l(:default_tracker_support), :is_in_chlog => false, :is_in_roadmap => false, :position => 3) | |
129 |
|
129 | |||
130 | # Issue statuses |
|
130 | # Issue statuses | |
131 | new = IssueStatus.create!(:name => l(:default_issue_status_new), :is_closed => false, :is_default => true, :position => 1) |
|
131 | new = IssueStatus.create!(:name => l(:default_issue_status_new), :is_closed => false, :is_default => true, :position => 1) | |
132 | in_progress = IssueStatus.create!(:name => l(:default_issue_status_in_progress), :is_closed => false, :is_default => false, :position => 2) |
|
132 | in_progress = IssueStatus.create!(:name => l(:default_issue_status_in_progress), :is_closed => false, :is_default => false, :position => 2) | |
@@ -134,43 +134,43 module Redmine | |||||
134 | feedback = IssueStatus.create!(:name => l(:default_issue_status_feedback), :is_closed => false, :is_default => false, :position => 4) |
|
134 | feedback = IssueStatus.create!(:name => l(:default_issue_status_feedback), :is_closed => false, :is_default => false, :position => 4) | |
135 | closed = IssueStatus.create!(:name => l(:default_issue_status_closed), :is_closed => true, :is_default => false, :position => 5) |
|
135 | closed = IssueStatus.create!(:name => l(:default_issue_status_closed), :is_closed => true, :is_default => false, :position => 5) | |
136 | rejected = IssueStatus.create!(:name => l(:default_issue_status_rejected), :is_closed => true, :is_default => false, :position => 6) |
|
136 | rejected = IssueStatus.create!(:name => l(:default_issue_status_rejected), :is_closed => true, :is_default => false, :position => 6) | |
137 |
|
137 | |||
138 | # Workflow |
|
138 | # Workflow | |
139 | Tracker.find(:all).each { |t| |
|
139 | Tracker.find(:all).each { |t| | |
140 | IssueStatus.find(:all).each { |os| |
|
140 | IssueStatus.find(:all).each { |os| | |
141 | IssueStatus.find(:all).each { |ns| |
|
141 | IssueStatus.find(:all).each { |ns| | |
142 | Workflow.create!(:tracker_id => t.id, :role_id => manager.id, :old_status_id => os.id, :new_status_id => ns.id) unless os == ns |
|
142 | Workflow.create!(:tracker_id => t.id, :role_id => manager.id, :old_status_id => os.id, :new_status_id => ns.id) unless os == ns | |
143 |
} |
|
143 | } | |
144 |
} |
|
144 | } | |
145 | } |
|
145 | } | |
146 |
|
146 | |||
147 | Tracker.find(:all).each { |t| |
|
147 | Tracker.find(:all).each { |t| | |
148 | [new, in_progress, resolved, feedback].each { |os| |
|
148 | [new, in_progress, resolved, feedback].each { |os| | |
149 | [in_progress, resolved, feedback, closed].each { |ns| |
|
149 | [in_progress, resolved, feedback, closed].each { |ns| | |
150 | Workflow.create!(:tracker_id => t.id, :role_id => developer.id, :old_status_id => os.id, :new_status_id => ns.id) unless os == ns |
|
150 | Workflow.create!(:tracker_id => t.id, :role_id => developer.id, :old_status_id => os.id, :new_status_id => ns.id) unless os == ns | |
151 |
} |
|
151 | } | |
152 |
} |
|
152 | } | |
153 | } |
|
153 | } | |
154 |
|
154 | |||
155 | Tracker.find(:all).each { |t| |
|
155 | Tracker.find(:all).each { |t| | |
156 | [new, in_progress, resolved, feedback].each { |os| |
|
156 | [new, in_progress, resolved, feedback].each { |os| | |
157 | [closed].each { |ns| |
|
157 | [closed].each { |ns| | |
158 | Workflow.create!(:tracker_id => t.id, :role_id => reporter.id, :old_status_id => os.id, :new_status_id => ns.id) unless os == ns |
|
158 | Workflow.create!(:tracker_id => t.id, :role_id => reporter.id, :old_status_id => os.id, :new_status_id => ns.id) unless os == ns | |
159 |
} |
|
159 | } | |
160 | } |
|
160 | } | |
161 | Workflow.create!(:tracker_id => t.id, :role_id => reporter.id, :old_status_id => resolved.id, :new_status_id => feedback.id) |
|
161 | Workflow.create!(:tracker_id => t.id, :role_id => reporter.id, :old_status_id => resolved.id, :new_status_id => feedback.id) | |
162 | } |
|
162 | } | |
163 |
|
163 | |||
164 | # Enumerations |
|
164 | # Enumerations | |
165 | DocumentCategory.create!(:name => l(:default_doc_category_user), :position => 1) |
|
165 | DocumentCategory.create!(:name => l(:default_doc_category_user), :position => 1) | |
166 | DocumentCategory.create!(:name => l(:default_doc_category_tech), :position => 2) |
|
166 | DocumentCategory.create!(:name => l(:default_doc_category_tech), :position => 2) | |
167 |
|
167 | |||
168 | IssuePriority.create!(:name => l(:default_priority_low), :position => 1) |
|
168 | IssuePriority.create!(:name => l(:default_priority_low), :position => 1) | |
169 | IssuePriority.create!(:name => l(:default_priority_normal), :position => 2, :is_default => true) |
|
169 | IssuePriority.create!(:name => l(:default_priority_normal), :position => 2, :is_default => true) | |
170 | IssuePriority.create!(:name => l(:default_priority_high), :position => 3) |
|
170 | IssuePriority.create!(:name => l(:default_priority_high), :position => 3) | |
171 | IssuePriority.create!(:name => l(:default_priority_urgent), :position => 4) |
|
171 | IssuePriority.create!(:name => l(:default_priority_urgent), :position => 4) | |
172 | IssuePriority.create!(:name => l(:default_priority_immediate), :position => 5) |
|
172 | IssuePriority.create!(:name => l(:default_priority_immediate), :position => 5) | |
173 |
|
173 | |||
174 | TimeEntryActivity.create!(:name => l(:default_activity_design), :position => 1) |
|
174 | TimeEntryActivity.create!(:name => l(:default_activity_design), :position => 1) | |
175 | TimeEntryActivity.create!(:name => l(:default_activity_development), :position => 2) |
|
175 | TimeEntryActivity.create!(:name => l(:default_activity_development), :position => 2) | |
176 | end |
|
176 | end |
General Comments 0
You need to be logged in to leave comments.
Login now