Sha256: d78187874c8154fea32072498ed4b6b5deaa1a2bab14b87d2ee23678efa39aa6
Contents?: true
Size: 862 Bytes
Versions: 8
Compression:
Stored size: 862 Bytes
Contents
module KnifeSpork module Plugins # Load each of the drop-in plugins Dir[File.expand_path('../plugins/**/*.rb', __FILE__)].each { |f| require f } def self.run(options = {}) hook = options[:hook].to_sym #Load each of the drop-in plugins specified in the custom plugin path Dir[File.expand_path("#{options[:config][:custom_plugin_path]}/*.rb")].each { |f| require f } klasses.each do |klass| plugin = klass.new(options) plugin.send(hook) if plugin.respond_to?(hook) && plugin.enabled? end end # Get and return a list of all subclasses (plugins) that are not the base plugin def self.klasses @@klasses ||= self.constants.collect do |c| self.const_get(c) if self.const_get(c).is_a?(Class) && self.const_get(c) != KnifeSpork::Plugins::Plugin end.compact end end end
Version data entries
8 entries across 8 versions & 2 rubygems