| 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 54
54: def self.build_tool?(build_tool)
55: ENV["PATH"].split(File::PATH_SEPARATOR).each do |path|
56: builder = File.join(path, build_tool)
57: if File.exists?(builder)
58: return true
59: end
60: end
61: false
62: end
Checks if a directory is present and not empty
# File lib/mcollective/pluginpackager.rb, line 31
31: def self.check_dir_present(path)
32: (File.directory?(path) && !Dir.glob(File.join(path, "*")).empty?)
33: end
Quietly calls a block if verbose parameter is false
# File lib/mcollective/pluginpackager.rb, line 36
36: def self.do_quietly?(verbose, &block)
37: unless verbose
38: old_stdout = $stdout.clone
39: $stdout.reopen(File.new("/dev/null", "w"))
40: begin
41: block.call
42: rescue Exception => e
43: $stdout.reopen old_stdout
44: raise e
45: ensure
46: $stdout.reopen old_stdout
47: end
48: else
49: block.call
50: end
51: end
Fetch and return metadata from plugin DDL
# File lib/mcollective/pluginpackager.rb, line 17
17: def self.get_metadata(path, type)
18: ddl = DDL.new("package", type.to_sym, false)
19:
20: begin
21: ddl_file = File.read(Dir.glob(File.join(path, type, "*.ddl")).first)
22: rescue Exception
23: raise "failed to load ddl file in plugin directory : #{File.join(path, type)}"
24: end
25: ddl.instance_eval ddl_file
26:
27: return ddl.meta, ddl.requirements[:mcollective]
28: end
Package implementation plugins
# File lib/mcollective/pluginpackager.rb, line 8
8: def self.load_packagers
9: PluginManager.find_and_load("pluginpackager")
10: end