module FFWD::Plugin
Public Class Methods
category()
click to toggle source
# File lib/ffwd/plugin.rb, line 106 def self.category 'plugin' end
discovered()
click to toggle source
# File lib/ffwd/plugin.rb, line 79 def self.discovered @@discovered ||= {} end
included(mod)
click to toggle source
# File lib/ffwd/plugin.rb, line 102 def self.included mod mod.extend ClassMethods end
load_discovered(source)
click to toggle source
# File lib/ffwd/plugin.rb, line 110 def self.load_discovered source FFWD::Plugin.discovered.each do |name, config| FFWD::Plugin.loaded[name] = Loaded.new source, name, config end FFWD::Plugin.discovered.clear end
load_plugins(log, kind_name, config, kind, m)
click to toggle source
# File lib/ffwd/plugin.rb, line 118 def self.load_plugins log, kind_name, config, kind, m result = [] return result if config.nil? config.each_with_index do |plugin_config, index| d = "#{kind_name} plugin ##{index}" unless name = plugin_config[:type] log.error "#{d}: Missing :type attribute for '#{kind_name}'" next end unless plugin = FFWD::Plugin.loaded[name] log.error "#{d}: Not an available plugin '#{name}'" next end unless setup = plugin.get(kind) log.error "#{d}: Not an #{kind_name} plugin '#{name}'" next end factory = setup.call Hash[plugin_config] unless factory.respond_to? m log.error "#{d}: Plugin '#{name}' does not support '#{m.to_s}'" next end unless factory.respond_to? :config log.error "#{d}: Plugin '#{name}' does not support 'config'" next end result << Setup.new(factory.method(m), factory.config, name) end return result end
loaded()
click to toggle source
# File lib/ffwd/plugin.rb, line 83 def self.loaded @@loaded ||= {} end
option(name, opts={})
click to toggle source
# File lib/ffwd/plugin.rb, line 159 def self.option name, opts={} {:name => name, :default => opts[:default], :help => opts[:help], :modes => opts[:modes]} end