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