Class: Redmine::PluginLoader
- Inherits:
-
Object
- Object
- Redmine::PluginLoader
- Defined in:
- lib/redmine/plugin_loader.rb
Class Method Summary collapse
Class Method Details
.add_autoload_paths ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/redmine/plugin_loader.rb', line 77 def self.add_autoload_paths directories.each do |directory| # Add the plugin directories to rails autoload paths engine_cfg = Rails::Engine::Configuration.new(directory.to_s) engine_cfg.paths.add 'lib', eager_load: true engine_cfg.all_eager_load_paths.each do |dir| Rails.autoloaders.main.push_dir dir Rails.application.config.watchable_dirs[dir] = [:rb] end end end |
.directories ⇒ Object
89 90 91 |
# File 'lib/redmine/plugin_loader.rb', line 89 def self.directories @plugin_directories end |
.load ⇒ Object
56 57 58 59 60 61 62 63 64 65 |
# File 'lib/redmine/plugin_loader.rb', line 56 def self.load setup add_autoload_paths Rails.application.config.to_prepare do PluginLoader.directories.each(&:run_initializer) Redmine::Hook.call_hook :after_plugins_loaded end end |
.setup ⇒ Object
67 68 69 70 71 72 73 74 75 |
# File 'lib/redmine/plugin_loader.rb', line 67 def self.setup @plugin_directories = [] Dir.glob(File.join(directory, '*')).each do |directory| next unless File.directory?(directory) @plugin_directories << PluginPath.new(directory) end end |