3 class StandardDefinition
4 attr_accessor :path, :packagedata, :metadata, :target_path, :vendor, :iteration
5 attr_accessor :plugintype, :preinstall, :postinstall, :dependencies, :mcname, :mcversion
7 def initialize(path, name, vendor, preinstall, postinstall, iteration, dependencies, mcdependency, plugintype)
8 @plugintype = plugintype
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)
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(/\s+|_/, "-")
26 # Identify present packages and populate the packagedata hash
28 common_package = common
29 @packagedata[:common] = common_package if common_package
30 plugin_package = plugin
31 @packagedata[@plugintype] = plugin_package if plugin_package
34 # Obtain standard plugin files and dependencies
36 plugindata = {:files => [],
37 :dependencies => @dependencies.clone,
38 :description => "#{@name} #{@plugintype} plugin for the Marionette Collective."}
40 plugindir = File.join(@path, @plugintype.to_s)
41 if PluginPackager.check_dir_present plugindir
42 plugindata[:files] = Dir.glob(File.join(plugindir, "*"))
47 plugindata[:plugindependency] = {:name => "#{@mcname}-#{@metadata[:name]}-common",
48 :version => @metadata[:version],
49 :iteration => @iteration} if @packagedata[:common]
53 # Obtain list of common files
55 common = {:files => [],
56 :dependencies => @dependencies.clone,
57 :description => "Common libraries for #{@name} connector plugin"}
59 commondir = File.join(@path, "util")
60 if PluginPackager.check_dir_present commondir
61 common[:files] = Dir.glob(File.join(commondir, "*"))