Top Level Namespace
Defined Under Namespace
Modules: PuppetStrings
Instance Method Summary collapse
-
#alias_of ⇒ String
Renders the alias_of section.
-
#box_info ⇒ String
Renders the box_info section.
-
#classes ⇒ String
Renders the classes section.
-
#commands ⇒ String
Renders the commands section.
-
#confines ⇒ String
Renders the confines section.
-
#create_menu_lists ⇒ Array<Hash>
Creates the dynamic menu lists.
-
#data_types ⇒ String
Renders the data types section.
-
#defaults ⇒ String
Renders the defaults section.
-
#defined_types ⇒ String
Renders the defined types section.
- #description ⇒ Object
-
#enum ⇒ String
Renders the enum section.
-
#functions ⇒ String
Renders the functions section.
-
#generate_class_list ⇒ void
Generate a searchable Ruby class list in the output.
-
#generate_method_list ⇒ void
Generates the searchable Ruby method list.
-
#generate_puppet_class_list ⇒ void
Generates the searchable Puppet class list.
-
#generate_puppet_data_type_list ⇒ void
Generates the searchable Puppet data type list.
-
#generate_puppet_defined_type_list ⇒ void
Generates the searchable Puppet defined type list.
-
#generate_puppet_function_list ⇒ void
Generates the searchable Puppet function list.
-
#generate_puppet_plan_list ⇒ void
Generates the searchable Puppet Plan list.
-
#generate_puppet_provider_list ⇒ void
Generates the searchable Puppet provider list.
-
#generate_puppet_task_list ⇒ void
Generates the searchable Puppet Task list.
-
#generate_puppet_type_list ⇒ void
Generates the searchable Puppet resource type list.
-
#init ⇒ void
Initializes the template.
- #json ⇒ Object
-
#layout ⇒ String
Renders the layout section.
-
#menu_lists ⇒ Array<Hash] Returns the menu lists to use.
Gets the menu lists to use.
- #method_listing ⇒ Object
-
#objects ⇒ String
Renders the objects section.
-
#objects_by_letter(*types) ⇒ Hash
Builds a list of objects by letter.
-
#overload ⇒ String
Renders the overload section.
-
#param ⇒ Array<YARD::Tag>
Called to return parameter tags.
-
#parameters ⇒ String
Renders the parameters section.
-
#plans ⇒ String
Renders the plans section.
-
#properties ⇒ String
Renders the properties section.
-
#providers ⇒ String
Renders the providers section.
- #sort_listing(list) ⇒ Object
-
#tasks ⇒ String
Renders the tasks section.
-
#types ⇒ String
Renders the types section.
Instance Method Details
#alias_of ⇒ String
Renders the alias_of section.
9 10 11 12 13 14 15 16 17 |
# File 'lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/setup.rb', line 9 def alias_of # Properties are the same thing as parameters (from the documentation standpoint), # so reuse the same template but with a different title and data source. #@parameters = object.properties || [] #@parameters.sort_by! { |p| p.name } @tag_title = 'Alias of' @alias_of = object.alias_of erb(:alias_of) end |
#box_info ⇒ String
Renders the box_info section.
9 10 11 |
# File 'lib/puppet-strings/yard/templates/default/puppet_plan/html/setup.rb', line 9 def box_info erb(:box_info) end |
#classes ⇒ String
Renders the classes section.
161 162 163 164 165 |
# File 'lib/puppet-strings/yard/templates/default/layout/html/setup.rb', line 161 def classes @title = 'Puppet Class Listing A-Z' @objects_by_letter = objects_by_letter(:puppet_class) erb(:objects) end |
#commands ⇒ String
Renders the commands section.
25 26 27 28 29 |
# File 'lib/puppet-strings/yard/templates/default/puppet_provider/html/setup.rb', line 25 def commands @title = 'Commands' @collection = object.commands erb(:collection) end |
#confines ⇒ String
Renders the confines section.
9 10 11 12 13 |
# File 'lib/puppet-strings/yard/templates/default/puppet_provider/html/setup.rb', line 9 def confines @title = 'Confines' @collection = object.confines erb(:collection) end |
#create_menu_lists ⇒ Array<Hash>
Creates the dynamic menu lists.
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/puppet-strings/yard/templates/default/layout/html/setup.rb', line 76 def = [ { type: 'puppet_class', title: 'Puppet Classes', search_title: 'Puppet Classes' }, { type: 'puppet_data_type', title: 'Data Types', search_title: 'Data Types', }, { type: 'puppet_defined_type', title: 'Defined Types', search_title: 'Defined Types', }, { type: 'puppet_type', title: 'Resource Types', search_title: 'Resource Types' }, { type: 'puppet_provider', title: 'Providers', search_title: 'Providers' }, { type: 'puppet_function', title: 'Puppet Functions', search_title: 'Puppet Functions' }, { type: 'puppet_task', title: 'Puppet Tasks', search_totle: 'Puppet Tasks' }, { type: 'puppet_plan', title: 'Puppet Plans', search_totle: 'Puppet Plans' }, { type: 'class', title: 'Ruby Classes', search_title: 'Class List' }, { type: 'method', title: 'Ruby Methods', search_title: 'Method List' }, ] .delete_if { |e| YARD::Registry.all(e[:type].intern).empty? } # We must always return at least one group, so always keep the files list << { type: 'file', title: 'Files', search_title: 'File List' } if .empty? || !YARD::Registry.all(:file).empty? end |
#data_types ⇒ String
Renders the data types section.
169 170 171 172 173 |
# File 'lib/puppet-strings/yard/templates/default/layout/html/setup.rb', line 169 def data_types @title = 'Data Type Listing A-Z' @objects_by_letter = objects_by_letter(:puppet_data_type, :puppet_data_type_alias) erb(:objects) end |
#defaults ⇒ String
Renders the defaults section.
17 18 19 20 21 |
# File 'lib/puppet-strings/yard/templates/default/puppet_provider/html/setup.rb', line 17 def defaults @title = 'Default Provider For' @collection = object.defaults erb(:collection) end |
#defined_types ⇒ String
Renders the defined types section.
177 178 179 180 181 |
# File 'lib/puppet-strings/yard/templates/default/layout/html/setup.rb', line 177 def defined_types @title = 'Defined Type Listing A-Z' @objects_by_letter = objects_by_letter(:puppet_defined_type) erb(:objects) end |
#description ⇒ Object
11 12 13 |
# File 'lib/puppet-strings/yard/templates/default/puppet_task/html/setup.rb', line 11 def description json['description'] end |
#enum ⇒ String
Renders the enum section.
22 23 24 |
# File 'lib/puppet-strings/yard/templates/default/tags/setup.rb', line 22 def enum erb(:enum) end |
#functions ⇒ String
Renders the functions section.
201 202 203 204 205 |
# File 'lib/puppet-strings/yard/templates/default/layout/html/setup.rb', line 201 def functions @title = 'Puppet Function Listing A-Z' @objects_by_letter = objects_by_letter(:puppet_function) erb(:objects) end |
#generate_class_list ⇒ void
This method returns an undefined value.
Generate a searchable Ruby class list in the output.
68 69 70 71 72 73 |
# File 'lib/puppet-strings/yard/templates/default/fulldoc/html/setup.rb', line 68 def generate_class_list @items = .objects if .objects @list_title = 'Ruby Class List' @list_type = 'class' generate_list_contents end |
#generate_method_list ⇒ void
This method returns an undefined value.
Generates the searchable Ruby method list.
57 58 59 60 61 62 63 64 |
# File 'lib/puppet-strings/yard/templates/default/fulldoc/html/setup.rb', line 57 def generate_method_list @items = prune_method_listing(Registry.all(:method), false) @items = @items.reject {|m| m.name.to_s =~ /=$/ && m.is_attribute? } @items = @items.sort_by {|m| m.name.to_s } @list_title = 'Ruby Method List' @list_type = 'method' generate_list_contents end |
#generate_puppet_class_list ⇒ void
This method returns an undefined value.
Generates the searchable Puppet class list.
3 4 5 6 7 8 |
# File 'lib/puppet-strings/yard/templates/default/fulldoc/html/setup.rb', line 3 def generate_puppet_class_list @items = Registry.all(:puppet_class).sort_by { |c| c.name.to_s } @list_title = 'Puppet Class List' @list_type = 'puppet_class' generate_list_contents end |
#generate_puppet_data_type_list ⇒ void
This method returns an undefined value.
Generates the searchable Puppet data type list.
12 13 14 15 16 17 |
# File 'lib/puppet-strings/yard/templates/default/fulldoc/html/setup.rb', line 12 def generate_puppet_data_type_list @items = Registry.all(:puppet_data_type, :puppet_data_type_alias).sort_by {|dt| dt.name.to_s } @list_title = 'Data Type List' @list_type = 'puppet_data_type' generate_list_contents end |
#generate_puppet_defined_type_list ⇒ void
This method returns an undefined value.
Generates the searchable Puppet defined type list.
21 22 23 24 25 26 |
# File 'lib/puppet-strings/yard/templates/default/fulldoc/html/setup.rb', line 21 def generate_puppet_defined_type_list @items = Registry.all(:puppet_defined_type).sort_by {|dt| dt.name.to_s } @list_title = 'Defined Type List' @list_type = 'puppet_defined_type' generate_list_contents end |
#generate_puppet_function_list ⇒ void
This method returns an undefined value.
Generates the searchable Puppet function list.
48 49 50 51 52 53 |
# File 'lib/puppet-strings/yard/templates/default/fulldoc/html/setup.rb', line 48 def generate_puppet_function_list @items = Registry.all(:puppet_function).sort_by {|f| f.name.to_s } @list_title = 'Puppet Function List' @list_type = 'puppet_function' generate_list_contents end |
#generate_puppet_plan_list ⇒ void
This method returns an undefined value.
Generates the searchable Puppet Plan list.
86 87 88 89 90 91 |
# File 'lib/puppet-strings/yard/templates/default/fulldoc/html/setup.rb', line 86 def generate_puppet_plan_list @items = Registry.all(:puppet_plan).sort_by {|t| t.name.to_s } @list_title = 'Puppet Plan List' @list_type = 'puppet_plan' generate_list_contents end |
#generate_puppet_provider_list ⇒ void
This method returns an undefined value.
Generates the searchable Puppet provider list.
39 40 41 42 43 44 |
# File 'lib/puppet-strings/yard/templates/default/fulldoc/html/setup.rb', line 39 def generate_puppet_provider_list @items = Registry.all(:puppet_provider).sort_by {|p| p.name.to_s } @list_title = 'Provider List' @list_type = 'puppet_provider' generate_list_contents end |
#generate_puppet_task_list ⇒ void
This method returns an undefined value.
Generates the searchable Puppet Task list.
77 78 79 80 81 82 |
# File 'lib/puppet-strings/yard/templates/default/fulldoc/html/setup.rb', line 77 def generate_puppet_task_list @items = Registry.all(:puppet_task).sort_by {|t| t.name.to_s } @list_title = 'Puppet Task List' @list_type = 'puppet_task' generate_list_contents end |
#generate_puppet_type_list ⇒ void
This method returns an undefined value.
Generates the searchable Puppet resource type list.
30 31 32 33 34 35 |
# File 'lib/puppet-strings/yard/templates/default/fulldoc/html/setup.rb', line 30 def generate_puppet_type_list @items = Registry.all(:puppet_type).sort_by {|t| t.name.to_s } @list_title = 'Resource Type List' @list_type = 'puppet_type' generate_list_contents end |
#init ⇒ void
This method returns an undefined value.
Initializes the template.
3 4 5 6 7 8 9 10 11 |
# File 'lib/puppet-strings/yard/templates/default/layout/html/setup.rb', line 3 def init case object when '_index.html' @page_title = .title sections :layout, [:index, [:listing, [:classes, :data_types, :defined_types, :types, :providers, :functions, :tasks, :plans, :files, :objects]]] else super end end |
#json ⇒ Object
7 8 9 |
# File 'lib/puppet-strings/yard/templates/default/puppet_task/html/setup.rb', line 7 def json object.statement.json end |
#layout ⇒ String
Renders the layout section.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 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 |
# File 'lib/puppet-strings/yard/templates/default/layout/html/setup.rb', line 15 def layout @nav_url = url_for_list(!@file || .index ? .first[:type] : 'file') case object when nil, String @path = nil when @file @path = @file.path when !object.is_a?(YARD::CodeObjects::NamespaceObject) @path = object.parent.path @nav_url = url_for_list('class') when YARD::CodeObjects::ClassObject @path = object.path @nav_url = url_for_list('class') when PuppetStrings::Yard::CodeObjects::Class @nav_url = url_for_list('puppet_class') @page_title = "Puppet Class: #{object.name}" @path = object.path when PuppetStrings::Yard::CodeObjects::DataType, PuppetStrings::Yard::CodeObjects::DataTypeAlias @nav_url = url_for_list('puppet_data_type') @page_title = "Data Type: #{object.name}" @path = object.path when PuppetStrings::Yard::CodeObjects::DefinedType @nav_url = url_for_list('puppet_defined_type') @page_title = "Defined Type: #{object.name}" @path = object.path when PuppetStrings::Yard::CodeObjects::Type @nav_url = url_for_list('puppet_type') @page_title = "Resource Type: #{object.name}" @path = object.path when PuppetStrings::Yard::CodeObjects::Provider @nav_url = url_for_list('puppet_provider') @page_title = "Provider: #{object.name}" @path = object.path when PuppetStrings::Yard::CodeObjects::Function @nav_url = url_for_list('puppet_function') @page_title = "Puppet Function: #{object.name} (#{object.function_type})" @path = object.path when PuppetStrings::Yard::CodeObjects::Task @nav_url = url_for_list('puppet_task') @page_title = "Puppet Task: #{object.name}" @path = object.path when PuppetStrings::Yard::CodeObjects::Plan @nav_url = url_for_list('puppet_plan') @page_title = "Puppet Plan: #{object.name}" @path = object.path else @path = object.path end final_layout = erb(:layout) if @file && @file.name == 'README' PuppetStrings::Yard::Util.github_to_yard_links(final_layout) end final_layout end |
#menu_lists ⇒ Array<Hash] Returns the menu lists to use.
Gets the menu lists to use.
144 145 146 |
# File 'lib/puppet-strings/yard/templates/default/layout/html/setup.rb', line 144 def @@lists ||= .freeze end |
#method_listing ⇒ Object
7 8 9 |
# File 'lib/puppet-strings/yard/templates/default/puppet_data_type/html/setup.rb', line 7 def method_listing sort_listing(object.functions) end |
#objects ⇒ String
Renders the objects section.
225 226 227 228 229 |
# File 'lib/puppet-strings/yard/templates/default/layout/html/setup.rb', line 225 def objects @title = 'Ruby Namespace Listing A-Z' @objects_by_letter = objects_by_letter(:class, :module) erb(:objects) end |
#objects_by_letter(*types) ⇒ Hash
Builds a list of objects by letter.
151 152 153 154 155 156 157 |
# File 'lib/puppet-strings/yard/templates/default/layout/html/setup.rb', line 151 def objects_by_letter(*types) hash = {} objects = Registry.all(*types).sort_by {|o| o.name.to_s } objects = run_verifier(objects) objects.each {|o| (hash[o.name.to_s[0,1].upcase] ||= []) << o } hash end |
#overload ⇒ String
Renders the overload section.
16 17 18 |
# File 'lib/puppet-strings/yard/templates/default/tags/setup.rb', line 16 def overload erb(if object.type == :puppet_function then :puppet_overload else :overload end) end |
#param ⇒ Array<YARD::Tag>
Called to return parameter tags.
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/puppet-strings/yard/templates/default/tags/setup.rb', line 3 def param tag(:param) if object.type == :method || object.type == :puppet_class || object.type == :puppet_data_type || object.type == :puppet_defined_type || object.type == :puppet_function || object.type == :puppet_task || object.type == :puppet_plan end |
#parameters ⇒ String
Renders the parameters section.
17 18 19 20 21 22 |
# File 'lib/puppet-strings/yard/templates/default/puppet_task/html/setup.rb', line 17 def parameters @parameters = json['parameters'] || [] @parameters.to_a.sort! @tag_title = 'Parameters' erb(:parameters) end |
#plans ⇒ String
Renders the plans section.
217 218 219 220 221 |
# File 'lib/puppet-strings/yard/templates/default/layout/html/setup.rb', line 217 def plans @title = 'Puppet Plan Listing A-Z' @objects_by_letter = objects_by_letter(:puppet_plan) erb(:objects) end |
#properties ⇒ String
Renders the properties section.
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/puppet-strings/yard/templates/default/puppet_type/html/setup.rb', line 16 def properties # Properties are the same thing as parameters (from the documentation standpoint), # so reuse the same template but with a different title and data source. # # "checks" such as "creates" and "onlyif" are another type of property @parameters = (object.properties || []) + (object.checks || []) @parameters.sort_by! { |p| p.name } @tag_title = 'Properties' erb(:parameters) end |
#providers ⇒ String
Renders the providers section.
193 194 195 196 197 |
# File 'lib/puppet-strings/yard/templates/default/layout/html/setup.rb', line 193 def providers @title = 'Puppet Provider Listing A-Z' @objects_by_letter = objects_by_letter(:puppet_provider) erb(:objects) end |
#sort_listing(list) ⇒ Object
11 12 13 |
# File 'lib/puppet-strings/yard/templates/default/puppet_data_type/html/setup.rb', line 11 def sort_listing(list) list.sort_by {|o| [o.scope.to_s, o.name.to_s.downcase] } end |
#tasks ⇒ String
Renders the tasks section.
209 210 211 212 213 |
# File 'lib/puppet-strings/yard/templates/default/layout/html/setup.rb', line 209 def tasks @title = 'Puppet Task Listing A-Z' @objects_by_letter = objects_by_letter(:puppet_task) erb(:objects) end |
#types ⇒ String
Renders the types section.
185 186 187 188 189 |
# File 'lib/puppet-strings/yard/templates/default/layout/html/setup.rb', line 185 def types @title = 'Resource Type Listing A-Z' @objects_by_letter = objects_by_letter(:puppet_type) erb(:objects) end |