class MCollective::PluginPackager::OspackagePackager

MCollective plugin packager general OS implementation.

Attributes

package[RW]
package_type[RW]
packager[RW]
verbose[RW]

Public Class Methods

new(package, pluginpath = nil, signature = nil, verbose = false, keep_artifacts = false, module_template = nil) click to toggle source

Create packager object with package parameter containing list of files, dependencies and package metadata.

   # File lib/mcollective/pluginpackager/ospackage_packager.rb
10 def initialize(package, pluginpath = nil, signature = nil, verbose = false, keep_artifacts = false, module_template = nil)
11 
12   if File.exists?("/etc/redhat-release")
13     @packager = PluginPackager["RpmpackagePackager"].new(package, pluginpath, signature, verbose, keep_artifacts, module_template)
14     @package_type = "RPM"
15   elsif File.exists?("/etc/debian_version")
16     @packager = PluginPackager["DebpackagePackager"].new(package, pluginpath, signature, verbose, keep_artifacts, module_template)
17     @package_type = "Deb"
18   else
19     raise "cannot identify operating system."
20   end
21 
22   @package = package
23   @verbose = verbose
24 end

Public Instance Methods

create_packages() click to toggle source

Hands over package creation to the detected packager implementation based on operating system.

   # File lib/mcollective/pluginpackager/ospackage_packager.rb
28 def create_packages
29   @packager.create_packages
30 end
package_information() click to toggle source

Displays the package metadata and detected files

   # File lib/mcollective/pluginpackager/ospackage_packager.rb
33 def package_information
34   puts
35   puts "%30s%s" % ["Plugin information : ", @package.metadata[:name]]
36   puts "%30s%s" % ["-" * 22, "-" * 22]
37   puts "%30s%s" % ["Plugin Type : ", @package.plugintype.capitalize]
38   puts "%30s%s" % ["Package Output Format : ", @package_type]
39   puts "%30s%s" % ["Version : ", @package.metadata[:version]]
40   puts "%30s%s" % ["Revision : ", @package.revision]
41   puts "%30s%s" % ["Vendor : ", @package.vendor]
42   puts "%30s%s" % ["Post Install Script : ", @package.postinstall] if @package.postinstall
43   puts "%30s%s" % ["Author : ", @package.metadata[:author]]
44   puts "%30s%s" % ["License : ", @package.metadata[:license]]
45   puts "%30s%s" % ["URL : ", @package.metadata[:url]]
46 
47   if @package.packagedata.size > 0
48     @package.packagedata.each_with_index do |values, i|
49       if i == 0
50         puts "%30s%s" % ["Identified Packages : ", values[0]]
51       else
52         puts "%30s%s" % [" ", values[0]]
53       end
54     end
55   end
56 end