Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Create life cycle and color seeders

Dombi Attilacfc6b0de6a7d
diff --git a/app/seeders/basic_data/life_cycle_seeder.rb b/app/seeders/basic_data/life_cycle_seeder.rb
new file mode 100644
index 00000000000..3baeec66a6f
--- /dev/null
+++ b/app/seeders/basic_data/life_cycle_seeder.rb
@@ -0,0 +1,46 @@
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+module BasicData
+ class LifeCycleSeeder < ModelSeeder
+ self.model_class = LifeCycle
+ self.seed_data_model_key = "life_cycles"
+ self.needs = [
+ BasicData::ColorSeeder,
+ BasicData::ColorSchemeSeeder
+ ]
+ self.attribute_names_for_lookups = %i[name type]
+
+ def model_attributes(life_cyle_data)
+ {
+ name: life_cyle_data["name"],
+ type: life_cyle_data["type"],
+ color_id: color_id(life_cyle_data["color_name"])
+ }
+ end
+ end
+end
diff --git a/app/seeders/common.yml b/app/seeders/common.yml
index bd7e4a71f8b..7a1906c505c 100644
--- a/app/seeders/common.yml
+++ b/app/seeders/common.yml
@@ -69,6 +69,18 @@ colors:
- reference: :default_color_black
t_name: Black
hexcode: "#000000"
+ - reference: :default_color_orange_dark
+ t_name: Orange (dark)
+ hexcode: "#F7983A"
+ - reference: :default_color_red_dark
+ t_name: Red (dark)
+ hexcode: "#F05823"
+ - reference: :default_color_magenta_light
+ t_name: Magenta (light)
+ hexcode: "#EC038A"
+ - reference: :default_color_green_yellow
+ t_name: Green Yellow
+ hexcode: "#B1D13A"
document_categories:
- t_name: Documentation
diff --git a/app/seeders/standard.yml b/app/seeders/standard.yml
index a177de92970..a48da27d720 100644
--- a/app/seeders/standard.yml
+++ b/app/seeders/standard.yml
@@ -26,6 +26,24 @@
# See COPYRIGHT and LICENSE files for more details.
#++
+life_cycles:
+ - reference: :default_life_cycle_initiating
+ t_name: Initiating
+ type: Stage
+ color_name: :default_color_orange_dark
+ - reference: :default_life_cycle_planning
+ t_name: Planning
+ type: Stage
+ color_name: :default_color_red_dark
+ - reference: :default_life_cycle_executing
+ t_name: Executing
+ type: Stage
+ color_name: :default_color_magenta_light
+ - reference: :default_life_cycle_closing
+ t_name: Closing
+ type: Gate
+ color_name: :default_color_green_yellow
+
priorities:
- reference: :default_priority_low
t_name: Low
diff --git a/app/seeders/standard/basic_data_seeder.rb b/app/seeders/standard/basic_data_seeder.rb
index 5c6c06c8ee2..5e03acd631a 100644
--- a/app/seeders/standard/basic_data_seeder.rb
+++ b/app/seeders/standard/basic_data_seeder.rb
@@ -37,6 +37,7 @@ module Standard
::BasicData::TimeEntryActivitySeeder,
::BasicData::ColorSeeder,
::BasicData::ColorSchemeSeeder,
+ ::BasicData::LifeCycleSeeder,
::BasicData::WorkflowSeeder,
::BasicData::PrioritySeeder,
::BasicData::SettingSeeder,
diff --git a/modules/bim/spec/seeders/root_seeder_bim_edition_spec.rb b/modules/bim/spec/seeders/root_seeder_bim_edition_spec.rb
index ab647887a86..1a9fe2e1391 100644
--- a/modules/bim/spec/seeders/root_seeder_bim_edition_spec.rb
+++ b/modules/bim/spec/seeders/root_seeder_bim_edition_spec.rb
@@ -98,7 +98,7 @@ RSpec.describe RootSeeder,
)
end
- include_examples "it creates records", model: Color, expected_count: 144
+ include_examples "it creates records", model: Color, expected_count: 148
include_examples "it creates records", model: DocumentCategory, expected_count: 3
include_examples "it creates records", model: IssuePriority, expected_count: 4
include_examples "it creates records", model: Status, expected_count: 4
diff --git a/spec/seeders/root_seeder_standard_edition_spec.rb b/spec/seeders/root_seeder_standard_edition_spec.rb
index 2d5f48c85d9..c86d87d6be3 100644
--- a/spec/seeders/root_seeder_standard_edition_spec.rb
+++ b/spec/seeders/root_seeder_standard_edition_spec.rb
@@ -124,7 +124,7 @@ RSpec.describe RootSeeder,
)
end
- include_examples "it creates records", model: Color, expected_count: 144
+ include_examples "it creates records", model: Color, expected_count: 148
include_examples "it creates records", model: DocumentCategory, expected_count: 3
include_examples "it creates records", model: GlobalRole, expected_count: 2
include_examples "it creates records", model: WorkPackageRole, expected_count: 3