From 66fa0566b4699133b0ed59cec8bccec131931579 Mon Sep 17 00:00:00 2001 From: Jens Kraemer Date: Fri, 8 Mar 2019 12:28:24 +0800 Subject: [PATCH] adds lib directory of plugins to eager_load_paths --- lib/redmine/plugin.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/redmine/plugin.rb b/lib/redmine/plugin.rb index 82bcde81f..da59cefcd 100644 --- a/lib/redmine/plugin.rb +++ b/lib/redmine/plugin.rb @@ -114,6 +114,13 @@ module Redmine Rails.application.config.autoload_paths += engine_cfg.autoload_paths ActiveSupport::Dependencies.autoload_paths += engine_cfg.eager_load_paths + engine_cfg.autoload_once_paths + engine_cfg.autoload_paths + # Adds the lib/ directory of the plugin to the auto / eagerload path + lib = File.expand_path(File.join(p.directory, 'lib')) + if File.directory?(lib) + ActiveSupport::Dependencies.autoload_paths += [lib] + Rails.application.config.eager_load_paths += [lib] if Rails.application.config.eager_load + end + # Defines plugin setting if present if p.settings Setting.define_plugin_setting p -- 2.11.0