module Busser::Plugin
Plugin
loading logic.
@author Fletcher Nichol <fnichol@nichol.ca>
Public Instance Methods
all_runner_plugins()
click to toggle source
# File lib/busser/plugin.rb, line 43 def all_runner_plugins Gem.find_files('busser/runner_plugin/*.rb').map do |file| "busser/runner_plugin/#{File.basename(file).sub(/\.rb$/, '')}" end end
gem_from_path(plugin_path)
click to toggle source
# File lib/busser/plugin.rb, line 59 def gem_from_path(plugin_path) local_gem_path = "#{File.expand_path(plugin_path, $LOAD_PATH.first)}" local_gemspec = File.join( File.dirname($LOAD_PATH.first), "busser.gemspec") if ! Dir.glob("#{local_gem_path}#{Gem.suffix_pattern}").empty? Gem::Specification.load(File.expand_path(local_gemspec)) else Gem::Specification.find_by_path(plugin_path) end end
require!(plugin_path)
click to toggle source
# File lib/busser/plugin.rb, line 49 def require!(plugin_path) require plugin_path rescue LoadError => e Busser::UI.die "Could not load #{plugin_path} (#{e.class}: #{e.message})" end
runner_class(klass)
click to toggle source
# File lib/busser/plugin.rb, line 55 def runner_class(klass) Busser::RunnerPlugin.const_get(klass) end
runner_plugin(plugin_name)
click to toggle source
# File lib/busser/plugin.rb, line 31 def runner_plugin(plugin_name) "busser/runner_plugin/#{plugin_name}" end
runner_plugins(plugin_names = nil)
click to toggle source
# File lib/busser/plugin.rb, line 35 def runner_plugins(plugin_names = nil) if plugin_names Array(plugin_names).map { |plugin| runner_plugin(plugin) } else all_runner_plugins end end