Top Level Namespace
Defined Under Namespace
Modules: PuppetX, YARD
Classes: HTMLHelper, HereDocHelper, Puppet4xFunctionHandler, TemplateHelper
Instance Method Summary
collapse
Instance Method Details
#box_info ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/puppet_x/puppetlabs/strings/yard/templates/default/puppetnamespace/setup.rb', line 26
def box_info
@source_files = []
@methods.each do |method|
file_name = method.files[0][0]
line_number = method.files[0][1]
@source_files.push([method.name, "#{file_name} (#{line_number})"])
end
erb(:box_info)
end
|
#command_details ⇒ Object
19
20
21
22
|
# File 'lib/puppet_x/puppetlabs/strings/yard/templates/default/provider/setup.rb', line 19
def command_details
@command_details = object.commands
erb(:command_details)
end
|
#confine_details ⇒ Object
24
25
26
27
|
# File 'lib/puppet_x/puppetlabs/strings/yard/templates/default/provider/setup.rb', line 24
def confine_details
@confine_details = object.confines
erb(:confine_details)
end
|
#default_details ⇒ Object
29
30
31
32
|
# File 'lib/puppet_x/puppetlabs/strings/yard/templates/default/provider/setup.rb', line 29
def default_details
@default_details = object.defaults
erb(:default_details)
end
|
#docstring ⇒ Object
50
51
52
53
54
55
|
# File 'lib/puppet_x/puppetlabs/strings/yard/templates/default/type/setup.rb', line 50
def docstring
@class_details = @template_helper.(object)
erb(:docstring)
end
|
#feature_details ⇒ Object
34
35
36
37
|
# File 'lib/puppet_x/puppetlabs/strings/yard/templates/default/provider/setup.rb', line 34
def feature_details
@feature_details = object.features
erb(:feature_details)
end
|
#generate_class_list ⇒ Object
1
2
3
4
5
6
|
# File 'lib/puppet_x/puppetlabs/strings/yard/templates/default/fulldoc/html/setup.rb', line 1
def generate_class_list
@items = options.objects.select{|o| [:module, :class, :root].include? o.type} if options.objects
@list_title = "Class List"
@list_type = "class"
generate_list_contents
end
|
#generate_puppet_manifest_list ⇒ Object
8
9
10
11
12
13
14
15
16
|
# File 'lib/puppet_x/puppetlabs/strings/yard/templates/default/fulldoc/html/setup.rb', line 8
def generate_puppet_manifest_list
@items = options.objects.select{|o| [:hostclass, :definedtype].include? o.type} if options.objects
@list_title = "Puppet Manifest List"
@list_class = "class"
@list_type = "puppet_manifest"
generate_list_contents
end
|
#generate_puppet_plugin_list ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/puppet_x/puppetlabs/strings/yard/templates/default/fulldoc/html/setup.rb', line 18
def generate_puppet_plugin_list
@items = options.objects.select{|o| [:puppetnamespace].include? o.type} if options.objects
@list_title = "Puppet Plugin List"
@list_class = "class"
@list_type = "puppet_plugin"
generate_list_contents
end
|
#generate_puppet_provider_list ⇒ Object
37
38
39
40
41
42
|
# File 'lib/puppet_x/puppetlabs/strings/yard/templates/default/fulldoc/html/setup.rb', line 37
def generate_puppet_provider_list
@items = options.objects.select{|o| [:provider].include? o.type} if options.objects
@list_title = "Puppet Provider List"
@list_type = "puppet_provider"
generate_list_contents
end
|
#generate_puppet_type_list ⇒ Object
30
31
32
33
34
35
|
# File 'lib/puppet_x/puppetlabs/strings/yard/templates/default/fulldoc/html/setup.rb', line 30
def generate_puppet_type_list
@items = options.objects.select{|o| [:type].include? o.type} if options.objects
@list_title = "Puppet Type List"
@list_type = "puppet_type"
generate_list_contents
end
|
13
14
15
16
17
|
# File 'lib/puppet_x/puppetlabs/strings/yard/templates/default/type/setup.rb', line 13
def
= object.
erb(:header)
end
|
#index ⇒ Object
TODO: This should be extendable. However, the re-assignment of
3
4
5
6
7
8
9
|
# File 'lib/puppet_x/puppetlabs/strings/yard/templates/default/layout/html/setup.rb', line 3
def index
@objects_by_letter = {}
objects = Registry.all(:class, :module, :type, :puppetnamespace, :hostclass, :definedtype, :provider).sort_by {|o| o.name.to_s }
objects = run_verifier(objects)
objects.each {|o| (@objects_by_letter[o.name.to_s[0,1].upcase] ||= []) << o }
erb(:index)
end
|
#init ⇒ Object
6
7
8
9
10
11
|
# File 'lib/puppet_x/puppetlabs/strings/yard/templates/default/type/setup.rb', line 6
def init
sections :header, :box_info, :pre_docstring, :docstring, :parameter_details, :provider_details
@template_helper = TemplateHelper.new
@html_helper = HTMLHelper.new
end
|
11
12
13
14
15
16
17
18
|
# File 'lib/puppet_x/puppetlabs/strings/yard/templates/default/layout/html/setup.rb', line 11
def
[
{:type => 'puppet_manifest', :title => 'Puppet Manifests', :search_title => "Puppet Manifest List"},
{:type => 'puppet_plugin', :title => 'Puppet Plugins', :search_title => "Puppet Plugin List"},
{:type => 'puppet_type', :title => 'Puppet Types', :search_title => "Puppet Type List"},
{:type => 'puppet_provider', :title => 'Puppet Providers', :search_title => "Puppet Provider List"},
] + super
end
|
#method_details_list ⇒ Object
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
# File 'lib/puppet_x/puppetlabs/strings/yard/templates/default/puppetnamespace/setup.rb', line 60
def method_details_list
@class_details = []
@html_helper = HTMLHelper.new
@methods.each do |object|
method_info = @template_helper.(object)
param_details = nil
param_tags = object.tags.find_all{ |tag| tag.tag_name == "param"}
if object['puppet_4x_function']
source_code = object.source
parameters = source_code.match(/(?:def .*)\((.*?)\)/)
params = parameters.nil? ? nil : parameters[1].split(/\s*,\s*/)
param_details = @template_helper.(params, param_tags) unless params.nil?
@template_helper.check_types_match_docs object, param_details
@template_helper.check_parameters_match_docs object
else
param_details = @template_helper.(param_tags)
end
method_info[:params] = param_details
@class_details.push(method_info)
end
erb(:method_details_list)
end
|
#method_summary ⇒ Object
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/puppet_x/puppetlabs/strings/yard/templates/default/puppetnamespace/setup.rb', line 40
def method_summary
@method_details = []
@html_helper = HTMLHelper.new
@methods.each do |method|
first_sentence = method.docstring.match(/^(.*?)\./)
brief_summary = first_sentence ? first_sentence : method.docstring
return_tag = method.tags.find { |tag| tag.tag_name == "return"}
return_types = return_tag.nil? ? nil : return_tag.types
@method_details.push({:name => method.name, :short_desc => brief_summary, :return_types => return_types})
end
erb(:method_summary)
end
|
#namespace_list(opts = {}) ⇒ Object
A hacked version of class_list that can be instructed to only display certain namespace types. This allows us to separate Puppet bits from Ruby bits.
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
# File 'lib/puppet_x/puppetlabs/strings/yard/templates/default/fulldoc/html/setup.rb', line 46
def namespace_list(opts = {})
o = {
:root => Registry.root,
:namespace_types => [:module, :class]
}.merge(opts)
root = o[:root]
namespace_types = o[:namespace_types]
out = ""
children = run_verifier(root.children)
if root == Registry.root
children += @items.select {|o| o.namespace.is_a?(CodeObjects::Proxy) }
end
children.reject {|c| c.nil? }.sort_by {|child| child.path }.map do |child|
if namespace_types.include? child.type
if child.namespace.is_a?(CodeObjects::Proxy)
name = child.path
elsif child.is_a?(PuppetX::PuppetLabs::Strings::YARD::CodeObjects::TypeObject) || child.is_a?(PuppetX::PuppetLabs::Strings::YARD::CodeObjects::ProviderObject)
name = child.
else
name = child.name
end
has_children = child.respond_to?(:children) && run_verifier(child.children).any? {|o| o.is_a?(CodeObjects::NamespaceObject) }
out << "<li>"
out << "<a class='toggle'></a> " if has_children
out << linkify(child, name)
out << " < #{child.superclass.name}" if child.is_a?(CodeObjects::ClassObject) && child.superclass
out << "<small class='search_info'>"
out << child.namespace.title
out << "</small>"
out << "</li>"
out << "<ul>#{namespace_list(:root => child, :namespace_types => namespace_types)}</ul>" if has_children
end
end
out
end
|
#parameter_details ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/puppet_x/puppetlabs/strings/yard/templates/default/type/setup.rb', line 26
def parameter_details
params = object.parameter_details.map { |h| h[:name] }
@param_details = (object.parameter_details + object.property_details).each {
|h| h[:desc] = htmlify(Puppet::Util::Docs::scrub(h[:desc])) if h[:desc]
}.sort { |a, b| a[:name] <=> b[:name] }
@param_details = @param_details.partition{|a| a[:name] == 'ensure'}.flatten
@param_details = @param_details.partition{|a| a[:namevar]}.flatten
@feature_details = object.features
@template_helper.check_parameters_match_docs object
erb(:parameter_details)
end
|
#provider_details ⇒ Object
19
20
21
22
23
24
|
# File 'lib/puppet_x/puppetlabs/strings/yard/templates/default/type/setup.rb', line 19
def provider_details
type_name = object.name.to_s
@providers = YARD::Registry.all(:provider).select { |t| t.type_name == type_name }
erb(:provider_details)
end
|
#source ⇒ Object
16
17
18
19
20
21
|
# File 'lib/puppet_x/puppetlabs/strings/yard/templates/default/method_details/setup.rb', line 16
def source
return if owner != object.namespace
return if Tags::OverloadTag === object
return if object.source.nil?
erb(:source)
end
|
#subclasses ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/puppet_x/puppetlabs/strings/yard/templates/default/hostclass/setup.rb', line 8
def subclasses
unless globals.hostsubclasses
globals.hostsubclasses = {}
list = run_verifier Registry.all(:hostclass)
list.each {|o| (globals.hostsubclasses[o.parent_class.path] ||= []) << o if o.parent_class }
end
@subclasses = globals.hostsubclasses[object.path]
return if @subclasses.nil? || @subclasses.empty?
erb(:subclasses)
end
|