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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Move bim_seeder module into bim
Oliver Güntherc121a2bec76b
diff --git a/modules/bim/app/aspects/seedifier.rb b/modules/bim/app/aspects/seedifier.rbnew file mode 100644index 00000000000..4df9803fda0--- /dev/null+++ b/modules/bim/app/aspects/seedifier.rb@@ -0,0 +1,117 @@+##+# This file contains code that helps extracting seed data from real OP instances.+# It is meant to be copy & pasted into the rails console of the the instance from which you want+# to extract the data from.++# It is very unstable code. However, it should never change the instance it runs in. However, use it with caution.++## Before using it, make sure that all subjects are unique:+# project_identifiers = %w(construction-project bcf-management seed-daten creating-bim-model)+# projects = Project.where(identifier: project_identifiers)+# all_wps = projects.map(&:work_packages).flatten+# all_wps.group_by(&:subject).select { |subject, members| members.size > 1 }.each { |subject, members| puts "#{subject}\t#{members.map(&:id).join("\t")}" }++module Bim+ class Seedifier+ attr_accessor :written_work_packages_ids, :project_identifiers, :projects, :base_date++ def initialize(project_identifiers)+ @project_identifiers = project_identifiers+ @written_work_packages_ids = []+ @projects = Project.where(identifier: @project_identifiers)++ all_work_packages = @projects.map { |project| project.work_packages.to_a }.flatten.sort_by(&:start_date)+ @base_date = all_work_packages.first.start_date.monday+ end++ def run+ @projects.each do |project|+ puts "=== PROJECT: #{project.identifier} ==="+ work_packages = project.work_packages.reject { |work_package| work_package.parent && work_package.parent.project.identifier == project.identifier }.sort_by(&:start_date)+ if work_packages.empty?+ puts "No work packages for project with identifier #{project.identifier}... skipping."+ next+ end++ puts work_packages.map { |work_package| seedify_work_package(work_package, project) }.compact.to_yaml+ end+ end++ def calc_start_offset(work_package)+ if work_package.start_date+ (work_package.start_date - @base_date).to_i+ else+ 0+ end+ end++ def calc_duration(work_package)+ if work_package.start_date && work_package.due_date+ (work_package.due_date - work_package.start_date).to_i+ end+ end++ def calc_status(work_package)+ prefix = ''+ if ["Resolved"].include?(work_package.status.name)+ prefix = 'seeders.bim.'+ end+ "#{prefix}default_status_#{calc_low_dash(work_package.status.name.downcase)}"+ end++ def calc_type(work_package)+ prefix = ''+ if ["Issue", "Clash", "Remark", "Request"].include?(work_package.type.name)+ prefix = 'seeders.bim.'+ end+ "#{prefix}default_type_#{calc_low_dash(work_package.type.name.downcase)}"+ end++ def calc_low_dash(name)+ name.tr(" ", "_")+ end++ ##+ # Create a hash that only hold those properties that we would like to copy and paste into a seeder YAML file.+ def seedify_work_package(work_package, project)+ # Don't seed a WP twice. And don't seed WPs of other projects.+ return nil if (@written_work_packages_ids.include?(work_package.id) || work_package.project_id != project.id)++ @written_work_packages_ids << work_package.id++ predecessors = work_package.follows.sort_by(&:start_date).map { |predecessor| { to: predecessor.subject, type: 'follows' } }++ children = work_package.children.sort_by(&:start_date).map { |child| seedify_work_package(child, project) }.compact++ assigned_to = work_package.assigned_to.try(:name)++ duration = calc_duration(work_package)++ seedified = {+ start: calc_start_offset(work_package)+ }++ if work_package.bcf_issue+ seedified[:bcf_issue_uuid] = work_package.bcf_issue.uuid+ else+ seedified[:subject] = work_package.subject+ seedified[:description] = work_package.description+ seedified[:status] = calc_status(work_package)+ seedified[:type] = calc_type(work_package)+ seedified[:estimated_hours] = work_package.estimated_hours if work_package.estimated_hours.present?+ seedified[:children] = children if children.any?+ end++ seedified[:assigned_to] = assigned_to if assigned_to.present?+ seedified[:duration] = duration if duration.present?+ seedified[:parent] = work_package.parent.subject if work_package.parent.present? && (work_package.bcf_issue || work_package.project_id != project.id)+ seedified[:relations] = predecessors if predecessors.any?++ seedified+ end+ end+end++# project_identifiers = ['demo-project']+project_identifiers = %w(construction-project bcf-management seed-daten creating-bim-model)+Seedifier.new(project_identifiers).run\ No newline at end of filediff --git a/modules/bim_seeder/app/assets/images/bim_seeder/logo_openproject_bim_big.png b/modules/bim/app/assets/images/bim/logo_openproject_bim_big.pngsimilarity index 100%rename from modules/bim_seeder/app/assets/images/bim_seeder/logo_openproject_bim_big.pngrename to modules/bim/app/assets/images/bim/logo_openproject_bim_big.pngdiff --git a/modules/bim_seeder/app/assets/images/bim_seeder/new_feature_teaser.jpg b/modules/bim/app/assets/images/bim/new_feature_teaser.jpgsimilarity index 100%rename from modules/bim_seeder/app/assets/images/bim_seeder/new_feature_teaser.jpgrename to modules/bim/app/assets/images/bim/new_feature_teaser.jpgdiff --git a/modules/bim_seeder/app/seeders/bim_seeder/basic_data/activity_seeder.rb b/modules/bim/app/seeders/bim/basic_data/activity_seeder.rbsimilarity index 98%rename from modules/bim_seeder/app/seeders/bim_seeder/basic_data/activity_seeder.rbrename to modules/bim/app/seeders/bim/basic_data/activity_seeder.rbindex 0e5a714f2d6..f7080d8c02c 100644--- a/modules/bim_seeder/app/seeders/bim_seeder/basic_data/activity_seeder.rb+++ b/modules/bim/app/seeders/bim/basic_data/activity_seeder.rb@@ -27,7 +27,7 @@## See docs/COPYRIGHT.rdoc for more details.#++-module BimSeeder+module Bimmodule BasicDataclass ActivitySeeder < ::BasicData::ActivitySeederdef datadiff --git a/modules/bim_seeder/app/seeders/bim_seeder/basic_data/custom_style_seeder.rb b/modules/bim/app/seeders/bim/basic_data/custom_style_seeder.rbsimilarity index 98%rename from modules/bim_seeder/app/seeders/bim_seeder/basic_data/custom_style_seeder.rbrename to modules/bim/app/seeders/bim/basic_data/custom_style_seeder.rbindex a146fe00fec..d6263af7b80 100644--- a/modules/bim_seeder/app/seeders/bim_seeder/basic_data/custom_style_seeder.rb+++ b/modules/bim/app/seeders/bim/basic_data/custom_style_seeder.rb@@ -27,7 +27,7 @@## See docs/COPYRIGHT.rdoc for more details.#++-module BimSeeder+module Bimmodule BasicDataclass CustomStyleSeeder < Seederdef seed_data!diff --git a/modules/bim_seeder/app/seeders/bim_seeder/basic_data/priority_seeder.rb b/modules/bim/app/seeders/bim/basic_data/priority_seeder.rbsimilarity index 99%rename from modules/bim_seeder/app/seeders/bim_seeder/basic_data/priority_seeder.rbrename to modules/bim/app/seeders/bim/basic_data/priority_seeder.rbindex 9e6b05a43a3..192c057f215 100644--- a/modules/bim_seeder/app/seeders/bim_seeder/basic_data/priority_seeder.rb+++ b/modules/bim/app/seeders/bim/basic_data/priority_seeder.rb@@ -26,7 +26,7 @@## See docs/COPYRIGHT.rdoc for more details.#++-module BimSeeder+module Bimmodule BasicDataclass PrioritySeeder < ::BasicData::PrioritySeederdef datadiff --git a/modules/bim_seeder/app/seeders/bim_seeder/basic_data/status_seeder.rb b/modules/bim/app/seeders/bim/basic_data/status_seeder.rbsimilarity index 99%rename from modules/bim_seeder/app/seeders/bim_seeder/basic_data/status_seeder.rbrename to modules/bim/app/seeders/bim/basic_data/status_seeder.rbindex 92d7755d4d7..014cc4a975c 100644--- a/modules/bim_seeder/app/seeders/bim_seeder/basic_data/status_seeder.rb+++ b/modules/bim/app/seeders/bim/basic_data/status_seeder.rb@@ -27,7 +27,7 @@## See docs/COPYRIGHT.rdoc for more details.#++-module BimSeeder+module Bimmodule BasicDataclass StatusSeeder < ::BasicData::StatusSeederdef datadiff --git a/modules/bim_seeder/app/seeders/bim_seeder/basic_data/type_seeder.rb b/modules/bim/app/seeders/bim/basic_data/type_seeder.rbsimilarity index 99%rename from modules/bim_seeder/app/seeders/bim_seeder/basic_data/type_seeder.rbrename to modules/bim/app/seeders/bim/basic_data/type_seeder.rbindex 6d2d6c82996..81a742dcf7a 100644--- a/modules/bim_seeder/app/seeders/bim_seeder/basic_data/type_seeder.rb+++ b/modules/bim/app/seeders/bim/basic_data/type_seeder.rb@@ -27,7 +27,7 @@## See docs/COPYRIGHT.rdoc for more details.#++-module BimSeeder+module Bimmodule BasicDataclass TypeSeeder < ::BasicData::TypeSeederdiff --git a/modules/bim_seeder/app/seeders/bim_seeder/basic_data/workflow_seeder.rb b/modules/bim/app/seeders/bim/basic_data/workflow_seeder.rbsimilarity index 96%rename from modules/bim_seeder/app/seeders/bim_seeder/basic_data/workflow_seeder.rbrename to modules/bim/app/seeders/bim/basic_data/workflow_seeder.rbindex 5804583465d..34045e3cb3b 100644--- a/modules/bim_seeder/app/seeders/bim_seeder/basic_data/workflow_seeder.rb+++ b/modules/bim/app/seeders/bim/basic_data/workflow_seeder.rb@@ -27,7 +27,7 @@## See docs/COPYRIGHT.rdoc for more details.#++-module BimSeeder+module Bimmodule BasicDataclass WorkflowSeeder < ::BasicData::WorkflowSeederdef workflows@@ -51,11 +51,11 @@ module BimSeederenddef type_seeder_class- ::BimSeeder::BasicData::TypeSeeder+ ::Bim::BasicData::TypeSeederenddef status_seeder_class- ::BimSeeder::BasicData::StatusSeeder+ ::Bim::BasicData::StatusSeederendendenddiff --git a/modules/bim_seeder/app/seeders/bim_seeder/basic_data_seeder.rb b/modules/bim/app/seeders/bim/basic_data_seeder.rbsimilarity index 87%rename from modules/bim_seeder/app/seeders/bim_seeder/basic_data_seeder.rbrename to modules/bim/app/seeders/bim/basic_data_seeder.rbindex 3587f9ef778..feef0aae974 100644--- a/modules/bim_seeder/app/seeders/bim_seeder/basic_data_seeder.rb+++ b/modules/bim/app/seeders/bim/basic_data_seeder.rb@@ -27,18 +27,18 @@## See docs/COPYRIGHT.rdoc for more details.#++-module BimSeeder+module Bimclass BasicDataSeeder < ::BasicDataSeederdef data_seeder_classes[::BasicData::BuiltinRolesSeeder,::BasicData::RoleSeeder,- ::BimSeeder::BasicData::ActivitySeeder,+ ::Bim::BasicData::ActivitySeeder,::BasicData::ColorSeeder,::BasicData::ColorSchemeSeeder,- ::BimSeeder::BasicData::CustomStyleSeeder,- ::BimSeeder::BasicData::WorkflowSeeder,- ::BimSeeder::BasicData::PrioritySeeder,+ ::Bim::BasicData::CustomStyleSeeder,+ ::Bim::BasicData::WorkflowSeeder,+ ::Bim::BasicData::PrioritySeeder,::BasicData::SettingSeeder]enddiff --git a/modules/bim_seeder/app/seeders/bim_seeder/demo_data/bcf_xml_seeder.rb b/modules/bim/app/seeders/bim/demo_data/bcf_xml_seeder.rbsimilarity index 99%rename from modules/bim_seeder/app/seeders/bim_seeder/demo_data/bcf_xml_seeder.rbrename to modules/bim/app/seeders/bim/demo_data/bcf_xml_seeder.rbindex 2247c1852e1..189a1e4b7a9 100644--- a/modules/bim_seeder/app/seeders/bim_seeder/demo_data/bcf_xml_seeder.rb+++ b/modules/bim/app/seeders/bim/demo_data/bcf_xml_seeder.rb@@ -27,7 +27,7 @@## See docs/COPYRIGHT.rdoc for more details.#++-module BimSeeder+module Bimmodule DemoDataclass BcfXmlSeeder < ::Seederattr_reader :project, :keydiff --git a/modules/bim_seeder/app/seeders/bim_seeder/demo_data/ifc_model_seeder.rb b/modules/bim/app/seeders/bim/demo_data/ifc_model_seeder.rbsimilarity index 99%rename from modules/bim_seeder/app/seeders/bim_seeder/demo_data/ifc_model_seeder.rbrename to modules/bim/app/seeders/bim/demo_data/ifc_model_seeder.rbindex 6d0a4533bc0..3a40e505979 100644--- a/modules/bim_seeder/app/seeders/bim_seeder/demo_data/ifc_model_seeder.rb+++ b/modules/bim/app/seeders/bim/demo_data/ifc_model_seeder.rb@@ -27,7 +27,7 @@## See docs/COPYRIGHT.rdoc for more details.#++-module BimSeeder+module Bimmodule DemoDataclass IfcModelSeeder < ::Seederattr_reader :project, :keydiff --git a/modules/bim_seeder/config/locales/en.seeders.bim.yml b/modules/bim/config/locales/en.seeders.bim.ymlsimilarity index 100%rename from modules/bim_seeder/config/locales/en.seeders.bim.ymlrename to modules/bim/config/locales/en.seeders.bim.ymldiff --git a/modules/bim_seeder/files/ifc_models/hospital_architecture/hospital_architecture.json b/modules/bim/files/ifc_models/hospital_architecture/hospital_architecture.jsonsimilarity index 100%rename from modules/bim_seeder/files/ifc_models/hospital_architecture/hospital_architecture.jsonrename to modules/bim/files/ifc_models/hospital_architecture/hospital_architecture.jsondiff --git a/modules/bim_seeder/files/ifc_models/hospital_architecture/hospital_architecture.xkt b/modules/bim/files/ifc_models/hospital_architecture/hospital_architecture.xktsimilarity index 100%rename from modules/bim_seeder/files/ifc_models/hospital_architecture/hospital_architecture.xktrename to modules/bim/files/ifc_models/hospital_architecture/hospital_architecture.xktdiff --git a/modules/bim_seeder/files/ifc_models/hospital_mechanical/hospital_mechanical.json b/modules/bim/files/ifc_models/hospital_mechanical/hospital_mechanical.jsonsimilarity index 100%rename from modules/bim_seeder/files/ifc_models/hospital_mechanical/hospital_mechanical.jsonrename to modules/bim/files/ifc_models/hospital_mechanical/hospital_mechanical.jsondiff --git a/modules/bim_seeder/files/ifc_models/hospital_mechanical/hospital_mechanical.xkt b/modules/bim/files/ifc_models/hospital_mechanical/hospital_mechanical.xktsimilarity index 100%rename from modules/bim_seeder/files/ifc_models/hospital_mechanical/hospital_mechanical.xktrename to modules/bim/files/ifc_models/hospital_mechanical/hospital_mechanical.xktdiff --git a/modules/bim_seeder/files/ifc_models/hospital_structural/hospital_structural.json b/modules/bim/files/ifc_models/hospital_structural/hospital_structural.jsonsimilarity index 100%rename from modules/bim_seeder/files/ifc_models/hospital_structural/hospital_structural.jsonrename to modules/bim/files/ifc_models/hospital_structural/hospital_structural.jsondiff --git a/modules/bim_seeder/files/ifc_models/hospital_structural/hospital_structural.xkt b/modules/bim/files/ifc_models/hospital_structural/hospital_structural.xktsimilarity index 100%rename from modules/bim_seeder/files/ifc_models/hospital_structural/hospital_structural.xktrename to modules/bim/files/ifc_models/hospital_structural/hospital_structural.xktdiff --git a/modules/bim_seeder/files/seed.bcfzip b/modules/bim/files/seed.bcfzipsimilarity index 100%rename from modules/bim_seeder/files/seed.bcfziprename to modules/bim/files/seed.bcfzipdiff --git a/modules/bim/lib/open_project/bim/engine.rb b/modules/bim/lib/open_project/bim/engine.rbindex be94e646702..d6d4847a7e6 100644--- a/modules/bim/lib/open_project/bim/engine.rb+++ b/modules/bim/lib/open_project/bim/engine.rb@@ -83,7 +83,7 @@ module OpenProject::Bimassets %w(bim/bcf.css bim/ifc_viewer/generic.css)- patches %i[WorkPackage Type Journal]+ patches %i[WorkPackage Type Journal RootSeeder]patch_with_namespace :BasicData, :SettingSeederpatch_with_namespace :BasicData, :RoleSeeder@@ -91,6 +91,11 @@ module OpenProject::Bimpatch_with_namespace :Journal, :AggregatedJournalpatch_with_namespace :API, :V3, :Activities, :ActivitiesSharedHelpers+ patch_with_namespace :DemoData, :QueryBuilder+ patch_with_namespace :DemoData, :ProjectSeeder+ patch_with_namespace :DemoData, :WorkPackageSeeder+ patch_with_namespace :DemoData, :WorkPackageBoardSeeder+extend_api_response(:v3, :work_packages, :work_package) doproperty :bcf,exec_context: :decorator,diff --git a/modules/bim_seeder/lib/open_project/bim_seeder/patches/design_patch.rb b/modules/bim/lib/open_project/bim/patches/design_patch.rbsimilarity index 90%rename from modules/bim_seeder/lib/open_project/bim_seeder/patches/design_patch.rbrename to modules/bim/lib/open_project/bim/patches/design_patch.rbindex 145c99fc596..97fa3bb6fff 100644--- a/modules/bim_seeder/lib/open_project/bim_seeder/patches/design_patch.rb+++ b/modules/bim/lib/open_project/bim/patches/design_patch.rb@@ -1,6 +1,6 @@require 'open_project/custom_styles/design'-module OpenProject::BimSeeder+module OpenProject::Bimmodule Patchesmodule DesignPatchDEFAULTS = OpenProject::Design::DEFAULTS.merge(@@ -23,4 +23,4 @@ module OpenProject::BimSeederendOpenProject::Design.send(:remove_const, 'DEFAULTS')-OpenProject::Design.const_set('DEFAULTS', OpenProject::BimSeeder::Patches::DesignPatch::DEFAULTS)+OpenProject::Design.const_set('DEFAULTS', OpenProject::Bim::Patches::DesignPatch::DEFAULTS)diff --git a/modules/bim_seeder/lib/open_project/bim_seeder/patches/project_seeder_patch.rb b/modules/bim/lib/open_project/bim/patches/project_seeder_patch.rbsimilarity index 60%rename from modules/bim_seeder/lib/open_project/bim_seeder/patches/project_seeder_patch.rbrename to modules/bim/lib/open_project/bim/patches/project_seeder_patch.rbindex a5fd05622e1..0d1521815e4 100644--- a/modules/bim_seeder/lib/open_project/bim_seeder/patches/project_seeder_patch.rb+++ b/modules/bim/lib/open_project/bim/patches/project_seeder_patch.rb@@ -1,4 +1,4 @@-module OpenProject::BimSeeder::Patches::ProjectSeederPatch+module OpenProject::Bim::Patches::ProjectSeederPatchdef self.included(base) # :nodoc:base.prepend InstanceMethodsend@@ -6,8 +6,8 @@ module OpenProject::BimSeeder::Patches::ProjectSeederPatchmodule InstanceMethodsdef project_data_seeders(project, key)[- ::BimSeeder::DemoData::BcfXmlSeeder.new(project, key),- ::BimSeeder::DemoData::IfcModelSeeder.new(project, key)+ ::Bim::DemoData::BcfXmlSeeder.new(project, key),+ ::Bim::DemoData::IfcModelSeeder.new(project, key)] + super(project, key)enddiff --git a/modules/bim_seeder/lib/open_project/bim_seeder/patches/query_builder_patch.rb b/modules/bim/lib/open_project/bim/patches/query_builder_patch.rbsimilarity index 96%rename from modules/bim_seeder/lib/open_project/bim_seeder/patches/query_builder_patch.rbrename to modules/bim/lib/open_project/bim/patches/query_builder_patch.rbindex fb88066ea7f..95ddb881514 100644--- a/modules/bim_seeder/lib/open_project/bim_seeder/patches/query_builder_patch.rb+++ b/modules/bim/lib/open_project/bim/patches/query_builder_patch.rb@@ -27,7 +27,7 @@## See docs/COPYRIGHT.rdoc for more details.-module OpenProject::BimSeeder::Patches::QueryBuilderPatch+module OpenProject::Bim::Patches::QueryBuilderPatchdef self.included(base) # :nodoc:base.prepend InstanceMethodsenddiff --git a/modules/bim_seeder/lib/open_project/bim_seeder/patches/root_seeder_patch.rb b/modules/bim/lib/open_project/bim/patches/root_seeder_patch.rbsimilarity index 58%rename from modules/bim_seeder/lib/open_project/bim_seeder/patches/root_seeder_patch.rbrename to modules/bim/lib/open_project/bim/patches/root_seeder_patch.rbindex 46d42bf1028..6802e6d6200 100644--- a/modules/bim_seeder/lib/open_project/bim_seeder/patches/root_seeder_patch.rb+++ b/modules/bim/lib/open_project/bim/patches/root_seeder_patch.rb@@ -1,11 +1,11 @@-module OpenProject::BimSeeder::Patches::RootSeederPatch+module OpenProject::Bim::Patches::RootSeederPatchdef self.included(base) # :nodoc:base.prepend InstanceMethodsendmodule InstanceMethodsdef seed_basic_data- ::BimSeeder::BasicDataSeeder.new.seed!+ ::Bim::BasicDataSeeder.new.seed!endendenddiff --git a/modules/bim_seeder/lib/open_project/bim_seeder/patches/work_package_board_seeder_patch.rb b/modules/bim/lib/open_project/bim/patches/work_package_board_seeder_patch.rbsimilarity index 96%rename from modules/bim_seeder/lib/open_project/bim_seeder/patches/work_package_board_seeder_patch.rbrename to modules/bim/lib/open_project/bim/patches/work_package_board_seeder_patch.rbindex f4ebce3a39c..59bbc12057b 100644--- a/modules/bim_seeder/lib/open_project/bim_seeder/patches/work_package_board_seeder_patch.rb+++ b/modules/bim/lib/open_project/bim/patches/work_package_board_seeder_patch.rb@@ -1,4 +1,4 @@-module OpenProject::BimSeeder::Patches::WorkPackageBoardSeederPatch+module OpenProject::Bim::Patches::WorkPackageBoardSeederPatchdef self.included(base) # :nodoc:base.prepend InstanceMethodsenddiff --git a/modules/bim_seeder/lib/open_project/bim_seeder/patches/work_package_seeder_patch.rb b/modules/bim/lib/open_project/bim/patches/work_package_seeder_patch.rbsimilarity index 95%rename from modules/bim_seeder/lib/open_project/bim_seeder/patches/work_package_seeder_patch.rbrename to modules/bim/lib/open_project/bim/patches/work_package_seeder_patch.rbindex e8551667966..6e2adb303df 100644--- a/modules/bim_seeder/lib/open_project/bim_seeder/patches/work_package_seeder_patch.rb+++ b/modules/bim/lib/open_project/bim/patches/work_package_seeder_patch.rb@@ -1,4 +1,4 @@-module OpenProject::BimSeeder::Patches::WorkPackageSeederPatch+module OpenProject::Bim::Patches::WorkPackageSeederPatchdef self.included(base) # :nodoc:base.prepend InstanceMethodsenddiff --git a/modules/bim_seeder/spec/seeders/demo_data_seeder_spec.rb b/modules/bim/spec/seeders/demo_data_seeder_spec.rbsimilarity index 97%rename from modules/bim_seeder/spec/seeders/demo_data_seeder_spec.rbrename to modules/bim/spec/seeders/demo_data_seeder_spec.rbindex 29e45752ff0..6a878f28e74 100644--- a/modules/bim_seeder/spec/seeders/demo_data_seeder_spec.rb+++ b/modules/bim/spec/seeders/demo_data_seeder_spec.rb@@ -50,7 +50,7 @@ describe 'seeds' dobegin# Avoid asynchronous DeliverWorkPackageCreatedJobDelayed::Worker.delay_jobs = false- expect { BimSeeder::BasicDataSeeder.new.seed! }.not_to raise_error+ expect { ::Bim::BasicDataSeeder.new.seed! }.not_to raise_errorexpect { AdminUserSeeder.new.seed! }.not_to raise_errorexpect { DemoDataSeeder.new.seed! }.not_to raise_errordiff --git a/modules/bim_seeder/CHANGELOG.md b/modules/bim_seeder/CHANGELOG.mddeleted file mode 100644index d42ecdd756e..00000000000--- a/modules/bim_seeder/CHANGELOG.md+++ /dev/null@@ -1,19 +0,0 @@-<!---- copyright-OpenProject Plugins Plugin--Copyright (C) 2013 - 2014 the OpenProject Foundation (OPF)--This program is free software; you can redistribute it and/or-modify it under the terms of the GNU General Public License version 3.--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 doc/COPYRIGHT.md for more details.--++-->--# Changelog--* `#29280` Create module for seeding BIM datadiff --git a/modules/bim_seeder/README.md b/modules/bim_seeder/README.mddeleted file mode 100644index fb80c7129b6..00000000000--- a/modules/bim_seeder/README.md+++ /dev/null@@ -1,7 +0,0 @@-# OpenProject Bim Seeder Plugin--Seeds basic data and demo projects for the OpenProject BIM edition.--## Issue Tracker--https://community.openproject.org/projects/bim-seeder/work_packagesdiff --git a/modules/bim_seeder/aspects/extract_seed_data.rb b/modules/bim_seeder/aspects/extract_seed_data.rbdeleted file mode 100644index 2eeba2f609d..00000000000--- a/modules/bim_seeder/aspects/extract_seed_data.rb+++ /dev/null@@ -1,115 +0,0 @@-##-# This file contains code that helps extracting seed data from real OP instances.-# It is meant to be copy & pasted into the rails console of the the instance from which you want-# to extract the data from.--# It is very unstable code. However, it should never change the instance it runs in. However, use it with caution.--## Before using it, make sure that all subjects are unique:-# project_identifiers = %w(construction-project bcf-management seed-daten creating-bim-model)-# projects = Project.where(identifier: project_identifiers)-# all_wps = projects.map(&:work_packages).flatten-# all_wps.group_by(&:subject).select { |subject, members| members.size > 1 }.each { |subject, members| puts "#{subject}\t#{members.map(&:id).join("\t")}" }--class Seedifier- attr_accessor :written_work_packages_ids, :project_identifiers, :projects, :base_date-- def initialize(project_identifiers)- @project_identifiers = project_identifiers- @written_work_packages_ids = []- @projects = Project.where(identifier: @project_identifiers)-- all_work_packages = @projects.map { |project| project.work_packages.to_a }.flatten.sort_by(&:start_date)- @base_date = all_work_packages.first.start_date.monday- end-- def run- @projects.each do |project|- puts "=== PROJECT: #{project.identifier} ==="- work_packages = project.work_packages.reject { |work_package| work_package.parent && work_package.parent.project.identifier == project.identifier }.sort_by(&:start_date)- if work_packages.empty?- puts "No work packages for project with identifier #{project.identifier}... skipping."- next- end-- puts work_packages.map { |work_package| seedify_work_package(work_package, project) }.compact.to_yaml- end- end-- def calc_start_offset(work_package)- if work_package.start_date- (work_package.start_date - @base_date).to_i- else- 0- end- end-- def calc_duration(work_package)- if work_package.start_date && work_package.due_date- (work_package.due_date - work_package.start_date).to_i- end- end-- def calc_status(work_package)- prefix = ''- if ["Resolved"].include?(work_package.status.name)- prefix = 'seeders.bim.'- end- "#{prefix}default_status_#{calc_low_dash(work_package.status.name.downcase)}"- end-- def calc_type(work_package)- prefix = ''- if ["Issue", "Clash", "Remark", "Request"].include?(work_package.type.name)- prefix = 'seeders.bim.'- end- "#{prefix}default_type_#{calc_low_dash(work_package.type.name.downcase)}"- end-- def calc_low_dash(name)- name.tr(" ", "_")- end-- ##- # Create a hash that only hold those properties that we would like to copy and paste into a seeder YAML file.- def seedify_work_package(work_package, project)- # Don't seed a WP twice. And don't seed WPs of other projects.- return nil if (@written_work_packages_ids.include?(work_package.id) || work_package.project_id != project.id)-- @written_work_packages_ids << work_package.id-- predecessors = work_package.follows.sort_by(&:start_date).map { |predecessor| { to: predecessor.subject, type: 'follows' } }-- children = work_package.children.sort_by(&:start_date).map { |child| seedify_work_package(child, project) }.compact-- assigned_to = work_package.assigned_to.try(:name)-- duration = calc_duration(work_package)-- seedified = {- start: calc_start_offset(work_package)- }-- if work_package.bcf_issue- seedified[:bcf_issue_uuid] = work_package.bcf_issue.uuid- else- seedified[:subject] = work_package.subject- seedified[:description] = work_package.description- seedified[:status] = calc_status(work_package)- seedified[:type] = calc_type(work_package)- seedified[:estimated_hours] = work_package.estimated_hours if work_package.estimated_hours.present?- seedified[:children] = children if children.any?- end-- seedified[:assigned_to] = assigned_to if assigned_to.present?- seedified[:duration] = duration if duration.present?- seedified[:parent] = work_package.parent.subject if work_package.parent.present? && (work_package.bcf_issue || work_package.project_id != project.id)- seedified[:relations] = predecessors if predecessors.any?-- seedified- end-end--# project_identifiers = ['demo-project']-project_identifiers = %w(construction-project bcf-management seed-daten creating-bim-model)-Seedifier.new(project_identifiers).run\ No newline at end of filediff --git a/modules/bim_seeder/bin/rails b/modules/bim_seeder/bin/railsdeleted file mode 100644index 3a757e143cd..00000000000--- a/modules/bim_seeder/bin/rails+++ /dev/null@@ -1,26 +0,0 @@-#!/usr/bin/env ruby-# This command will automatically be run when you run "rails" with Rails gems-# installed from the root of your application.--ENGINE_ROOT = File.expand_path('../..', __FILE__)-ENGINE_PATH = File.expand_path('../../lib/open_project/bim_seeder/engine', __FILE__)--# Set up gems listed in the Gemfile.-ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)-require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])--##-# This is not ideal but better than nothing.-if ENV['OPENPROJECT_ROOT']- # /Users/mkahl/dev/openproject/release/lib- path = Pathname(ENV["OPENPROJECT_ROOT"]).join("lib")- $LOAD_PATH.unshift(path.to_s)-else- puts- puts "Error: please define OPENPROJECT_ROOT pointing to your OpenProject core's root directory"- puts- Kernel.exit(1)-end--require 'rails/all'-require 'rails/engine/commands'diff --git a/modules/bim_seeder/config/locales/en.seeders.bim.yml.example b/modules/bim_seeder/config/locales/en.seeders.bim.yml.exampledeleted file mode 100644index 19ffe8a338b..00000000000--- a/modules/bim_seeder/config/locales/en.seeders.bim.yml.example+++ /dev/null@@ -1,43 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 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-2017 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 docs/COPYRIGHT.rdoc for more details.-#++-en:- seeders:- bim:- demo_data:- projects:- demo-project:- name: Demo project with special BIM features- identifier: demo-project- modules:- - work_package_tracking- - ifc_models- ifc_models:- - file: 'testModel'- name: 'My super cool Model'- default: true- bcf_xml_file: "seed.bcfzip"diff --git a/modules/bim_seeder/lib/open_project/bim_seeder.rb b/modules/bim_seeder/lib/open_project/bim_seeder.rbdeleted file mode 100644index 0bcf3c77425..00000000000--- a/modules/bim_seeder/lib/open_project/bim_seeder.rb+++ /dev/null@@ -1,9 +0,0 @@-module OpenProject- module BimSeeder- require "open_project/bim_seeder/engine"-- # The DesignPatch is not a typical method patch, as it replaces a constant and thus needs to be applied without the- # standard patch logic for plugins.- require "open_project/bim_seeder/patches/design_patch"- end-enddiff --git a/modules/bim_seeder/lib/open_project/bim_seeder/engine.rb b/modules/bim_seeder/lib/open_project/bim_seeder/engine.rbdeleted file mode 100644index 1b213796d68..00000000000--- a/modules/bim_seeder/lib/open_project/bim_seeder/engine.rb+++ /dev/null@@ -1,21 +0,0 @@-# Prevent load-order problems in case openproject-plugins is listed after a plugin in the Gemfile-# or not at all-require 'open_project/plugins'--module OpenProject::BimSeeder- class Engine < ::Rails::Engine- engine_name :bim_seeder-- include OpenProject::Plugins::ActsAsOpEngine-- register 'openproject-bim_seeder',- :author_url => 'https://openproject.org',- :requires_openproject => '>= 9.0.0'-- patches [:RootSeeder]- patch_with_namespace :DemoData, :QueryBuilder- patch_with_namespace :DemoData, :ProjectSeeder- patch_with_namespace :DemoData, :WorkPackageSeeder- patch_with_namespace :DemoData, :WorkPackageBoardSeeder- end-enddiff --git a/modules/bim_seeder/lib/openproject-bim_seeder.rb b/modules/bim_seeder/lib/openproject-bim_seeder.rbdeleted file mode 100644index 25615aae8f0..00000000000--- a/modules/bim_seeder/lib/openproject-bim_seeder.rb+++ /dev/null@@ -1 +0,0 @@-require 'open_project/bim_seeder'diff --git a/modules/bim_seeder/openproject-bim_seeder.gemspec b/modules/bim_seeder/openproject-bim_seeder.gemspecdeleted file mode 100644index 84fbf7ef84c..00000000000--- a/modules/bim_seeder/openproject-bim_seeder.gemspec+++ /dev/null@@ -1,20 +0,0 @@-# encoding: UTF-8-$:.push File.expand_path("../lib", __FILE__)-$:.push File.expand_path("../../lib", __dir__)---# Describe your gem and declare its dependencies:-Gem::Specification.new do |s|- s.name = "openproject-bim_seeder"-- s.authors = "OpenProject GmbH"- s.email = "[email protected]"- s.homepage = "https://community.openproject.org/projects/openproject-bim-seeder" # TODO check this URL- s.summary = 'OpenProject BIM Seeder'- s.license = "GPLv3"- s.version = "1.0.0"-- s.files = Dir["{app,lib,config}/**/*"] + %w(CHANGELOG.md README.md)-- s.add_dependency "openproject-bcf"-end