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