3
class StandardDefinition
4
attr_accessor :path, :packagedata, :metadata, :target_path, :vendor, :iteration
5
attr_accessor :plugintype, :preinstall, :postinstall, :dependencies, :mcserver
6
attr_accessor :mccommon
8
def initialize(path, name, vendor, preinstall, postinstall, iteration, dependencies, mcodependency, plugintype)
9
@plugintype = plugintype
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(" ", "-")
25
# Identify present packages and populate the packagedata hash
27
common_package = common
28
@packagedata[:common] = common_package if common_package
29
plugin_package = plugin
30
@packagedata[@plugintype] = plugin_package if plugin_package
33
# Obtain standard plugin files and dependencies
35
plugindata = {:files => [],
36
:dependencies => @dependencies.clone << @mcserver,
37
:description => "#{@name} #{@plugintype} plugin for the Marionette Collective."}
39
plugindir = File.join(@path, @plugintype.to_s)
40
if PluginPackager.check_dir_present plugindir
41
plugindata[:files] = Dir.glob(File.join(plugindir, "*"))
46
plugindata[:dependencies] <<"mcollective-#{@metadata[:name]}-common" if @packagedata[:common]
50
# Obtain list of common files
52
common = {:files => [],
53
:dependencies => @dependencies.clone << @mccommon,
54
:description => "Common libraries for #{@name} connector plugin"}
56
commondir = File.join(@path, "util")
57
if PluginPackager.check_dir_present commondir
58
common[:files] = Dir.glob(File.join(commondir, "*"))