# File lib/mcollective/pluginpackager.rb, line 12 def self.[](klass) const_get("#{klass}") end
Checks if a build tool is present on the system
# File lib/mcollective/pluginpackager.rb, line 52 def self.build_tool?(build_tool) ENV["PATH"].split(File::PATH_SEPARATOR).each do |path| builder = File.join(path, build_tool) if File.exists?(builder) return true end end false end
Checks if a directory is present and not empty
# File lib/mcollective/pluginpackager.rb, line 29 def self.check_dir_present(path) (File.directory?(path) && !Dir.glob(File.join(path, "*")).empty?) end
Quietly calls a block if verbose parameter is false
# File lib/mcollective/pluginpackager.rb, line 34 def self.do_quietly?(verbose, &block) unless verbose old_stdout = $stdout.clone $stdout.reopen(File.new("/dev/null", "w")) begin block.call rescue Exception => e $stdout.reopen old_stdout raise e ensure $stdout.reopen old_stdout end else block.call end end
Fetch and return metadata from plugin DDL
# File lib/mcollective/pluginpackager.rb, line 17 def self.get_metadata(path, type) ddl = DDL.new("package", type.to_sym, false) begin ddl_file = File.read(Dir.glob(File.join(path, type, "*.ddl")).first) rescue Exception raise "failed to load ddl file in plugin directory : #{File.join(path, type)}" end ddl.instance_eval ddl_file ddl.meta end
Generated with the Darkfish Rdoc Generator 2.