| Class | MCollective::PluginPackager::StandardDefinition |
| In: |
lib/mcollective/pluginpackager/standard_definition.rb
|
| Parent: | Object |
| dependencies | [RW] | |
| iteration | [RW] | |
| mccommon | [RW] | |
| mcserver | [RW] | |
| metadata | [RW] | |
| packagedata | [RW] | |
| path | [RW] | |
| plugintype | [RW] | |
| postinstall | [RW] | |
| preinstall | [RW] | |
| target_path | [RW] | |
| vendor | [RW] |
# File lib/mcollective/pluginpackager/standard_definition.rb, line 8
8: def initialize(path, name, vendor, preinstall, postinstall, iteration, dependencies, mcodependency, plugintype)
9: @plugintype = plugintype
10: @path = path
11: @packagedata = {}
12: @iteration = iteration || 1
13: @preinstall = preinstall
14: @postinstall = postinstall
15: @vendor = vendor || "Puppet Labs"
16: @dependencies = dependencies || []
17: @mcserver = mcodependency[:server] || "mcollective"
18: @mccommon = mcodependency[:common] || "mcollective-common"
19: @target_path = File.expand_path(@path)
20: @metadata = PluginPackager.get_metadata(@path, @plugintype)
21: @metadata[:name] = (name || @metadata[:name]).downcase.gsub(" ", "-")
22: identify_packages
23: end
Obtain list of common files
# File lib/mcollective/pluginpackager/standard_definition.rb, line 51
51: def common
52: common = {:files => [],
53: :dependencies => @dependencies.clone << @mccommon,
54: :description => "Common libraries for #{@name} connector plugin"}
55:
56: commondir = File.join(@path, "util")
57: if PluginPackager.check_dir_present commondir
58: common[:files] = Dir.glob(File.join(commondir, "*"))
59: return common
60: else
61: return nil
62: end
63: end
Identify present packages and populate the packagedata hash
# File lib/mcollective/pluginpackager/standard_definition.rb, line 26
26: def identify_packages
27: common_package = common
28: @packagedata[:common] = common_package if common_package
29: plugin_package = plugin
30: @packagedata[@plugintype] = plugin_package if plugin_package
31: end
Obtain standard plugin files and dependencies
# File lib/mcollective/pluginpackager/standard_definition.rb, line 34
34: def plugin
35: plugindata = {:files => [],
36: :dependencies => @dependencies.clone << @mcserver,
37: :description => "#{@name} #{@plugintype} plugin for the Marionette Collective."}
38:
39: plugindir = File.join(@path, @plugintype.to_s)
40: if PluginPackager.check_dir_present plugindir
41: plugindata[:files] = Dir.glob(File.join(plugindir, "*"))
42: else
43: return nil
44: end
45:
46: plugindata[:dependencies] <<"mcollective-#{@metadata[:name]}-common" if @packagedata[:common]
47: plugindata
48: end