remove trailing white-spaces from lib/redmine/default_data/loader.rb.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6953 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
325f6a721a
commit
3d5eedffb2
|
@ -5,12 +5,12 @@
|
||||||
# modify it under the terms of the GNU General Public License
|
# modify it under the terms of the GNU General Public License
|
||||||
# as published by the Free Software Foundation; either version 2
|
# as published by the Free Software Foundation; either version 2
|
||||||
# of the License, or (at your option) any later version.
|
# of the License, or (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
@ -21,7 +21,7 @@ module Redmine
|
||||||
|
|
||||||
module Loader
|
module Loader
|
||||||
include Redmine::I18n
|
include Redmine::I18n
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
# Returns true if no data is already loaded in the database
|
# Returns true if no data is already loaded in the database
|
||||||
# otherwise false
|
# otherwise false
|
||||||
|
@ -31,24 +31,24 @@ module Redmine
|
||||||
!IssueStatus.find(:first) &&
|
!IssueStatus.find(:first) &&
|
||||||
!Enumeration.find(:first)
|
!Enumeration.find(:first)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Loads the default data
|
# Loads the default data
|
||||||
# Raises a RecordNotSaved exception if something goes wrong
|
# Raises a RecordNotSaved exception if something goes wrong
|
||||||
def load(lang=nil)
|
def load(lang=nil)
|
||||||
raise DataAlreadyLoaded.new("Some configuration data is already loaded.") unless no_data?
|
raise DataAlreadyLoaded.new("Some configuration data is already loaded.") unless no_data?
|
||||||
set_language_if_valid(lang)
|
set_language_if_valid(lang)
|
||||||
|
|
||||||
Role.transaction do
|
Role.transaction do
|
||||||
# Roles
|
# Roles
|
||||||
manager = Role.create! :name => l(:default_role_manager),
|
manager = Role.create! :name => l(:default_role_manager),
|
||||||
:issues_visibility => 'all',
|
:issues_visibility => 'all',
|
||||||
:position => 1
|
:position => 1
|
||||||
manager.permissions = manager.setable_permissions.collect {|p| p.name}
|
manager.permissions = manager.setable_permissions.collect {|p| p.name}
|
||||||
manager.save!
|
manager.save!
|
||||||
|
|
||||||
developer = Role.create! :name => l(:default_role_developer),
|
developer = Role.create! :name => l(:default_role_developer),
|
||||||
:position => 2,
|
:position => 2,
|
||||||
:permissions => [:manage_versions,
|
:permissions => [:manage_versions,
|
||||||
:manage_categories,
|
:manage_categories,
|
||||||
:view_issues,
|
:view_issues,
|
||||||
:add_issues,
|
:add_issues,
|
||||||
|
@ -74,7 +74,7 @@ module Redmine
|
||||||
:browse_repository,
|
:browse_repository,
|
||||||
:view_changesets,
|
:view_changesets,
|
||||||
:commit_access]
|
:commit_access]
|
||||||
|
|
||||||
reporter = Role.create! :name => l(:default_role_reporter),
|
reporter = Role.create! :name => l(:default_role_reporter),
|
||||||
:position => 3,
|
:position => 3,
|
||||||
:permissions => [:view_issues,
|
:permissions => [:view_issues,
|
||||||
|
@ -94,7 +94,7 @@ module Redmine
|
||||||
:view_files,
|
:view_files,
|
||||||
:browse_repository,
|
:browse_repository,
|
||||||
:view_changesets]
|
:view_changesets]
|
||||||
|
|
||||||
Role.non_member.update_attribute :permissions, [:view_issues,
|
Role.non_member.update_attribute :permissions, [:view_issues,
|
||||||
:add_issues,
|
:add_issues,
|
||||||
:add_issue_notes,
|
:add_issue_notes,
|
||||||
|
@ -110,7 +110,7 @@ module Redmine
|
||||||
:view_files,
|
:view_files,
|
||||||
:browse_repository,
|
:browse_repository,
|
||||||
:view_changesets]
|
:view_changesets]
|
||||||
|
|
||||||
Role.anonymous.update_attribute :permissions, [:view_issues,
|
Role.anonymous.update_attribute :permissions, [:view_issues,
|
||||||
:view_gantt,
|
:view_gantt,
|
||||||
:view_calendar,
|
:view_calendar,
|
||||||
|
@ -121,12 +121,12 @@ module Redmine
|
||||||
:view_files,
|
:view_files,
|
||||||
:browse_repository,
|
:browse_repository,
|
||||||
:view_changesets]
|
:view_changesets]
|
||||||
|
|
||||||
# Trackers
|
# Trackers
|
||||||
Tracker.create!(:name => l(:default_tracker_bug), :is_in_chlog => true, :is_in_roadmap => false, :position => 1)
|
Tracker.create!(:name => l(:default_tracker_bug), :is_in_chlog => true, :is_in_roadmap => false, :position => 1)
|
||||||
Tracker.create!(:name => l(:default_tracker_feature), :is_in_chlog => true, :is_in_roadmap => true, :position => 2)
|
Tracker.create!(:name => l(:default_tracker_feature), :is_in_chlog => true, :is_in_roadmap => true, :position => 2)
|
||||||
Tracker.create!(:name => l(:default_tracker_support), :is_in_chlog => false, :is_in_roadmap => false, :position => 3)
|
Tracker.create!(:name => l(:default_tracker_support), :is_in_chlog => false, :is_in_roadmap => false, :position => 3)
|
||||||
|
|
||||||
# Issue statuses
|
# Issue statuses
|
||||||
new = IssueStatus.create!(:name => l(:default_issue_status_new), :is_closed => false, :is_default => true, :position => 1)
|
new = IssueStatus.create!(:name => l(:default_issue_status_new), :is_closed => false, :is_default => true, :position => 1)
|
||||||
in_progress = IssueStatus.create!(:name => l(:default_issue_status_in_progress), :is_closed => false, :is_default => false, :position => 2)
|
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
|
||||||
feedback = IssueStatus.create!(:name => l(:default_issue_status_feedback), :is_closed => false, :is_default => false, :position => 4)
|
feedback = IssueStatus.create!(:name => l(:default_issue_status_feedback), :is_closed => false, :is_default => false, :position => 4)
|
||||||
closed = IssueStatus.create!(:name => l(:default_issue_status_closed), :is_closed => true, :is_default => false, :position => 5)
|
closed = IssueStatus.create!(:name => l(:default_issue_status_closed), :is_closed => true, :is_default => false, :position => 5)
|
||||||
rejected = IssueStatus.create!(:name => l(:default_issue_status_rejected), :is_closed => true, :is_default => false, :position => 6)
|
rejected = IssueStatus.create!(:name => l(:default_issue_status_rejected), :is_closed => true, :is_default => false, :position => 6)
|
||||||
|
|
||||||
# Workflow
|
# Workflow
|
||||||
Tracker.find(:all).each { |t|
|
Tracker.find(:all).each { |t|
|
||||||
IssueStatus.find(:all).each { |os|
|
IssueStatus.find(:all).each { |os|
|
||||||
IssueStatus.find(:all).each { |ns|
|
IssueStatus.find(:all).each { |ns|
|
||||||
Workflow.create!(:tracker_id => t.id, :role_id => manager.id, :old_status_id => os.id, :new_status_id => ns.id) unless os == ns
|
Workflow.create!(:tracker_id => t.id, :role_id => manager.id, :old_status_id => os.id, :new_status_id => ns.id) unless os == ns
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Tracker.find(:all).each { |t|
|
Tracker.find(:all).each { |t|
|
||||||
[new, in_progress, resolved, feedback].each { |os|
|
[new, in_progress, resolved, feedback].each { |os|
|
||||||
[in_progress, resolved, feedback, closed].each { |ns|
|
[in_progress, resolved, feedback, closed].each { |ns|
|
||||||
Workflow.create!(:tracker_id => t.id, :role_id => developer.id, :old_status_id => os.id, :new_status_id => ns.id) unless os == ns
|
Workflow.create!(:tracker_id => t.id, :role_id => developer.id, :old_status_id => os.id, :new_status_id => ns.id) unless os == ns
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Tracker.find(:all).each { |t|
|
Tracker.find(:all).each { |t|
|
||||||
[new, in_progress, resolved, feedback].each { |os|
|
[new, in_progress, resolved, feedback].each { |os|
|
||||||
[closed].each { |ns|
|
[closed].each { |ns|
|
||||||
Workflow.create!(:tracker_id => t.id, :role_id => reporter.id, :old_status_id => os.id, :new_status_id => ns.id) unless os == ns
|
Workflow.create!(:tracker_id => t.id, :role_id => reporter.id, :old_status_id => os.id, :new_status_id => ns.id) unless os == ns
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Workflow.create!(:tracker_id => t.id, :role_id => reporter.id, :old_status_id => resolved.id, :new_status_id => feedback.id)
|
Workflow.create!(:tracker_id => t.id, :role_id => reporter.id, :old_status_id => resolved.id, :new_status_id => feedback.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
# Enumerations
|
# Enumerations
|
||||||
DocumentCategory.create!(:name => l(:default_doc_category_user), :position => 1)
|
DocumentCategory.create!(:name => l(:default_doc_category_user), :position => 1)
|
||||||
DocumentCategory.create!(:name => l(:default_doc_category_tech), :position => 2)
|
DocumentCategory.create!(:name => l(:default_doc_category_tech), :position => 2)
|
||||||
|
|
||||||
IssuePriority.create!(:name => l(:default_priority_low), :position => 1)
|
IssuePriority.create!(:name => l(:default_priority_low), :position => 1)
|
||||||
IssuePriority.create!(:name => l(:default_priority_normal), :position => 2, :is_default => true)
|
IssuePriority.create!(:name => l(:default_priority_normal), :position => 2, :is_default => true)
|
||||||
IssuePriority.create!(:name => l(:default_priority_high), :position => 3)
|
IssuePriority.create!(:name => l(:default_priority_high), :position => 3)
|
||||||
IssuePriority.create!(:name => l(:default_priority_urgent), :position => 4)
|
IssuePriority.create!(:name => l(:default_priority_urgent), :position => 4)
|
||||||
IssuePriority.create!(:name => l(:default_priority_immediate), :position => 5)
|
IssuePriority.create!(:name => l(:default_priority_immediate), :position => 5)
|
||||||
|
|
||||||
TimeEntryActivity.create!(:name => l(:default_activity_design), :position => 1)
|
TimeEntryActivity.create!(:name => l(:default_activity_design), :position => 1)
|
||||||
TimeEntryActivity.create!(:name => l(:default_activity_development), :position => 2)
|
TimeEntryActivity.create!(:name => l(:default_activity_development), :position => 2)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue