module PluginLoader
Manages the detection of plugins
Public Instance Methods
find_plugin_file(name, type)
click to toggle source
rubocop:enable all
# File lib/core/loaders/plugin_loader.rb, line 16 def find_plugin_file(name, type) c_name = StringHelper.camelize name class_module = "#{c_name}#{StringHelper.camelize type}::#{c_name}" find_plugin_files(type).each do |file| return file if file.module_class_name == class_module end nil end
find_plugin_files(type)
click to toggle source
# File lib/core/loaders/plugin_loader.rb, line 25 def find_plugin_files(type) find_plugin_files_by_pattern(type, "plugins/", "**/*_#{type}.rb") end
find_plugin_files_by_pattern(type, dirname, glob = "**/*")
click to toggle source
# File lib/core/loaders/plugin_loader.rb, line 29 def find_plugin_files_by_pattern(type, dirname, glob = "**/*") plugins = [] FileHelper.files(dirname, glob).each { |file| plugins << PluginFile.new(file, type) } plugins.empty? ? nil : plugins end
load_plugin(name, type, logger, options = {}, conf = Conf)
click to toggle source
rubocop:disable all
# File lib/core/loaders/plugin_loader.rb, line 7 def load_plugin(name, type, logger, options = {}, conf = Conf) plugin_file = find_plugin_file name, type return nil unless plugin_file require plugin_file.absolute_path plugin = eval "#{plugin_file.module_class_name}" plugin.generate logger, options, conf end