Class: Puppet::Reports

Inherits:
Object show all
Extended by:
Util::ClassGen, Util::InstanceLoader
Defined in:
lib/vendor/puppet/reports.rb

Overview

A simple mechanism for loading and returning reports.

Constant Summary

Constants included from Util

Util::AbsolutePathPosix, Util::AbsolutePathWindows

Class Attribute Summary collapse

Class Method Summary collapse

Methods included from Util::ClassGen

genclass, genmodule, rmclass

Methods included from Util

absolute_path?, activerecord_version, benchmark, binread, chuser, classproxy, #execfail, #execpipe, execute, execute_posix, execute_windows, logmethods, memory, path_to_uri, proxy, replace_file, safe_posix_fork, symbolize, symbolizehash, symbolizehash!, synchronize_on, thinmark, #threadlock, uri_to_path, wait_for_output, which, withumask

Methods included from Util::POSIX

#get_posix_field, #gid, #idfield, #methodbyid, #methodbyname, #search_posix_field, #uid

Methods included from Util::MethodHelper

#requiredopts, #set_options, #symbolize_options

Methods included from Util::InstanceLoader

instance_docs, instance_hash, instance_load, instance_loader, instance_loading?, loaded_instance, loaded_instances

Class Attribute Details

.hooksObject (readonly)

Returns the value of attribute hooks.



12
13
14
# File 'lib/vendor/puppet/reports.rb', line 12

def hooks
  @hooks
end

Class Method Details

.register_report(name, options = {}, &block) ⇒ Object

Add a new report type.



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/vendor/puppet/reports.rb', line 16

def self.register_report(name, options = {}, &block)
  name = name.intern

  mod = genmodule(name, :extend => Puppet::Util::Docs, :hash => instance_hash(:report), :block => block)

  mod.useyaml = true if options[:useyaml]

  mod.send(:define_method, :report_name) do
    name
  end
end

.reportdocsObject

Collect the docs for all of our reports.



29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/vendor/puppet/reports.rb', line 29

def self.reportdocs
  docs = ""

  # Use this method so they all get loaded
  instance_loader(:report).loadall
  loaded_instances(:report).sort { |a,b| a.to_s <=> b.to_s }.each do |name|
    mod = self.report(name)
    docs += "#{name}\n#{"-" * name.to_s.length}\n"

    docs += Puppet::Util::Docs.scrub(mod.doc) + "\n\n"
  end

  docs
end

.reportsObject

List each of the reports.



45
46
47
48
# File 'lib/vendor/puppet/reports.rb', line 45

def self.reports
  instance_loader(:report).loadall
  loaded_instances(:report)
end