| Module | MCollective::PluginPackager |
| In: |
lib/mcollective/pluginpackager.rb
lib/mcollective/pluginpackager/standard_definition.rb lib/mcollective/pluginpackager/agent_definition.rb |
# 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
# File lib/mcollective/pluginpackager.rb, line 47
47: def self.build_tool?(build_tool)
48: ENV["PATH"].split(File::PATH_SEPARATOR).each do |path|
49: builder = File.join(path, build_tool)
50: if File.exists?(builder)
51: return true
52: end
53: end
54: false
55: end
Checks if a directory is present and not empty
# File lib/mcollective/pluginpackager.rb, line 24
24: def self.check_dir_present(path)
25: (File.directory?(path) && !Dir.glob(File.join(path, "*")).empty?)
26: end
Quietly calls a block if verbose parameter is false
# File lib/mcollective/pluginpackager.rb, line 29
29: def self.do_quietly?(verbose, &block)
30: unless verbose
31: old_stdout = $stdout.clone
32: $stdout.reopen(File.new("/dev/null", "w"))
33: begin
34: block.call
35: rescue Exception => e
36: $stdout.reopen old_stdout
37: raise e
38: ensure
39: $stdout.reopen old_stdout
40: end
41: else
42: block.call
43: end
44: end
Fetch and return metadata from plugin DDL
# File lib/mcollective/pluginpackager.rb, line 17
17: def self.get_metadata(path, type)
18: ddl = MCollective::RPC::DDL.new("package", false)
19: ddl.instance_eval File.read(Dir.glob(File.join(path, type, "*.ddl")).first)
20: ddl.meta
21: end
Package implementation plugins
# File lib/mcollective/pluginpackager.rb, line 8
8: def self.load_packagers
9: PluginManager.find_and_load("pluginpackager")
10: end