From 9ff21d929b4aadb8847e7b87bfaadfd24cacaef4 Mon Sep 17 00:00:00 2001 From: 1redmine Date: Tue, 1 Jul 2025 13:55:13 +0200 Subject: [PATCH] Removal of unnnecessary files --- .github/workflows/rubyonrails.yml | 4 +- after_init.rb | 38 ------------------- init.rb | 10 ++++- .../attachments_controller_patch.rb | 1 - .../controllers/groups_controller_patch.rb | 1 - .../issue_relations_controller_patch.rb | 1 - .../controllers/issues_controller_patch.rb | 1 - .../controllers/members_controller_patch.rb | 1 - .../controllers/projects_controller_patch.rb | 1 - .../controllers/timelog_controller_patch.rb | 1 - .../controllers/users_controller_patch.rb | 1 - .../controllers/versions_controller_patch.rb | 1 - .../controllers/wiki_controller_patch.rb | 1 - .../patches/helpers/projects_helper_patch.rb | 8 +--- .../patches/models/attachment_patch.rb | 7 +--- .../patches/models/group_patch.rb | 6 +-- .../patches/models/issue_patch.rb | 6 +-- .../patches/models/issue_relation_patch.rb | 7 +--- .../patches/models/member_patch.rb | 6 +-- .../patches/models/project_patch.rb | 7 +--- .../patches/models/time_entry_patch.rb | 7 +--- .../patches/models/user_patch.rb | 6 +-- .../patches/models/version_patch.rb | 7 +--- .../patches/models/wiki_content_patch.rb | 7 +--- .../patches/models/wiki_page_patch.rb | 7 +--- 25 files changed, 23 insertions(+), 120 deletions(-) delete mode 100644 after_init.rb diff --git a/.github/workflows/rubyonrails.yml b/.github/workflows/rubyonrails.yml index af05097..e5adf8f 100644 --- a/.github/workflows/rubyonrails.yml +++ b/.github/workflows/rubyonrails.yml @@ -20,9 +20,9 @@ name: "GitHub CI" on: push: - branches: ["devel"] + branches: ["cleanup"] pull_request: - branches: ["devel"] + branches: ["cleanup"] jobs: plugin_tests: strategy: diff --git a/after_init.rb b/after_init.rb deleted file mode 100644 index 72ba5ff..0000000 --- a/after_init.rb +++ /dev/null @@ -1,38 +0,0 @@ -# frozen_string_literal: true - -# Redmine plugin for Custom Workflows -# -# Anton Argirov, Karel Pičman -# -# This file is part of Redmine OAuth plugin. -# -# Redmine Custom Workflows plugin 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 3 of the License, or (at your -# option) any later version. -# -# Redmine Custom Workflows plugin 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 Redmine Custom Workflows plugin. If not, -# see . - -require 'redmine' -require "#{File.dirname(__FILE__)}/lib/redmine_custom_workflows" - -def custom_workflows_init - # Administration menu extension - Redmine::MenuManager.map :admin_menu do |menu| - menu.push :custom_workflows, { controller: 'custom_workflows', action: 'index' }, - caption: :label_custom_workflow_plural, icon: 'workflows', - html: { class: 'icon icon-workflows workflows' } - end -end - -if Redmine::Plugin.installed?('easy_extensions') - ActiveSupport.on_load(:easyproject, yield: true) do - custom_workflows_init - end -else - custom_workflows_init -end diff --git a/init.rb b/init.rb index 23eb777..f1c4621 100644 --- a/init.rb +++ b/init.rb @@ -17,6 +17,9 @@ # You should have received a copy of the GNU General Public License along with Redmine Custom Workflows plugin. If not, # see . +require 'redmine' +require "#{File.dirname(__FILE__)}/lib/redmine_custom_workflows" + Redmine::Plugin.register :redmine_custom_workflows do name 'Redmine Custom Workflow plugin' url 'https://www.redmine.org/plugins/redmine_custom_workflows' @@ -30,4 +33,9 @@ Redmine::Plugin.register :redmine_custom_workflows do permission :manage_project_workflow, {}, require: :member end -require_relative 'after_init' unless Redmine::Plugin.installed?('easy_extensions') +# Administration menu extension +Redmine::MenuManager.map :admin_menu do |menu| + menu.push :custom_workflows, { controller: 'custom_workflows', action: 'index' }, + caption: :label_custom_workflow_plural, icon: 'workflows', + html: { class: 'icon icon-workflows workflows' } +end diff --git a/lib/redmine_custom_workflows/patches/controllers/attachments_controller_patch.rb b/lib/redmine_custom_workflows/patches/controllers/attachments_controller_patch.rb index db4bab6..1cd4b65 100644 --- a/lib/redmine_custom_workflows/patches/controllers/attachments_controller_patch.rb +++ b/lib/redmine_custom_workflows/patches/controllers/attachments_controller_patch.rb @@ -24,7 +24,6 @@ module RedmineCustomWorkflows module AttachmentsControllerPatch ################################################################################################################ # New methods - # def self.prepended(base) base.class_eval do diff --git a/lib/redmine_custom_workflows/patches/controllers/groups_controller_patch.rb b/lib/redmine_custom_workflows/patches/controllers/groups_controller_patch.rb index 8e4a911..0bbde98 100644 --- a/lib/redmine_custom_workflows/patches/controllers/groups_controller_patch.rb +++ b/lib/redmine_custom_workflows/patches/controllers/groups_controller_patch.rb @@ -24,7 +24,6 @@ module RedmineCustomWorkflows module GroupsControllerPatch ################################################################################################################ # New methods - # def self.prepended(base) base.class_eval do diff --git a/lib/redmine_custom_workflows/patches/controllers/issue_relations_controller_patch.rb b/lib/redmine_custom_workflows/patches/controllers/issue_relations_controller_patch.rb index fa75ef9..a0f2321 100644 --- a/lib/redmine_custom_workflows/patches/controllers/issue_relations_controller_patch.rb +++ b/lib/redmine_custom_workflows/patches/controllers/issue_relations_controller_patch.rb @@ -24,7 +24,6 @@ module RedmineCustomWorkflows module IssueRelationsControllerPatch ################################################################################################################ # New methods - # def self.prepended(base) base.class_eval do diff --git a/lib/redmine_custom_workflows/patches/controllers/issues_controller_patch.rb b/lib/redmine_custom_workflows/patches/controllers/issues_controller_patch.rb index ab520fc..343253b 100644 --- a/lib/redmine_custom_workflows/patches/controllers/issues_controller_patch.rb +++ b/lib/redmine_custom_workflows/patches/controllers/issues_controller_patch.rb @@ -24,7 +24,6 @@ module RedmineCustomWorkflows module IssuesControllerPatch ################################################################################################################ # New methods - # def self.prepended(base) base.class_eval do diff --git a/lib/redmine_custom_workflows/patches/controllers/members_controller_patch.rb b/lib/redmine_custom_workflows/patches/controllers/members_controller_patch.rb index 9e59cc3..7f17eb9 100644 --- a/lib/redmine_custom_workflows/patches/controllers/members_controller_patch.rb +++ b/lib/redmine_custom_workflows/patches/controllers/members_controller_patch.rb @@ -24,7 +24,6 @@ module RedmineCustomWorkflows module MembersControllerPatch ################################################################################################################ # New methods - # def self.prepended(base) base.class_eval do diff --git a/lib/redmine_custom_workflows/patches/controllers/projects_controller_patch.rb b/lib/redmine_custom_workflows/patches/controllers/projects_controller_patch.rb index eff7784..dbd8cb3 100644 --- a/lib/redmine_custom_workflows/patches/controllers/projects_controller_patch.rb +++ b/lib/redmine_custom_workflows/patches/controllers/projects_controller_patch.rb @@ -24,7 +24,6 @@ module RedmineCustomWorkflows module ProjectsControllerPatch ################################################################################################################ # New methods - # def self.prepended(base) base.class_eval do diff --git a/lib/redmine_custom_workflows/patches/controllers/timelog_controller_patch.rb b/lib/redmine_custom_workflows/patches/controllers/timelog_controller_patch.rb index 9ddfd2d..e4b8553 100644 --- a/lib/redmine_custom_workflows/patches/controllers/timelog_controller_patch.rb +++ b/lib/redmine_custom_workflows/patches/controllers/timelog_controller_patch.rb @@ -24,7 +24,6 @@ module RedmineCustomWorkflows module TimelogControllerPatch ################################################################################################################ # New methods - # def self.prepended(base) base.class_eval do diff --git a/lib/redmine_custom_workflows/patches/controllers/users_controller_patch.rb b/lib/redmine_custom_workflows/patches/controllers/users_controller_patch.rb index 41c691a..fcc10ea 100644 --- a/lib/redmine_custom_workflows/patches/controllers/users_controller_patch.rb +++ b/lib/redmine_custom_workflows/patches/controllers/users_controller_patch.rb @@ -24,7 +24,6 @@ module RedmineCustomWorkflows module UsersControllerPatch ################################################################################################################ # New methods - # def self.prepended(base) base.class_eval do diff --git a/lib/redmine_custom_workflows/patches/controllers/versions_controller_patch.rb b/lib/redmine_custom_workflows/patches/controllers/versions_controller_patch.rb index a66735c..5bbd479 100644 --- a/lib/redmine_custom_workflows/patches/controllers/versions_controller_patch.rb +++ b/lib/redmine_custom_workflows/patches/controllers/versions_controller_patch.rb @@ -24,7 +24,6 @@ module RedmineCustomWorkflows module VersionsControllerPatch ################################################################################################################ # New methods - # def self.prepended(base) base.class_eval do diff --git a/lib/redmine_custom_workflows/patches/controllers/wiki_controller_patch.rb b/lib/redmine_custom_workflows/patches/controllers/wiki_controller_patch.rb index 5bcff12..8f7713c 100644 --- a/lib/redmine_custom_workflows/patches/controllers/wiki_controller_patch.rb +++ b/lib/redmine_custom_workflows/patches/controllers/wiki_controller_patch.rb @@ -24,7 +24,6 @@ module RedmineCustomWorkflows module WikiControllerPatch ################################################################################################################ # New methods - # def self.prepended(base) base.class_eval do diff --git a/lib/redmine_custom_workflows/patches/helpers/projects_helper_patch.rb b/lib/redmine_custom_workflows/patches/helpers/projects_helper_patch.rb index 74e1ceb..db69d81 100644 --- a/lib/redmine_custom_workflows/patches/helpers/projects_helper_patch.rb +++ b/lib/redmine_custom_workflows/patches/helpers/projects_helper_patch.rb @@ -40,10 +40,4 @@ module RedmineCustomWorkflows end # Apply the patch -if Redmine::Plugin.installed?('easy_extensions') - RedmineExtensions::PatchManager.register_helper_patch 'ProjectsHelper', - 'RedmineCustomWorkflows::Patches::Helpers::ProjectsHelperPatch', - prepend: true -else - ProjectsController.send :helper, RedmineCustomWorkflows::Patches::Helpers::ProjectsHelperPatch -end +ProjectsController.send :helper, RedmineCustomWorkflows::Patches::Helpers::ProjectsHelperPatch diff --git a/lib/redmine_custom_workflows/patches/models/attachment_patch.rb b/lib/redmine_custom_workflows/patches/models/attachment_patch.rb index 03c2cc6..7636e78 100644 --- a/lib/redmine_custom_workflows/patches/models/attachment_patch.rb +++ b/lib/redmine_custom_workflows/patches/models/attachment_patch.rb @@ -69,9 +69,4 @@ module RedmineCustomWorkflows end # Apply the patch -if Redmine::Plugin.installed?('easy_extensions') - RedmineExtensions::PatchManager.register_model_patch 'Attachment', - 'RedmineCustomWorkflows::Patches::Models::AttachmentPatch' -else - Attachment.prepend RedmineCustomWorkflows::Patches::Models::AttachmentPatch -end +Attachment.prepend RedmineCustomWorkflows::Patches::Models::AttachmentPatch diff --git a/lib/redmine_custom_workflows/patches/models/group_patch.rb b/lib/redmine_custom_workflows/patches/models/group_patch.rb index e2a9739..82b6826 100644 --- a/lib/redmine_custom_workflows/patches/models/group_patch.rb +++ b/lib/redmine_custom_workflows/patches/models/group_patch.rb @@ -89,8 +89,4 @@ module RedmineCustomWorkflows end # Apply the patch -if Redmine::Plugin.installed?('easy_extensions') - RedmineExtensions::PatchManager.register_model_patch 'Group', 'RedmineCustomWorkflows::Patches::Models::GroupPatch' -else - Group.prepend RedmineCustomWorkflows::Patches::Models::GroupPatch -end +Group.prepend RedmineCustomWorkflows::Patches::Models::GroupPatch diff --git a/lib/redmine_custom_workflows/patches/models/issue_patch.rb b/lib/redmine_custom_workflows/patches/models/issue_patch.rb index 0e36820..5bd61bb 100644 --- a/lib/redmine_custom_workflows/patches/models/issue_patch.rb +++ b/lib/redmine_custom_workflows/patches/models/issue_patch.rb @@ -103,8 +103,4 @@ module RedmineCustomWorkflows end # Apply the patch -if Redmine::Plugin.installed?('easy_extensions') - RedmineExtensions::PatchManager.register_model_patch 'Issue', 'RedmineCustomWorkflows::Patches::Models::IssuePatch' -else - Issue.prepend RedmineCustomWorkflows::Patches::Models::IssuePatch -end +Issue.prepend RedmineCustomWorkflows::Patches::Models::IssuePatch diff --git a/lib/redmine_custom_workflows/patches/models/issue_relation_patch.rb b/lib/redmine_custom_workflows/patches/models/issue_relation_patch.rb index 7ac368a..b73739f 100644 --- a/lib/redmine_custom_workflows/patches/models/issue_relation_patch.rb +++ b/lib/redmine_custom_workflows/patches/models/issue_relation_patch.rb @@ -87,9 +87,4 @@ module RedmineCustomWorkflows end # Apply the patch -if Redmine::Plugin.installed?('easy_extensions') - RedmineExtensions::PatchManager.register_model_patch 'IssueRelation', - 'RedmineCustomWorkflows::Patches::Models::IssueRelationPatch' -else - IssueRelation.prepend RedmineCustomWorkflows::Patches::Models::IssueRelationPatch -end +IssueRelation.prepend RedmineCustomWorkflows::Patches::Models::IssueRelationPatch diff --git a/lib/redmine_custom_workflows/patches/models/member_patch.rb b/lib/redmine_custom_workflows/patches/models/member_patch.rb index f2decf4..598affd 100644 --- a/lib/redmine_custom_workflows/patches/models/member_patch.rb +++ b/lib/redmine_custom_workflows/patches/models/member_patch.rb @@ -69,8 +69,4 @@ module RedmineCustomWorkflows end # Apply the patch -if Redmine::Plugin.installed?('easy_extensions') - RedmineExtensions::PatchManager.register_model_patch 'Member', 'RedmineCustomWorkflows::Patches::Models::MemberPatch' -else - Member.prepend RedmineCustomWorkflows::Patches::Models::MemberPatch -end +Member.prepend RedmineCustomWorkflows::Patches::Models::MemberPatch diff --git a/lib/redmine_custom_workflows/patches/models/project_patch.rb b/lib/redmine_custom_workflows/patches/models/project_patch.rb index 744aea8..12ae4b1 100644 --- a/lib/redmine_custom_workflows/patches/models/project_patch.rb +++ b/lib/redmine_custom_workflows/patches/models/project_patch.rb @@ -97,9 +97,4 @@ module RedmineCustomWorkflows end # Apply the patch -if Redmine::Plugin.installed?('easy_extensions') - RedmineExtensions::PatchManager.register_model_patch 'Project', - 'RedmineCustomWorkflows::Patches::Models::ProjectPatch' -else - Project.prepend RedmineCustomWorkflows::Patches::Models::ProjectPatch -end +Project.prepend RedmineCustomWorkflows::Patches::Models::ProjectPatch diff --git a/lib/redmine_custom_workflows/patches/models/time_entry_patch.rb b/lib/redmine_custom_workflows/patches/models/time_entry_patch.rb index 057045c..22f150d 100644 --- a/lib/redmine_custom_workflows/patches/models/time_entry_patch.rb +++ b/lib/redmine_custom_workflows/patches/models/time_entry_patch.rb @@ -69,9 +69,4 @@ module RedmineCustomWorkflows end # Apply the patch -if Redmine::Plugin.installed?('easy_extensions') - RedmineExtensions::PatchManager.register_model_patch 'TimeEntry', - 'RedmineCustomWorkflows::Patches::Models::TimeEntryPatch' -else - TimeEntry.prepend RedmineCustomWorkflows::Patches::Models::TimeEntryPatch -end +TimeEntry.prepend RedmineCustomWorkflows::Patches::Models::TimeEntryPatch diff --git a/lib/redmine_custom_workflows/patches/models/user_patch.rb b/lib/redmine_custom_workflows/patches/models/user_patch.rb index fcb8331..475273b 100644 --- a/lib/redmine_custom_workflows/patches/models/user_patch.rb +++ b/lib/redmine_custom_workflows/patches/models/user_patch.rb @@ -69,8 +69,4 @@ module RedmineCustomWorkflows end # Apply the patch -if Redmine::Plugin.installed?('easy_extensions') - RedmineExtensions::PatchManager.register_model_patch 'User', 'RedmineCustomWorkflows::Patches::Models::UserPatch' -else - User.prepend RedmineCustomWorkflows::Patches::Models::UserPatch -end +User.prepend RedmineCustomWorkflows::Patches::Models::UserPatch diff --git a/lib/redmine_custom_workflows/patches/models/version_patch.rb b/lib/redmine_custom_workflows/patches/models/version_patch.rb index 6a215be..bfe091f 100644 --- a/lib/redmine_custom_workflows/patches/models/version_patch.rb +++ b/lib/redmine_custom_workflows/patches/models/version_patch.rb @@ -69,9 +69,4 @@ module RedmineCustomWorkflows end # Apply the patch -if Redmine::Plugin.installed?('easy_extensions') - RedmineExtensions::PatchManager.register_model_patch 'Version', - 'RedmineCustomWorkflows::Patches::Models::VersionPatch' -else - Version.prepend RedmineCustomWorkflows::Patches::Models::VersionPatch -end +Version.prepend RedmineCustomWorkflows::Patches::Models::VersionPatch diff --git a/lib/redmine_custom_workflows/patches/models/wiki_content_patch.rb b/lib/redmine_custom_workflows/patches/models/wiki_content_patch.rb index 89f5061..c4bc3d6 100644 --- a/lib/redmine_custom_workflows/patches/models/wiki_content_patch.rb +++ b/lib/redmine_custom_workflows/patches/models/wiki_content_patch.rb @@ -69,9 +69,4 @@ module RedmineCustomWorkflows end # Apply the patch -if Redmine::Plugin.installed?('easy_extensions') - RedmineExtensions::PatchManager.register_model_patch 'WikiContent', - 'RedmineCustomWorkflows::Patches::Models::WikiContentPatch' -else - WikiContent.prepend RedmineCustomWorkflows::Patches::Models::WikiContentPatch -end +WikiContent.prepend RedmineCustomWorkflows::Patches::Models::WikiContentPatch diff --git a/lib/redmine_custom_workflows/patches/models/wiki_page_patch.rb b/lib/redmine_custom_workflows/patches/models/wiki_page_patch.rb index 1431684..8d7921c 100644 --- a/lib/redmine_custom_workflows/patches/models/wiki_page_patch.rb +++ b/lib/redmine_custom_workflows/patches/models/wiki_page_patch.rb @@ -58,9 +58,4 @@ module RedmineCustomWorkflows end # Apply the patch -if Redmine::Plugin.installed?('easy_extensions') - RedmineExtensions::PatchManager.register_model_patch 'WikiPage', - 'RedmineCustomWorkflows::Patches::Models::WikiPagePatch' -else - WikiPage.prepend RedmineCustomWorkflows::Patches::Models::WikiPagePatch -end +WikiPage.prepend RedmineCustomWorkflows::Patches::Models::WikiPagePatch