Sha256: f773d40e41bed3528fca529845e65a1b2205bc9636704f49a2732cb6b4122b7e

Contents?: true

Size: 773 Bytes

Versions: 4

Compression:

Stored size: 773 Bytes

Contents

# frozen_string_literal: true

require 'redmine/plugin'

module RedminePluginsHelper
  module Patches
    module Redmine
      module PluginMigrationContextPatch
        extend ActiveSupport::Concern

        def get_all_versions # rubocop:disable Naming/AccessorMethodName
          plugin.present? ? plugin.migrations : super
        end

        private

        def plugin
          @plugin ||= ::Redmine::Plugin.registered_plugins.values.find do |plugin|
            ::File.join(plugin.directory, 'db', 'migrate') == migrations_paths
          end
        end
      end
    end
  end
end

if Redmine::Plugin.const_defined?('MigrationContext')
  Redmine::Plugin::MigrationContext.prepend(
    RedminePluginsHelper::Patches::Redmine::PluginMigrationContextPatch
  )
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
redmine_plugins_helper-0.15.2 lib/redmine_plugins_helper/patches/redmine/plugin_migration_context.rb
redmine_plugins_helper-0.15.1 lib/redmine_plugins_helper/patches/redmine/plugin_migration_context.rb
redmine_plugins_helper-0.15.0 lib/redmine_plugins_helper/patches/redmine/plugin_migration_context.rb
redmine_plugins_helper-0.14.0 lib/redmine_plugins_helper/patches/redmine/plugin_migration_context.rb