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