Sha256: 13d931761c1f20773ba6b606d116b98a58eeea2a78f623f6267d41578c911b48

Contents?: true

Size: 771 Bytes

Versions: 3

Compression:

Stored size: 771 Bytes

Contents

# frozen_string_literal: true

require 'redmine/plugin'

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

        def get_all_versions
          plugin.present? ? plugin.migrations : super
        end

        private

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
redmine_plugins_helper-0.7.0 lib/redmine_plugins_helper/patches/redmine/plugin_migration_context.rb
redmine_plugins_helper-0.6.4 lib/redmine_plugins_helper/patches/redmine/plugin_migration_context.rb
redmine_plugins_helper-0.6.3 lib/redmine_plugins_helper/patches/redmine/plugin_migration_context.rb