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