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