(Not documented)
# File lib/mcollective/pluginpackager.rb, line 12
12: def self.[](klass)
13: const_get("#{klass}")
14: 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
Checks if a build tool is present on the system
# File lib/mcollective/pluginpackager.rb, line 54
54: def self.command_available?(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
Quietly calls a block if verbose parameter is false
# File lib/mcollective/pluginpackager.rb, line 36
36: def self.execute_verbosely(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
Filter out platform specific dependencies Given a list of dependencies named - debian::foo redhat::bar PluginPackager.filter_dependencies(‘debian’, dependencies) will return foo.
# File lib/mcollective/pluginpackager.rb, line 74
74: def self.filter_dependencies(prefix, dependencies)
75: dependencies.map do |dependency|
76: if dependency[:name] =~ /^(\w+)::(\w+)/
77: if prefix == $1
78: dependency[:name] = $2
79: dependency
80: else
81: nil
82: end
83: else
84: dependency
85: end
86: end.reject{ |dependency| dependency == nil }
87: 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
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.