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
adapt specs to implementation
ulferts690dc1a36e0d
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rbindex 462819cbcec..65107105c50 100644--- a/app/controllers/admin_controller.rb+++ b/app/controllers/admin_controller.rb@@ -129,8 +129,8 @@ class AdminController < ApplicationControllerenddef admin_information_hook_checks- call_hook(:admin_information_checklist).map do |result|+ call_hook(:admin_information_checklist).flat_map do |result|result- end.flatten(1)+ endendenddiff --git a/modules/ifc_models/app/services/ifc_models/view_converter_service.rb b/modules/ifc_models/app/services/ifc_models/view_converter_service.rbindex 51ca99ba161..9a5952efdca 100644--- a/modules/ifc_models/app/services/ifc_models/view_converter_service.rb+++ b/modules/ifc_models/app/services/ifc_models/view_converter_service.rb@@ -45,7 +45,7 @@ module IFCModelsenddef self.available_commands- @available ||= begin+ @available_commands ||= beginPIPELINE_COMMANDS.select do |command|_, status = Open3.capture2e('which', command)status.exitstatus.zero?@@ -68,21 +68,17 @@ module IFCModelsdef perform_conversion!(dir)# Step 1: IfcConvert- Rails.logger.debug { "Converting #{ifc_model.inspect} to DAE" }ifc_file = ifc_model.ifc_attachment.diskfile.pathcollada_file = convert_to_collada(ifc_file, dir)# Step 2: Collada2GLTF- Rails.logger.debug { "Converting #{ifc_model.inspect} to GLTF" }gltf_file = convert_to_gltf(collada_file, dir)# Step 3: Convert to XKT- Rails.logger.debug { "Converting #{ifc_model.inspect} to XKT" }xkt_file = convert_to_xkt(gltf_file, dir)ifc_model.xkt_attachment = File.new xkt_file# Convert metadata- Rails.logger.debug { "Retrieving metadata of #{ifc_model.inspect}" }metadata_file = convert_metadata(ifc_file, dir)ifc_model.metadata_attachment = File.new metadata_fileend@@ -94,6 +90,8 @@ module IFCModels# @param ifc_filepath {String} Path to the IFC model file# @param target_dir {String} Path to the temporary output folderdef convert_to_collada(ifc_filepath, target_dir)+ Rails.logger.debug { "Converting #{ifc_model.inspect} to DAE" }+convert!(ifc_filepath, target_dir, 'dae') do |target_file|Open3.capture2e('IfcConvert', '--use-element-guids', '--no-progress', '--verbose', ifc_filepath, target_file)end@@ -105,6 +103,8 @@ module IFCModels# @param dae_filepath {String} Path to the converted DAE model file# @param target_dir {String} Path to the temporary output folderdef convert_to_gltf(dae_filepath, target_dir)+ Rails.logger.debug { "Converting #{ifc_model.inspect} to GLTF" }+convert!(dae_filepath, target_dir, 'gltf') do |target_file|Open3.capture2e('COLLADA2GLTF', '-i', dae_filepath, '-o', target_file)end@@ -116,6 +116,8 @@ module IFCModels# @param gltf_filepath {String} Path to the converted GLTF model file# @param target_dir {String} Path to the temporary output folderdef convert_to_xkt(gltf_filepath, target_dir)+ Rails.logger.debug { "Converting #{ifc_model.inspect} to XKT" }+convert!(gltf_filepath, target_dir, 'xkt') do |target_file|Open3.capture2e('gltf2xkt', '-s', gltf_filepath, '-o', target_file)end@@ -127,6 +129,8 @@ module IFCModels# @param ifc_filepath {String} Path to the converted IFC model file# @param target_dir {String} Path to the temporary output folderdef convert_metadata(ifc_filepath, target_dir)+ Rails.logger.debug { "Retrieving metadata of #{ifc_model.inspect}" }+convert!(ifc_filepath, target_dir, 'json') do |target_file|Open3.capture2e('xeokit-metadata', ifc_filepath, target_file)enddiff --git a/modules/ifc_models/spec/models/ifc_model_spec.rb b/modules/ifc_models/spec/models/ifc_model_spec.rbindex ad6ac047e44..d24dfa033d2 100644--- a/modules/ifc_models/spec/models/ifc_model_spec.rb+++ b/modules/ifc_models/spec/models/ifc_model_spec.rb@@ -17,7 +17,7 @@ describe ::IFCModels::IFCModel, type: :model doenddescribe 'ifc_attachment=' do- subject { FactoryBot.create :ifc_model_converted }+ subject { FactoryBot.create :ifc_model_converted, project: FactoryBot.create(:project) }let(:ifc_attachment) { subject.ifc_attachment }let(:new_attachment) doFileHelpers.mock_uploaded_file name: "model.ifc", content_type: 'application/binary', binary: truediff --git a/modules/ifc_models/spec/services/ifc_models/view_conversion_service_spec.rb b/modules/ifc_models/spec/services/ifc_models/view_conversion_service_spec.rbindex 5b260ee4f45..540c8cb40ee 100644--- a/modules/ifc_models/spec/services/ifc_models/view_conversion_service_spec.rb+++ b/modules/ifc_models/spec/services/ifc_models/view_conversion_service_spec.rb@@ -4,6 +4,10 @@ describe IFCModels::ViewConverterService dolet(:model) { FactoryBot.build :ifc_model }subject { described_class.new(model) }+ before do+ described_class.instance_variable_set(:@available_commands, nil)+ end+shared_context 'available pipeline commands' do |available|before do# Mock the call to Open3 to test available commands@@ -24,6 +28,8 @@ describe IFCModels::ViewConverterService doenddescribe '#available_commands' do+ subject { described_class }+context 'with only one available command' doinclude_context 'available pipeline commands', %w[IfcConvert]@@ -46,7 +52,7 @@ describe IFCModels::ViewConverterService doinclude_context 'available pipeline commands', falseit 'returns an error' do- expect(subject).not_to be_available+ expect(described_class).not_to be_availableresult = subject.callexpect(result.errors[:base].first).to include 'The following IFC converter commands are missing'end@@ -54,7 +60,7 @@ describe IFCModels::ViewConverterService docontext 'if available' dobefore do- allow(subject).to receive(:available?).and_return true+ allow(described_class).to receive(:available?).and_return trueendit 'calls the conversion and returns save result' do