Sha256: 32c491ab2934d860c9461cfdccd0579c1128844ca427e622d34478eefa43d21f
Contents?: true
Size: 1.47 KB
Versions: 2
Compression:
Stored size: 1.47 KB
Contents
# frozen_string_literal: true require 'eac_ruby_utils/core_ext' module RedminePluginsHelper module Patches module Redmine module PluginPatch extend ActiveSupport::Concern included do extend ClassMethods include InstanceMethods include ::RedminePluginsHelper::Patches::Redmine::PluginPatch::Assets prepend ::RedminePluginsHelper::Patches::Redmine::PluginPatch::Dependencies include ::RedminePluginsHelper::Patches::Redmine::PluginPatch::Initializers end module ClassMethods def by_path(path) plugin_id_from_path(path).if_present do |v| registered_plugins[v] end end def plugin_id_from_path(path) path = path.to_pathname.expand_path return nil unless path.to_path.start_with?(::Rails.root.to_path) parts = path.relative_path_from(::Rails.root).each_filename.to_a return nil unless parts.first == 'plugins' && parts.count >= 2 parts[1].to_sym end def post_register(plugin_name, &block) plugin = registered_plugins[plugin_name] raise "Plugin not registered: #{plugin_name}" unless plugin plugin.instance_eval(&block) end end end end end end patch = ::RedminePluginsHelper::Patches::Redmine::PluginPatch target = ::Redmine::Plugin target.send(:include, patch) unless target.include?(patch)
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
redmine_plugins_helper-0.13.1 | lib/redmine_plugins_helper/patches/redmine/plugin_patch.rb |
redmine_plugins_helper-0.13.0 | lib/redmine_plugins_helper/patches/redmine/plugin_patch.rb |