Module MCollective::PluginPackager
In: lib/mcollective/pluginpackager.rb
lib/mcollective/pluginpackager/standard_definition.rb
lib/mcollective/pluginpackager/agent_definition.rb

Methods

Classes and Modules

Class MCollective::PluginPackager::AgentDefinition
Class MCollective::PluginPackager::StandardDefinition

Public Class methods

[Source]

    # File lib/mcollective/pluginpackager.rb, line 12
12:     def self.[](klass)
13:       const_get("#{klass}")
14:     end

Checks if a build tool is present on the system

[Source]

    # File lib/mcollective/pluginpackager.rb, line 52
52:     def self.build_tool?(build_tool)
53:       ENV["PATH"].split(File::PATH_SEPARATOR).each do |path|
54:         builder = File.join(path, build_tool)
55:         if File.exists?(builder)
56:           return true
57:         end
58:       end
59:       false
60:     end

Checks if a directory is present and not empty

[Source]

    # File lib/mcollective/pluginpackager.rb, line 29
29:     def self.check_dir_present(path)
30:       (File.directory?(path) && !Dir.glob(File.join(path, "*")).empty?)
31:     end

Quietly calls a block if verbose parameter is false

[Source]

    # File lib/mcollective/pluginpackager.rb, line 34
34:     def self.do_quietly?(verbose, &block)
35:       unless verbose
36:         old_stdout = $stdout.clone
37:         $stdout.reopen(File.new("/dev/null", "w"))
38:         begin
39:           block.call
40:         rescue Exception => e
41:           $stdout.reopen old_stdout
42:           raise e
43:         ensure
44:           $stdout.reopen old_stdout
45:         end
46:       else
47:         block.call
48:       end
49:     end

Fetch and return metadata from plugin DDL

[Source]

    # File lib/mcollective/pluginpackager.rb, line 17
17:     def self.get_metadata(path, type)
18:       ddl = DDL.new("package", type.to_sym, false)
19:       begin
20:         ddl_file = File.read(Dir.glob(File.join(path, type, "*.ddl")).first)
21:       rescue Exception
22:         raise "failed to load ddl file in plugin directory : #{File.join(path, type)}"
23:       end
24:       ddl.instance_eval ddl_file
25:       ddl.meta
26:     end

Package implementation plugins

[Source]

    # File lib/mcollective/pluginpackager.rb, line 8
 8:     def self.load_packagers
 9:       PluginManager.find_and_load("pluginpackager")
10:     end

[Source]

    # File lib/mcollective/pluginpackager.rb, line 62
62:     def self.safe_system(*args)
63:       raise RuntimeError, "Failed: #{args.join(' ')}" unless system *args
64:     end

[Validate]