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

[chore] replaced ruby constants with config yaml

Eric Schubert8556d0de582f
diff --git a/modules/storages/app/common/storages/peripherals/nextcloud_connection_validator.rb b/modules/storages/app/common/storages/peripherals/nextcloud_connection_validator.rb
index 2e34ca09dc5..4bbc89c04ea 100644
--- a/modules/storages/app/common/storages/peripherals/nextcloud_connection_validator.rb
+++ b/modules/storages/app/common/storages/peripherals/nextcloud_connection_validator.rb
@@ -109,8 +109,9 @@ module Storages
def version_mismatch
return None() if query.failure?
- min_app_version = SemanticVersion.parse(NextcloudIntegration::MIN_APP_VERSION)
- min_group_folder_version = SemanticVersion.parse(NextcloudIntegration::MIN_GROUP_FOLDER_VERSION)
+ config = YAML.load_file(path_to_config).deep_stringify_keys!
+ min_app_version = SemanticVersion.parse(config.dig("dependencies", "integration_app", "min_version"))
+ min_group_folder_version = SemanticVersion.parse(config.dig("dependencies", "group_folders_app", "min_version"))
capabilities = query.result
fetched_app_version = capabilities.app_version
@@ -160,6 +161,10 @@ module Storages
end
def auth_strategy = StorageInteraction::AuthenticationStrategies::Noop.strategy
+
+ def path_to_config
+ Rails.root.join("modules/storages/config/nextcloud_dependencies.yml")
+ end
end
end
end
diff --git a/modules/storages/app/constants/storages/nextcloud_integration.rb b/modules/storages/app/constants/storages/nextcloud_integration.rb
deleted file mode 100644
index b564ab6ef00..00000000000
--- a/modules/storages/app/constants/storages/nextcloud_integration.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-# frozen_string_literal: true
-
-#-- copyright
-# OpenProject is an open source project management software.
-# Copyright (C) 2012-2024 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 Storages
- module NextcloudIntegration
- MIN_APP_VERSION = "2.6.3"
- MIN_GROUP_FOLDER_VERSION = "17.0.1"
- end
-end
diff --git a/modules/storages/config/nextcloud_dependencies.yml b/modules/storages/config/nextcloud_dependencies.yml
new file mode 100644
index 00000000000..e5f668be580
--- /dev/null
+++ b/modules/storages/config/nextcloud_dependencies.yml
@@ -0,0 +1,9 @@
+dependencies:
+ integration_app:
+ name: OpenProject Integration
+ url: https://apps.nextcloud.com/apps/integration_openproject
+ min_version: 2.6.3
+ group_folders_app:
+ name: Group folders
+ url: https://apps.nextcloud.com/apps/groupfolders
+ min_version: 14.0.9
diff --git a/modules/storages/spec/common/storages/peripherals/nextcloud_connection_validator_spec.rb b/modules/storages/spec/common/storages/peripherals/nextcloud_connection_validator_spec.rb
index 1f9259db9c5..aefe6bfae14 100644
--- a/modules/storages/spec/common/storages/peripherals/nextcloud_connection_validator_spec.rb
+++ b/modules/storages/spec/common/storages/peripherals/nextcloud_connection_validator_spec.rb
@@ -113,7 +113,7 @@ RSpec.describe Storages::Peripherals::NextcloudConnectionValidator do
end
context "with outdated group folder app" do
- let(:group_folder_version) { Storages::SemanticVersion.parse("16.0.1") }
+ let(:group_folder_version) { Storages::SemanticVersion.parse("11.0.1") }
it "returns a validation failure" do
expect(subject.type).to eq(:error)