puppet-strings 2.2.0 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (150) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +87 -1
  3. data/CONTRIBUTING.md +32 -2
  4. data/README.md +81 -17
  5. data/lib/puppet-strings.rb +5 -3
  6. data/lib/puppet-strings/describe.rb +2 -0
  7. data/lib/puppet-strings/json.rb +4 -0
  8. data/lib/puppet-strings/markdown.rb +13 -9
  9. data/lib/puppet-strings/markdown/base.rb +30 -3
  10. data/lib/puppet-strings/markdown/data_type.rb +36 -0
  11. data/lib/puppet-strings/markdown/data_types.rb +43 -0
  12. data/lib/puppet-strings/markdown/defined_type.rb +2 -0
  13. data/lib/puppet-strings/markdown/defined_types.rb +3 -1
  14. data/lib/puppet-strings/markdown/function.rb +9 -7
  15. data/lib/puppet-strings/markdown/functions.rb +3 -1
  16. data/lib/puppet-strings/markdown/puppet_class.rb +2 -0
  17. data/lib/puppet-strings/markdown/puppet_classes.rb +3 -1
  18. data/lib/puppet-strings/markdown/puppet_plan.rb +2 -0
  19. data/lib/puppet-strings/markdown/puppet_plans.rb +3 -1
  20. data/lib/puppet-strings/markdown/puppet_task.rb +2 -0
  21. data/lib/puppet-strings/markdown/puppet_tasks.rb +3 -1
  22. data/lib/puppet-strings/markdown/resource_type.rb +21 -2
  23. data/lib/puppet-strings/markdown/resource_types.rb +3 -1
  24. data/lib/puppet-strings/markdown/table_of_contents.rb +4 -1
  25. data/lib/puppet-strings/markdown/templates/classes_and_defines.erb +18 -6
  26. data/lib/puppet-strings/markdown/templates/data_type.erb +101 -0
  27. data/lib/puppet-strings/markdown/templates/data_type_function.erb +67 -0
  28. data/lib/puppet-strings/markdown/templates/function.erb +10 -1
  29. data/lib/puppet-strings/markdown/templates/puppet_task.erb +1 -1
  30. data/lib/puppet-strings/markdown/templates/resource_type.erb +35 -13
  31. data/lib/puppet-strings/markdown/templates/table_of_contents.erb +6 -6
  32. data/lib/puppet-strings/monkey_patches/display_object_command.rb +2 -0
  33. data/lib/puppet-strings/tasks.rb +2 -0
  34. data/lib/puppet-strings/tasks/generate.rb +5 -2
  35. data/lib/puppet-strings/tasks/gh_pages.rb +3 -0
  36. data/lib/puppet-strings/version.rb +3 -1
  37. data/lib/puppet-strings/yard.rb +19 -0
  38. data/lib/puppet-strings/yard/code_objects.rb +4 -0
  39. data/lib/puppet-strings/yard/code_objects/base.rb +2 -0
  40. data/lib/puppet-strings/yard/code_objects/class.rb +5 -3
  41. data/lib/puppet-strings/yard/code_objects/data_type.rb +102 -0
  42. data/lib/puppet-strings/yard/code_objects/data_type_alias.rb +60 -0
  43. data/lib/puppet-strings/yard/code_objects/defined_type.rb +5 -3
  44. data/lib/puppet-strings/yard/code_objects/function.rb +9 -6
  45. data/lib/puppet-strings/yard/code_objects/group.rb +3 -0
  46. data/lib/puppet-strings/yard/code_objects/plan.rb +5 -3
  47. data/lib/puppet-strings/yard/code_objects/provider.rb +6 -0
  48. data/lib/puppet-strings/yard/code_objects/task.rb +3 -1
  49. data/lib/puppet-strings/yard/code_objects/type.rb +49 -5
  50. data/lib/puppet-strings/yard/handlers.rb +4 -0
  51. data/lib/puppet-strings/yard/handlers/helpers.rb +2 -0
  52. data/lib/puppet-strings/yard/handlers/json/base.rb +2 -0
  53. data/lib/puppet-strings/yard/handlers/json/task_handler.rb +2 -0
  54. data/lib/puppet-strings/yard/handlers/puppet/base.rb +3 -0
  55. data/lib/puppet-strings/yard/handlers/puppet/class_handler.rb +2 -0
  56. data/lib/puppet-strings/yard/handlers/puppet/data_type_alias_handler.rb +26 -0
  57. data/lib/puppet-strings/yard/handlers/puppet/defined_type_handler.rb +2 -0
  58. data/lib/puppet-strings/yard/handlers/puppet/function_handler.rb +3 -1
  59. data/lib/puppet-strings/yard/handlers/puppet/plan_handler.rb +2 -0
  60. data/lib/puppet-strings/yard/handlers/ruby/base.rb +7 -2
  61. data/lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb +409 -0
  62. data/lib/puppet-strings/yard/handlers/ruby/function_handler.rb +9 -9
  63. data/lib/puppet-strings/yard/handlers/ruby/provider_handler.rb +13 -0
  64. data/lib/puppet-strings/yard/handlers/ruby/rsapi_handler.rb +6 -3
  65. data/lib/puppet-strings/yard/handlers/ruby/type_base.rb +25 -12
  66. data/lib/puppet-strings/yard/handlers/ruby/type_extras_handler.rb +6 -3
  67. data/lib/puppet-strings/yard/handlers/ruby/type_handler.rb +18 -1
  68. data/lib/puppet-strings/yard/parsers.rb +2 -0
  69. data/lib/puppet-strings/yard/parsers/json/parser.rb +3 -1
  70. data/lib/puppet-strings/yard/parsers/json/task_statement.rb +2 -0
  71. data/lib/puppet-strings/yard/parsers/puppet/parser.rb +11 -2
  72. data/lib/puppet-strings/yard/parsers/puppet/statement.rb +29 -0
  73. data/lib/puppet-strings/yard/tags.rb +4 -0
  74. data/lib/puppet-strings/yard/tags/enum_tag.rb +14 -0
  75. data/lib/puppet-strings/yard/tags/factory.rb +18 -0
  76. data/lib/puppet-strings/yard/tags/overload_tag.rb +5 -2
  77. data/lib/puppet-strings/yard/tags/parameter_directive.rb +5 -4
  78. data/lib/puppet-strings/yard/tags/property_directive.rb +5 -4
  79. data/lib/puppet-strings/yard/tags/summary_tag.rb +2 -0
  80. data/lib/puppet-strings/yard/templates/default/fulldoc/html/full_list_puppet_data_type.erb +10 -0
  81. data/lib/puppet-strings/yard/templates/default/fulldoc/html/setup.rb +9 -0
  82. data/lib/puppet-strings/yard/templates/default/layout/html/objects.erb +2 -0
  83. data/lib/puppet-strings/yard/templates/default/layout/html/setup.rb +18 -1
  84. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/box_info.erb +10 -0
  85. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/header.erb +1 -0
  86. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/method_details_list.erb +6 -0
  87. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/note.erb +6 -0
  88. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/overview.erb +6 -0
  89. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/setup.rb +13 -0
  90. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/source.erb +12 -0
  91. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/summary.erb +4 -0
  92. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/todo.erb +6 -0
  93. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/alias_of.erb +10 -0
  94. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/box_info.erb +10 -0
  95. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/header.erb +1 -0
  96. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/note.erb +6 -0
  97. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/overview.erb +6 -0
  98. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/setup.rb +17 -0
  99. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/source.erb +12 -0
  100. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/summary.erb +4 -0
  101. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/todo.erb +6 -0
  102. data/lib/puppet-strings/yard/templates/default/puppet_function/html/setup.rb +1 -1
  103. data/lib/puppet-strings/yard/templates/default/puppet_type/html/setup.rb +3 -1
  104. data/lib/puppet-strings/yard/templates/default/tags/html/enum.erb +17 -0
  105. data/lib/puppet-strings/yard/templates/default/tags/setup.rb +7 -0
  106. data/lib/puppet-strings/yard/util.rb +7 -4
  107. data/lib/puppet/application/strings.rb +2 -0
  108. data/lib/puppet/face/strings.rb +7 -4
  109. data/lib/puppet/feature/rgen.rb +2 -0
  110. data/lib/puppet/feature/yard.rb +2 -0
  111. metadata +35 -45
  112. data/Gemfile +0 -38
  113. data/HISTORY.md +0 -218
  114. data/JSON.md +0 -802
  115. data/Rakefile +0 -98
  116. data/codecov.yml +0 -3
  117. data/misc/ANNOUNCEMENT_TEMPLATE.md +0 -40
  118. data/spec/acceptance/emit_json_options.rb +0 -71
  119. data/spec/acceptance/generate_markdown_spec.rb +0 -49
  120. data/spec/acceptance/lib/util.rb +0 -163
  121. data/spec/acceptance/running_strings_generate.rb +0 -54
  122. data/spec/fixtures/acceptance/modules/test/functions/add.pp +0 -9
  123. data/spec/fixtures/acceptance/modules/test/lib/puppet/functions/4x_function.rb +0 -5
  124. data/spec/fixtures/acceptance/modules/test/lib/puppet/parser/functions/function3x.rb +0 -2
  125. data/spec/fixtures/acceptance/modules/test/lib/puppet/provider/server/linux.rb +0 -9
  126. data/spec/fixtures/acceptance/modules/test/lib/puppet/type/database.rb +0 -15
  127. data/spec/fixtures/acceptance/modules/test/manifests/init.pp +0 -27
  128. data/spec/fixtures/acceptance/modules/test/manifests/triple_nested_classes.pp +0 -27
  129. data/spec/fixtures/acceptance/modules/test/metadata.json +0 -6
  130. data/spec/fixtures/unit/markdown/output.md +0 -508
  131. data/spec/fixtures/unit/markdown/output_with_plan.md +0 -542
  132. data/spec/spec_helper.rb +0 -46
  133. data/spec/spec_helper_acceptance.rb +0 -28
  134. data/spec/unit/puppet-strings/describe_spec.rb +0 -141
  135. data/spec/unit/puppet-strings/json_spec.rb +0 -283
  136. data/spec/unit/puppet-strings/markdown/base_spec.rb +0 -146
  137. data/spec/unit/puppet-strings/markdown_spec.rb +0 -296
  138. data/spec/unit/puppet-strings/yard/code_objects/task_spec.rb +0 -92
  139. data/spec/unit/puppet-strings/yard/handlers/json/task_handler_spec.rb +0 -116
  140. data/spec/unit/puppet-strings/yard/handlers/puppet/class_handler_spec.rb +0 -217
  141. data/spec/unit/puppet-strings/yard/handlers/puppet/defined_type_handler_spec.rb +0 -231
  142. data/spec/unit/puppet-strings/yard/handlers/puppet/function_handler_spec.rb +0 -315
  143. data/spec/unit/puppet-strings/yard/handlers/ruby/function_handler_spec.rb +0 -729
  144. data/spec/unit/puppet-strings/yard/handlers/ruby/provider_handler_spec.rb +0 -139
  145. data/spec/unit/puppet-strings/yard/handlers/ruby/rsapi_handler_spec.rb +0 -235
  146. data/spec/unit/puppet-strings/yard/handlers/ruby/type_handler_spec.rb +0 -295
  147. data/spec/unit/puppet-strings/yard/parsers/json/parser_spec.rb +0 -72
  148. data/spec/unit/puppet-strings/yard/parsers/json/task_statement_spec.rb +0 -56
  149. data/spec/unit/puppet-strings/yard/parsers/puppet/parser_spec.rb +0 -209
  150. data/spec/unit/puppet-strings/yard/util_spec.rb +0 -48
@@ -1,7 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # The module for custom YARD tags.
2
4
  module PuppetStrings::Yard::Tags
5
+ require 'puppet-strings/yard/tags/factory'
3
6
  require 'puppet-strings/yard/tags/parameter_directive'
4
7
  require 'puppet-strings/yard/tags/property_directive'
5
8
  require 'puppet-strings/yard/tags/overload_tag'
6
9
  require 'puppet-strings/yard/tags/summary_tag'
10
+ require 'puppet-strings/yard/tags/enum_tag'
7
11
  end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'yard/tags/option_tag'
4
+
5
+ # Implements an enum tag for describing enumerated value data types
6
+
7
+ class PuppetStrings::Yard::Tags::EnumTag < YARD::Tags::OptionTag
8
+ # Registers the tag with YARD.
9
+ # @return [void]
10
+ def self.register!
11
+ YARD::Tags::Library.define_tag("puppet.enum", :enum, :with_enums)
12
+ YARD::Tags::Library.visible_tags.place(:enum).after(:option)
13
+ end
14
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'yard/tags/default_factory'
4
+ require 'puppet-strings/yard/tags/enum_tag'
5
+
6
+ class PuppetStrings::Yard::Tags::Factory < YARD::Tags::DefaultFactory
7
+
8
+ # Parses tag text and creates a new enum tag type. Modeled after
9
+ # the parse_tag_with_options method in YARD::Tags::DefaultFactory.
10
+ #
11
+ # @param tag_name the name of the tag to parse
12
+ # @param [String] text the raw tag text
13
+ # @return [Tag] a tag object with the tag_name, name, and nested Tag as type
14
+ def parse_tag_with_enums(tag_name, text)
15
+ name, text = *extract_name_from_text(text)
16
+ PuppetStrings::Yard::Tags::EnumTag.new(tag_name, name, parse_tag_with_name(tag_name, text))
17
+ end
18
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Implements an overload tag for Puppet functions
2
4
  #
3
5
  # This differs from Yard's overload tag in that the signatures are formatted according to Puppet language rules.
@@ -22,7 +24,7 @@ class PuppetStrings::Yard::Tags::OverloadTag < YARD::Tags::Tag
22
24
  args = @parameters.map do |parameter|
23
25
  name, default = parameter
24
26
  tag = tags.find { |t| t.name == name } if tags
25
- type = tag && tag.types ? "#{tag.type} " : 'Any '
27
+ type = tag&.types ? "#{tag.type} " : 'Any '
26
28
  prefix = "#{name[0]}" if name.start_with?('*', '&')
27
29
  name = name[1..-1] if prefix
28
30
  default = " = #{default}" if default
@@ -75,6 +77,7 @@ class PuppetStrings::Yard::Tags::OverloadTag < YARD::Tags::Tag
75
77
  # @return Returns what the method call on the object would return.
76
78
  def method_missing(method_name, *args, &block)
77
79
  return object.send(method_name, *args, &block) if object.respond_to? method_name
80
+
78
81
  super
79
82
  end
80
83
 
@@ -100,7 +103,7 @@ class PuppetStrings::Yard::Tags::OverloadTag < YARD::Tags::Tag
100
103
  hash[:text] = text if text
101
104
  hash[:signature] = signature
102
105
  hash[:docstring] = PuppetStrings::Yard::Util.docstring_to_hash(docstring) if !docstring.blank?
103
- defaults = Hash[*parameters.select{ |p| !p[1].nil? }.flatten]
106
+ defaults = Hash[*parameters.reject{ |p| p[1].nil? }.flatten]
104
107
  hash[:defaults] = defaults unless defaults.empty?
105
108
  hash[:types] = types if types
106
109
  hash[:name] = name if name
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'puppet-strings/yard/code_objects'
2
4
 
3
5
  # Implements a parameter directive (e.g. #@!puppet.type.param) for documenting Puppet resource types.
@@ -5,14 +7,13 @@ class PuppetStrings::Yard::Tags::ParameterDirective < YARD::Tags::Directive
5
7
  # Called to invoke the directive.
6
8
  # @return [void]
7
9
  def call
8
- return unless object && object.respond_to?(:add_parameter)
10
+ return unless object&.respond_to?(:add_parameter)
11
+
9
12
  # Add a parameter to the resource
10
13
  parameter = PuppetStrings::Yard::CodeObjects::Type::Parameter.new(tag.name, tag.text)
11
- if tag.types
12
- tag.types.each do |value|
14
+ tag.types&.each do |value|
13
15
  parameter.add(value)
14
16
  end
15
- end
16
17
  object.add_parameter parameter
17
18
  end
18
19
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'puppet-strings/yard/code_objects'
2
4
 
3
5
  # Implements a parameter directive (e.g. #@!puppet.type.property) for documenting Puppet resource types.
@@ -5,14 +7,13 @@ class PuppetStrings::Yard::Tags::PropertyDirective < YARD::Tags::Directive
5
7
  # Called to invoke the directive.
6
8
  # @return [void]
7
9
  def call
8
- return unless object && object.respond_to?(:add_property)
10
+ return unless object&.respond_to?(:add_property)
11
+
9
12
  # Add a property to the resource
10
13
  property = PuppetStrings::Yard::CodeObjects::Type::Property.new(tag.name, tag.text)
11
- if tag.types
12
- tag.types.each do |value|
14
+ tag.types&.each do |value|
13
15
  property.add(value)
14
16
  end
15
- end
16
17
  object.add_property property
17
18
  end
18
19
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Implements a summary tag for general purpose short descriptions
2
4
 
3
5
  class PuppetStrings::Yard::Tags::SummaryTag < YARD::Tags::Tag
@@ -0,0 +1,10 @@
1
+ <% even = false %>
2
+ <% @items.each do |item| %>
3
+ <li id="object_<%=item.path%>" class="<%= even ? 'even' : 'odd' %>">
4
+ <div class="item">
5
+ <%= linkify item, h(item.name(false)) %>
6
+ <% if item.type == :puppet_data_type_alias %><small>Alias</small><% end %>
7
+ </div>
8
+ </li>
9
+ <% even = !even %>
10
+ <% end %>
@@ -7,6 +7,15 @@ def generate_puppet_class_list
7
7
  generate_list_contents
8
8
  end
9
9
 
10
+ # Generates the searchable Puppet data type list.
11
+ # @return [void]
12
+ def generate_puppet_data_type_list
13
+ @items = Registry.all(:puppet_data_type, :puppet_data_type_alias).sort_by {|dt| dt.name.to_s }
14
+ @list_title = 'Data Type List'
15
+ @list_type = 'puppet_data_type'
16
+ generate_list_contents
17
+ end
18
+
10
19
  # Generates the searchable Puppet defined type list.
11
20
  # @return [void]
12
21
  def generate_puppet_defined_type_list
@@ -23,6 +23,8 @@
23
23
  <small>(Resource type: <%= obj.type_name %>)</small>
24
24
  <% elsif obj.type == :puppet_function %>
25
25
  <small>(<%= obj.function_type %>)</small>
26
+ <% elsif obj.type == :puppet_data_type_alias %>
27
+ <small>(Alias)</small>
26
28
  <% end %>
27
29
  </li>
28
30
  <% end %>
@@ -4,7 +4,7 @@ def init
4
4
  case object
5
5
  when '_index.html'
6
6
  @page_title = options.title
7
- sections :layout, [:index, [:listing, [:classes, :defined_types, :types, :providers, :functions, :tasks, :plans, :files, :objects]]]
7
+ sections :layout, [:index, [:listing, [:classes, :data_types, :defined_types, :types, :providers, :functions, :tasks, :plans, :files, :objects]]]
8
8
  else
9
9
  super
10
10
  end
@@ -30,6 +30,10 @@ def layout
30
30
  @nav_url = url_for_list('puppet_class')
31
31
  @page_title = "Puppet Class: #{object.name}"
32
32
  @path = object.path
33
+ when PuppetStrings::Yard::CodeObjects::DataType, PuppetStrings::Yard::CodeObjects::DataTypeAlias
34
+ @nav_url = url_for_list('puppet_data_type')
35
+ @page_title = "Data Type: #{object.name}"
36
+ @path = object.path
33
37
  when PuppetStrings::Yard::CodeObjects::DefinedType
34
38
  @nav_url = url_for_list('puppet_defined_type')
35
39
  @page_title = "Defined Type: #{object.name}"
@@ -76,6 +80,11 @@ def create_menu_lists
76
80
  title: 'Puppet Classes',
77
81
  search_title: 'Puppet Classes'
78
82
  },
83
+ {
84
+ type: 'puppet_data_type',
85
+ title: 'Data Types',
86
+ search_title: 'Data Types',
87
+ },
79
88
  {
80
89
  type: 'puppet_defined_type',
81
90
  title: 'Defined Types',
@@ -155,6 +164,14 @@ def classes
155
164
  erb(:objects)
156
165
  end
157
166
 
167
+ # Renders the data types section.
168
+ # @return [String] Returns the rendered section.
169
+ def data_types
170
+ @title = 'Data Type Listing A-Z'
171
+ @objects_by_letter = objects_by_letter(:puppet_data_type, :puppet_data_type_alias)
172
+ erb(:objects)
173
+ end
174
+
158
175
  # Renders the defined types section.
159
176
  # @return [String] Returns the rendered section.
160
177
  def defined_types
@@ -0,0 +1,10 @@
1
+ <div class="box_info">
2
+ <dl>
3
+ <dt>Defined in:</dt>
4
+ <dd>
5
+ <%= object.file %><% if object.files.size > 1 %><span class="defines">,<br />
6
+ <%= object.files[1..-1].map {|f| f.first }.join(",<br /> ") %></div>
7
+ <% end %>
8
+ </dd>
9
+ </dl>
10
+ </div>
@@ -0,0 +1 @@
1
+ <h1>Puppet Data Type: <%= object.name %></h1>
@@ -0,0 +1,6 @@
1
+ <h2>Data Type Functions</h2>
2
+ <% method_listing.each_with_index do |meth, i| %>
3
+ <div id="<%= meth.name %>-instance_method"><h3><%= meth.name %></h3>
4
+ <%= yieldall :object => meth, :owner => object, :index => i %>
5
+ </div>
6
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <% object.tags(:note).each do |tag| %>
2
+ <div class="note notetag">
3
+ <strong>Note:</strong>
4
+ <%= htmlify_line tag.text %>
5
+ </div>
6
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <h2>Overview</h2>
2
+ <div class="docstring">
3
+ <div class="discussion">
4
+ <%= htmlify(object.docstring) %>
5
+ </div>
6
+ </div>
@@ -0,0 +1,13 @@
1
+ # Initializes the template.
2
+ # @return [void]
3
+ def init
4
+ sections :header, :box_info, :summary, :overview, :note, :todo, T('tags'), :method_details_list, [T('method_details')], :source
5
+ end
6
+
7
+ def method_listing
8
+ sort_listing(object.functions)
9
+ end
10
+
11
+ def sort_listing(list)
12
+ list.sort_by {|o| [o.scope.to_s, o.name.to_s.downcase] }
13
+ end
@@ -0,0 +1,12 @@
1
+ <div class="method_details_list">
2
+ <table class="source_code">
3
+ <tr>
4
+ <td>
5
+ <pre class="lines"><%= "\n\n\n" %><%= h format_lines(object) %></pre>
6
+ </td>
7
+ <td>
8
+ <pre class="code"><span class="info file"># File '<%= h object.file %>'<% if object.line %>, line <%= object.line %><% end %></span><%= "\n\n" %><%= html_syntax_highlight object.source %></pre>
9
+ </td>
10
+ </tr>
11
+ </table>
12
+ </div>
@@ -0,0 +1,4 @@
1
+ <% if object.docstring.has_tag?(:summary) %>
2
+ <h2>Summary</h2>
3
+ <%= object.docstring.tag(:summary).text %>
4
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <% object.tags(:todo).each do |tag| %>
2
+ <div class="note todo">
3
+ <strong>TODO:</strong>
4
+ <%= htmlify_line tag.text %>
5
+ </div>
6
+ <% end %>
@@ -0,0 +1,10 @@
1
+ <% if @alias_of && !@alias_of.empty? %>
2
+ <div class="tags">
3
+ <p class="tag_title"><%= @tag_title %></p>
4
+ <div class="docstring">
5
+ <div class="discussion">
6
+ <pre class="code"><span class="info"><%= @alias_of %></span></pre>
7
+ </div>
8
+ </div>
9
+ </div>
10
+ <% end %>
@@ -0,0 +1,10 @@
1
+ <div class="box_info">
2
+ <dl>
3
+ <dt>Defined in:</dt>
4
+ <dd>
5
+ <%= object.file %><% if object.files.size > 1 %><span class="defines">,<br />
6
+ <%= object.files[1..-1].map {|f| f.first }.join(",<br /> ") %></div>
7
+ <% end %>
8
+ </dd>
9
+ </dl>
10
+ </div>
@@ -0,0 +1 @@
1
+ <h1>Puppet Data Type Alias: <%= object.name %></h1>
@@ -0,0 +1,6 @@
1
+ <% object.tags(:note).each do |tag| %>
2
+ <div class="note notetag">
3
+ <strong>Note:</strong>
4
+ <%= htmlify_line tag.text %>
5
+ </div>
6
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <h2>Overview</h2>
2
+ <div class="docstring">
3
+ <div class="discussion">
4
+ <%= htmlify(object.docstring) %>
5
+ </div>
6
+ </div>
@@ -0,0 +1,17 @@
1
+ # Initializes the template.
2
+ # @return [void]
3
+ def init
4
+ sections :header, :box_info, :summary, :overview, :alias_of, :note, :todo, T('tags'), :source
5
+ end
6
+
7
+ # Renders the alias_of section.
8
+ # @return [String] Returns the rendered section.
9
+ def alias_of
10
+ # Properties are the same thing as parameters (from the documentation standpoint),
11
+ # so reuse the same template but with a different title and data source.
12
+ #@parameters = object.properties || []
13
+ #@parameters.sort_by! { |p| p.name }
14
+ @tag_title = 'Alias of'
15
+ @alias_of = object.alias_of
16
+ erb(:alias_of)
17
+ end
@@ -0,0 +1,12 @@
1
+ <div class="method_details_list">
2
+ <table class="source_code">
3
+ <tr>
4
+ <td>
5
+ <pre class="lines"><%= "\n\n\n" %><%= h format_lines(object) %></pre>
6
+ </td>
7
+ <td>
8
+ <pre class="code"><span class="info file"># File '<%= h object.file %>'<% if object.line %>, line <%= object.line %><% end %></span><%= "\n\n" %><%= html_syntax_highlight object.source %></pre>
9
+ </td>
10
+ </tr>
11
+ </table>
12
+ </div>
@@ -0,0 +1,4 @@
1
+ <% if object.docstring.has_tag?(:summary) %>
2
+ <h2>Summary</h2>
3
+ <%= object.docstring.tag(:summary).text %>
4
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <% object.tags(:todo).each do |tag| %>
2
+ <div class="note todo">
3
+ <strong>TODO:</strong>
4
+ <%= htmlify_line tag.text %>
5
+ </div>
6
+ <% end %>
@@ -1,5 +1,5 @@
1
1
  # Initializes the template.
2
2
  # @return [void]
3
3
  def init
4
- sections :header, :box_info, :summary, :overview, :note, :todo, [T('tags'), :source]
4
+ sections :header, :box_info, :summary, :overview, [:note, :todo, T('tags'), :source]
5
5
  end
@@ -16,7 +16,9 @@ end
16
16
  def properties
17
17
  # Properties are the same thing as parameters (from the documentation standpoint),
18
18
  # so reuse the same template but with a different title and data source.
19
- @parameters = object.properties || []
19
+ #
20
+ # "checks" such as "creates" and "onlyif" are another type of property
21
+ @parameters = (object.properties || []) + (object.checks || [])
20
22
  @parameters.sort_by! { |p| p.name }
21
23
  @tag_title = 'Properties'
22
24
  erb(:parameters)
@@ -0,0 +1,17 @@
1
+ <% if object.has_tag?(:enum) %>
2
+ <% object.parameters.each do |param, default| %>
3
+ <% tags = object.tags(:enum).select {|x| x.name.to_s == param.to_s.sub(/^\*+|:$/, '') } %>
4
+ <% next if tags.empty? %>
5
+ <p class="tag_title">Enum Options (<tt><%= param %></tt>):</p>
6
+ <ul class="option">
7
+ <% for tag in tags %>
8
+ <li>
9
+ <span class="name"><%= tag.pair.name %></span>
10
+ <% if tag.pair.text && tag.pair.text =~ /\S/ %>
11
+ &mdash; <%= htmlify_line(tag.pair.text) %>
12
+ <% end %>
13
+ </li>
14
+ <% end %>
15
+ </ul>
16
+ <% end %>
17
+ <% end %>
@@ -4,6 +4,7 @@ def param
4
4
  tag(:param) if
5
5
  object.type == :method ||
6
6
  object.type == :puppet_class ||
7
+ object.type == :puppet_data_type ||
7
8
  object.type == :puppet_defined_type ||
8
9
  object.type == :puppet_function ||
9
10
  object.type == :puppet_task ||
@@ -15,3 +16,9 @@ end
15
16
  def overload
16
17
  erb(if object.type == :puppet_function then :puppet_overload else :overload end)
17
18
  end
19
+
20
+ # Renders the enum section.
21
+ # @return [String] Returns the rendered section.
22
+ def enum
23
+ erb(:enum)
24
+ end