Class: BoxGrinder::PluginHelper
- Inherits:
-
Object
- Object
- BoxGrinder::PluginHelper
- Defined in:
- lib/boxgrinder-build/helpers/plugin-helper.rb
Instance Attribute Summary collapse
-
#delivery_plugins ⇒ Object
readonly
Returns the value of attribute delivery_plugins.
-
#os_plugins ⇒ Object
readonly
Returns the value of attribute os_plugins.
-
#platform_plugins ⇒ Object
readonly
Returns the value of attribute platform_plugins.
Instance Method Summary collapse
-
#initialize(config, options = {}) ⇒ PluginHelper
constructor
A new instance of PluginHelper.
- #load_plugins ⇒ Object
- #print_plugins(type) ⇒ Object
- #read_and_require ⇒ Object
Constructor Details
#initialize(config, options = {}) ⇒ PluginHelper
43 44 45 46 |
# File 'lib/boxgrinder-build/helpers/plugin-helper.rb', line 43 def initialize( config, = {} ) = config @log = [:log] || LogHelper.new end |
Instance Attribute Details
#delivery_plugins ⇒ Object (readonly)
Returns the value of attribute delivery_plugins.
92 93 94 |
# File 'lib/boxgrinder-build/helpers/plugin-helper.rb', line 92 def delivery_plugins @delivery_plugins end |
#os_plugins ⇒ Object (readonly)
Returns the value of attribute os_plugins.
90 91 92 |
# File 'lib/boxgrinder-build/helpers/plugin-helper.rb', line 90 def os_plugins @os_plugins end |
#platform_plugins ⇒ Object (readonly)
Returns the value of attribute platform_plugins.
91 92 93 |
# File 'lib/boxgrinder-build/helpers/plugin-helper.rb', line 91 def platform_plugins @platform_plugins end |
Instance Method Details
#load_plugins ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/boxgrinder-build/helpers/plugin-helper.rb', line 48 def load_plugins read_and_require @os_plugins = PluginManager.instance.plugins[:os] @platform_plugins = PluginManager.instance.plugins[:platform] @delivery_plugins = PluginManager.instance.plugins[:delivery] print_plugins( 'os' ) { @os_plugins } print_plugins( 'platform' ) { @platform_plugins } print_plugins( 'delivery' ) { @delivery_plugins } self end |
#print_plugins(type) ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/boxgrinder-build/helpers/plugin-helper.rb', line 76 def print_plugins( type ) @log.debug "Loading #{type} plugins..." plugins = yield @log.debug "We have #{plugins.size} #{type} plugin(s) registered" plugins.each do |plugin_name_or_type, plugin_info| @log.debug "- #{plugin_name_or_type} plugin for #{plugin_info[:full_name]}." end @log.debug "Plugins loaded." end |
#read_and_require ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/boxgrinder-build/helpers/plugin-helper.rb', line 62 def read_and_require .additional_plugins.each do |plugin| @log.trace "Loading plugin '#{plugin}'..." begin require plugin @log.trace "- OK" rescue LoadError => e @log.trace "- Not found: #{e.message.strip.chomp}" @log.warn "Specified plugin: '#{plugin}' wasn't found. Make sure its name is correct, skipping..." end end end |