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