Class: MCollective::PluginPackager::StandardDefinition
- Inherits:
-
Object
- Object
- MCollective::PluginPackager::StandardDefinition
- Defined in:
- lib/mcollective/pluginpackager/standard_definition.rb
Instance Attribute Summary collapse
-
#dependencies ⇒ Object
Returns the value of attribute dependencies.
-
#mcname ⇒ Object
Returns the value of attribute mcname.
-
#mcversion ⇒ Object
Returns the value of attribute mcversion.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#packagedata ⇒ Object
Returns the value of attribute packagedata.
-
#path ⇒ Object
Returns the value of attribute path.
-
#plugintype ⇒ Object
Returns the value of attribute plugintype.
-
#postinstall ⇒ Object
Returns the value of attribute postinstall.
-
#preinstall ⇒ Object
Returns the value of attribute preinstall.
-
#revision ⇒ Object
Returns the value of attribute revision.
-
#target_path ⇒ Object
Returns the value of attribute target_path.
-
#vendor ⇒ Object
Returns the value of attribute vendor.
Instance Method Summary collapse
-
#common ⇒ Object
Obtain list of common files.
-
#identify_packages ⇒ Object
Identify present packages and populate the packagedata hash.
-
#initialize(configuration, mcdependency, plugintype) ⇒ StandardDefinition
constructor
A new instance of StandardDefinition.
-
#plugin ⇒ Object
Obtain standard plugin files and dependencies.
Constructor Details
#initialize(configuration, mcdependency, plugintype) ⇒ StandardDefinition
Returns a new instance of StandardDefinition.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/mcollective/pluginpackager/standard_definition.rb', line 6 def initialize(configuration, mcdependency, plugintype) @plugintype = plugintype @path = PluginPackager.get_plugin_path(configuration[:target]) @packagedata = {} @revision = configuration[:revision] || 1 @preinstall = configuration[:preinstall] @postinstall = configuration[:postinstall] @vendor = configuration[:vendor] || "Choria.IO User" @dependencies = configuration[:dependency] || [] @target_path = File.(@path) @metadata, mcversion = PluginPackager.(@path, @plugintype) @mcname = mcdependency[:mcname] || "mcollective" @mcversion = mcdependency[:mcversion] || mcversion @dependencies << {:name => "#{mcname}-common", :version => @mcversion} @metadata[:name] = (configuration[:pluginname] || @metadata[:name]).downcase.gsub(/\s+|_/, "-") @metadata[:version] = (configuration[:version] || @metadata[:version]) identify_packages end |
Instance Attribute Details
#dependencies ⇒ Object
Returns the value of attribute dependencies.
4 5 6 |
# File 'lib/mcollective/pluginpackager/standard_definition.rb', line 4 def dependencies @dependencies end |
#mcname ⇒ Object
Returns the value of attribute mcname.
4 5 6 |
# File 'lib/mcollective/pluginpackager/standard_definition.rb', line 4 def mcname @mcname end |
#mcversion ⇒ Object
Returns the value of attribute mcversion.
4 5 6 |
# File 'lib/mcollective/pluginpackager/standard_definition.rb', line 4 def mcversion @mcversion end |
#metadata ⇒ Object
Returns the value of attribute metadata.
4 5 6 |
# File 'lib/mcollective/pluginpackager/standard_definition.rb', line 4 def @metadata end |
#packagedata ⇒ Object
Returns the value of attribute packagedata.
4 5 6 |
# File 'lib/mcollective/pluginpackager/standard_definition.rb', line 4 def packagedata @packagedata end |
#path ⇒ Object
Returns the value of attribute path.
4 5 6 |
# File 'lib/mcollective/pluginpackager/standard_definition.rb', line 4 def path @path end |
#plugintype ⇒ Object
Returns the value of attribute plugintype.
4 5 6 |
# File 'lib/mcollective/pluginpackager/standard_definition.rb', line 4 def plugintype @plugintype end |
#postinstall ⇒ Object
Returns the value of attribute postinstall.
4 5 6 |
# File 'lib/mcollective/pluginpackager/standard_definition.rb', line 4 def postinstall @postinstall end |
#preinstall ⇒ Object
Returns the value of attribute preinstall.
4 5 6 |
# File 'lib/mcollective/pluginpackager/standard_definition.rb', line 4 def preinstall @preinstall end |
#revision ⇒ Object
Returns the value of attribute revision.
4 5 6 |
# File 'lib/mcollective/pluginpackager/standard_definition.rb', line 4 def revision @revision end |
#target_path ⇒ Object
Returns the value of attribute target_path.
4 5 6 |
# File 'lib/mcollective/pluginpackager/standard_definition.rb', line 4 def target_path @target_path end |
#vendor ⇒ Object
Returns the value of attribute vendor.
4 5 6 |
# File 'lib/mcollective/pluginpackager/standard_definition.rb', line 4 def vendor @vendor end |
Instance Method Details
#common ⇒ Object
Obtain list of common files
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/mcollective/pluginpackager/standard_definition.rb', line 61 def common common = { :files => [], :dependencies => @dependencies.clone, :description => "Common libraries for #{@name} connector plugin" } commondir = File.join(@path, "util") if PluginPackager.check_dir_present commondir common[:files] = Dir.glob(File.join(commondir, "*")) return common end nil end |
#identify_packages ⇒ Object
Identify present packages and populate the packagedata hash
27 28 29 30 31 32 |
# File 'lib/mcollective/pluginpackager/standard_definition.rb', line 27 def identify_packages common_package = common @packagedata[:common] = common_package if common_package plugin_package = plugin @packagedata[@plugintype.to_sym] = plugin_package if plugin_package end |
#plugin ⇒ Object
Obtain standard plugin files and dependencies
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/mcollective/pluginpackager/standard_definition.rb', line 35 def plugin plugindata = { :files => [], :dependencies => @dependencies.clone, :description => "#{@name} #{@plugintype} plugin for the Choria Orchestrator." } plugindir = File.join(@path, @plugintype.to_s) if PluginPackager.check_dir_present plugindir plugindata[:files] = Dir.glob(File.join(plugindir, "*")) else return nil end if @packagedata[:common] plugindata[:plugindependency] = { :name => "#{@mcname}-#{@metadata[:name]}-common", :version => @metadata[:version], :revision => @revision } end plugindata end |