puppet-strings 0.4.0 → 0.99.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (168) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +122 -0
  3. data/COMMITTERS.md +185 -0
  4. data/CONTRIBUTING.md +89 -0
  5. data/Gemfile +38 -0
  6. data/JSON.md +511 -0
  7. data/LICENSE +13 -0
  8. data/README.md +416 -0
  9. data/Rakefile +49 -0
  10. data/lib/puppet-strings.rb +63 -0
  11. data/lib/puppet-strings/json.rb +49 -0
  12. data/lib/puppet-strings/tasks.rb +10 -0
  13. data/lib/puppet-strings/tasks/generate.rb +23 -0
  14. data/lib/puppet-strings/tasks/gh_pages.rb +43 -0
  15. data/lib/puppet-strings/yard.rb +96 -0
  16. data/lib/puppet-strings/yard/code_objects.rb +8 -0
  17. data/lib/puppet-strings/yard/code_objects/base.rb +14 -0
  18. data/lib/puppet-strings/yard/code_objects/class.rb +59 -0
  19. data/lib/puppet-strings/yard/code_objects/defined_type.rb +58 -0
  20. data/lib/puppet-strings/yard/code_objects/function.rb +93 -0
  21. data/lib/puppet-strings/yard/code_objects/group.rb +30 -0
  22. data/lib/puppet-strings/yard/code_objects/provider.rb +93 -0
  23. data/lib/puppet-strings/yard/code_objects/type.rb +146 -0
  24. data/lib/puppet-strings/yard/handlers.rb +16 -0
  25. data/lib/puppet-strings/yard/handlers/puppet/base.rb +44 -0
  26. data/lib/puppet-strings/yard/handlers/puppet/class_handler.rb +23 -0
  27. data/lib/puppet-strings/yard/handlers/puppet/defined_type_handler.rb +23 -0
  28. data/lib/puppet-strings/yard/handlers/puppet/function_handler.rb +42 -0
  29. data/lib/puppet-strings/yard/handlers/ruby/base.rb +38 -0
  30. data/lib/puppet-strings/yard/handlers/ruby/function_handler.rb +357 -0
  31. data/lib/puppet-strings/yard/handlers/ruby/provider_handler.rb +113 -0
  32. data/lib/puppet-strings/yard/handlers/ruby/type_handler.rb +194 -0
  33. data/lib/puppet-strings/yard/parsers.rb +7 -0
  34. data/lib/puppet-strings/yard/parsers/puppet/parser.rb +70 -0
  35. data/lib/puppet-strings/yard/parsers/puppet/statement.rb +146 -0
  36. data/lib/puppet-strings/yard/tags.rb +6 -0
  37. data/lib/puppet-strings/yard/tags/overload_tag.rb +109 -0
  38. data/lib/puppet-strings/yard/tags/parameter_directive.rb +24 -0
  39. data/lib/puppet-strings/yard/tags/property_directive.rb +24 -0
  40. data/lib/puppet-strings/yard/templates/default/fulldoc/html/full_list_puppet_class.erb +9 -0
  41. data/lib/puppet-strings/yard/templates/default/fulldoc/html/full_list_puppet_defined_type.erb +9 -0
  42. data/lib/puppet-strings/yard/templates/default/fulldoc/html/full_list_puppet_function.erb +10 -0
  43. data/lib/puppet-strings/yard/templates/default/fulldoc/html/full_list_puppet_provider.erb +10 -0
  44. data/lib/puppet-strings/yard/templates/default/fulldoc/html/full_list_puppet_type.erb +9 -0
  45. data/lib/puppet-strings/yard/templates/default/fulldoc/html/setup.rb +64 -0
  46. data/lib/puppet-strings/yard/templates/default/layout/html/objects.erb +35 -0
  47. data/lib/puppet-strings/yard/templates/default/layout/html/setup.rb +172 -0
  48. data/lib/puppet-strings/yard/templates/default/puppet_class/html/box_info.erb +26 -0
  49. data/lib/puppet-strings/yard/templates/default/puppet_class/html/header.erb +1 -0
  50. data/lib/puppet-strings/yard/templates/default/puppet_class/html/overview.erb +6 -0
  51. data/lib/puppet-strings/yard/templates/default/puppet_class/html/setup.rb +14 -0
  52. data/lib/puppet-strings/yard/templates/default/puppet_class/html/source.erb +12 -0
  53. data/lib/puppet-strings/yard/templates/default/puppet_defined_type/html/box_info.erb +10 -0
  54. data/lib/puppet-strings/yard/templates/default/puppet_defined_type/html/header.erb +1 -0
  55. data/lib/puppet-strings/yard/templates/default/puppet_defined_type/html/overview.erb +6 -0
  56. data/lib/puppet-strings/yard/templates/default/puppet_defined_type/html/setup.rb +5 -0
  57. data/lib/puppet-strings/yard/templates/default/puppet_defined_type/html/source.erb +12 -0
  58. data/lib/puppet-strings/yard/templates/default/puppet_function/html/box_info.erb +14 -0
  59. data/lib/puppet-strings/yard/templates/default/puppet_function/html/header.erb +1 -0
  60. data/lib/puppet-strings/yard/templates/default/puppet_function/html/overview.erb +18 -0
  61. data/lib/puppet-strings/yard/templates/default/puppet_function/html/setup.rb +5 -0
  62. data/lib/puppet-strings/yard/templates/default/puppet_function/html/source.erb +12 -0
  63. data/lib/puppet-strings/yard/templates/default/puppet_provider/html/box_info.erb +14 -0
  64. data/lib/puppet-strings/yard/templates/default/puppet_provider/html/collection.erb +10 -0
  65. data/lib/puppet-strings/yard/templates/default/puppet_provider/html/features.erb +12 -0
  66. data/lib/puppet-strings/yard/templates/default/puppet_provider/html/header.erb +1 -0
  67. data/lib/puppet-strings/yard/templates/default/puppet_provider/html/overview.erb +6 -0
  68. data/lib/puppet-strings/yard/templates/default/puppet_provider/html/setup.rb +29 -0
  69. data/lib/puppet-strings/yard/templates/default/puppet_type/html/box_info.erb +20 -0
  70. data/lib/puppet-strings/yard/templates/default/puppet_type/html/features.erb +13 -0
  71. data/lib/puppet-strings/yard/templates/default/puppet_type/html/header.erb +1 -0
  72. data/lib/puppet-strings/yard/templates/default/puppet_type/html/overview.erb +6 -0
  73. data/lib/puppet-strings/yard/templates/default/puppet_type/html/parameters.erb +35 -0
  74. data/lib/puppet-strings/yard/templates/default/puppet_type/html/setup.rb +32 -0
  75. data/lib/puppet-strings/yard/templates/default/tags/html/puppet_overload.erb +12 -0
  76. data/lib/puppet-strings/yard/templates/default/tags/setup.rb +15 -0
  77. data/lib/puppet/application/strings.rb +1 -0
  78. data/lib/puppet/face/strings.rb +80 -39
  79. data/spec/acceptance/emit_json_options.rb +41 -0
  80. data/spec/acceptance/lib/util.rb +15 -0
  81. data/spec/acceptance/running_strings_generate.rb +54 -0
  82. data/spec/fixtures/acceptance/modules/test/functions/add.pp +9 -0
  83. data/spec/fixtures/acceptance/modules/test/lib/puppet/functions/4x_function.rb +5 -0
  84. data/spec/fixtures/acceptance/modules/test/lib/puppet/parser/functions/function3x.rb +2 -0
  85. data/spec/fixtures/acceptance/modules/test/lib/puppet/provider/server/linux.rb +9 -0
  86. data/spec/fixtures/acceptance/modules/test/lib/puppet/type/database.rb +15 -0
  87. data/spec/fixtures/acceptance/modules/test/manifests/init.pp +27 -0
  88. data/spec/fixtures/acceptance/modules/test/manifests/triple_nested_classes.pp +27 -0
  89. data/spec/fixtures/acceptance/modules/test/metadata.json +6 -0
  90. data/spec/fixtures/unit/json/output.json +348 -0
  91. data/spec/fixtures/unit/json/output_without_puppet_function.json +301 -0
  92. data/spec/spec_helper.rb +21 -0
  93. data/spec/spec_helper_acceptance.rb +27 -0
  94. data/spec/unit/puppet-strings/json_spec.rb +136 -0
  95. data/spec/unit/puppet-strings/yard/handlers/puppet/class_handler_spec.rb +155 -0
  96. data/spec/unit/puppet-strings/yard/handlers/puppet/defined_type_handler_spec.rb +155 -0
  97. data/spec/unit/puppet-strings/yard/handlers/puppet/function_handler_spec.rb +169 -0
  98. data/spec/unit/puppet-strings/yard/handlers/ruby/function_handler_spec.rb +613 -0
  99. data/spec/unit/puppet-strings/yard/handlers/ruby/provider_handler_spec.rb +90 -0
  100. data/spec/unit/puppet-strings/yard/handlers/ruby/type_handler_spec.rb +214 -0
  101. data/spec/unit/puppet-strings/yard/parsers/puppet/parser_spec.rb +171 -0
  102. metadata +115 -92
  103. data/lib/puppet-strings/rake_tasks.rb +0 -18
  104. data/lib/puppet_x/puppetlabs/strings.rb +0 -64
  105. data/lib/puppet_x/puppetlabs/strings/actions.rb +0 -92
  106. data/lib/puppet_x/puppetlabs/strings/pops/yard_statement.rb +0 -79
  107. data/lib/puppet_x/puppetlabs/strings/pops/yard_transformer.rb +0 -47
  108. data/lib/puppet_x/puppetlabs/strings/util.rb +0 -65
  109. data/lib/puppet_x/puppetlabs/strings/yard/code_objects/defined_type_object.rb +0 -33
  110. data/lib/puppet_x/puppetlabs/strings/yard/code_objects/host_class_object.rb +0 -22
  111. data/lib/puppet_x/puppetlabs/strings/yard/code_objects/method_object.rb +0 -62
  112. data/lib/puppet_x/puppetlabs/strings/yard/code_objects/provider_object.rb +0 -24
  113. data/lib/puppet_x/puppetlabs/strings/yard/code_objects/puppet_namespace_object.rb +0 -48
  114. data/lib/puppet_x/puppetlabs/strings/yard/code_objects/type_object.rb +0 -42
  115. data/lib/puppet_x/puppetlabs/strings/yard/core_ext/yard.rb +0 -40
  116. data/lib/puppet_x/puppetlabs/strings/yard/handlers/base.rb +0 -13
  117. data/lib/puppet_x/puppetlabs/strings/yard/handlers/defined_type_handler.rb +0 -31
  118. data/lib/puppet_x/puppetlabs/strings/yard/handlers/heredoc_helper.rb +0 -80
  119. data/lib/puppet_x/puppetlabs/strings/yard/handlers/host_class_handler.rb +0 -42
  120. data/lib/puppet_x/puppetlabs/strings/yard/handlers/provider_handler.rb +0 -95
  121. data/lib/puppet_x/puppetlabs/strings/yard/handlers/puppet_3x_function_handler.rb +0 -54
  122. data/lib/puppet_x/puppetlabs/strings/yard/handlers/puppet_4x_function_handler.rb +0 -234
  123. data/lib/puppet_x/puppetlabs/strings/yard/handlers/type_handler.rb +0 -295
  124. data/lib/puppet_x/puppetlabs/strings/yard/json_registry_store.rb +0 -85
  125. data/lib/puppet_x/puppetlabs/strings/yard/monkey_patches.rb +0 -68
  126. data/lib/puppet_x/puppetlabs/strings/yard/parser.rb +0 -30
  127. data/lib/puppet_x/puppetlabs/strings/yard/tags/directives.rb +0 -9
  128. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/definedtype/html/docstring.erb +0 -34
  129. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/definedtype/html/header.erb +0 -5
  130. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/definedtype/html/parameter_details.erb +0 -6
  131. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/definedtype/html/setup.rb +0 -1
  132. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/definedtype/setup.rb +0 -49
  133. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/fulldoc/html/full_list_class.erb +0 -2
  134. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/fulldoc/html/full_list_puppet_manifest.erb +0 -1
  135. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/fulldoc/html/full_list_puppet_plugin.erb +0 -21
  136. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/fulldoc/html/full_list_puppet_provider.erb +0 -1
  137. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/fulldoc/html/full_list_puppet_type.erb +0 -1
  138. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/fulldoc/html/setup.rb +0 -82
  139. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/hostclass/html/box_info.erb +0 -22
  140. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/hostclass/html/setup.rb +0 -1
  141. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/hostclass/html/subclasses.erb +0 -4
  142. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/hostclass/setup.rb +0 -21
  143. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/html_helper.rb +0 -139
  144. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/layout/html/setup.rb +0 -18
  145. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/method_details/html/header.erb +0 -17
  146. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/method_details/setup.rb +0 -21
  147. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/method_details/text/header.erb +0 -2
  148. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/provider/html/command_details.erb +0 -8
  149. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/provider/html/confine_details.erb +0 -10
  150. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/provider/html/default_details.erb +0 -10
  151. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/provider/html/docstring.erb +0 -34
  152. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/provider/html/feature_details.erb +0 -10
  153. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/provider/html/header.erb +0 -5
  154. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/provider/html/setup.rb +0 -1
  155. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/provider/setup.rb +0 -50
  156. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/puppetnamespace/html/box_info.erb +0 -11
  157. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/puppetnamespace/html/header.erb +0 -5
  158. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/puppetnamespace/html/method_details_list.erb +0 -53
  159. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/puppetnamespace/html/method_summary.erb +0 -20
  160. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/puppetnamespace/html/setup.rb +0 -1
  161. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/puppetnamespace/setup.rb +0 -91
  162. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/template_helper.rb +0 -192
  163. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/type/html/docstring.erb +0 -34
  164. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/type/html/header.erb +0 -5
  165. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/type/html/parameter_details.erb +0 -12
  166. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/type/html/provider_details.erb +0 -10
  167. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/type/html/setup.rb +0 -1
  168. data/lib/puppet_x/puppetlabs/strings/yard/templates/default/type/setup.rb +0 -55
@@ -1,85 +0,0 @@
1
- module YARD
2
-
3
- class JsonRegistryStore < RegistryStore
4
- def save(merge=true, file=nil)
5
- super
6
-
7
- @serializer = Serializers::JsonSerializer.new(@file)
8
-
9
- sdb = Registry.single_object_db
10
- if sdb == true || sdb == nil
11
- serialize_output_schema(@store)
12
- else
13
- values(false).each do |object|
14
- serialize_output_schema(object)
15
- end
16
- end
17
- true
18
- end
19
-
20
- # @param obj [Hash] A hash representing the registry or part of the
21
- # registry.
22
- def serialize_output_schema(obj)
23
-
24
- schema = {
25
- :puppet_functions => [],
26
- :puppet_providers => [],
27
- :puppet_classes => [],
28
- :defined_types => [],
29
- :puppet_types => [],
30
- }
31
-
32
- schema[:puppet_functions] += obj.select do |key, val|
33
- val.type == :method and (val['puppet_4x_function'] or
34
- val['puppet_3x_function'])
35
- end.values
36
-
37
- schema[:puppet_classes] += obj.select do |key, val|
38
- val.type == :hostclass
39
- end.values
40
-
41
- schema[:defined_types] += obj.select do |key, val|
42
- val.type == :definedtype
43
- end.values
44
-
45
- schema[:puppet_providers] += obj.select do |key, val|
46
- val.type == :provider
47
- end.values
48
-
49
- schema[:puppet_types] += obj.select do |key, val|
50
- val.type == :type
51
- end.values
52
-
53
- @serializer.serialize(schema.to_json)
54
- end
55
- end
56
-
57
- # Override the serializer because it puts the data at a wacky path and, more
58
- # importantly, marshals the data with a bunch of non-printable characters.
59
- module Serializers
60
- class JsonSerializer < YardocSerializer
61
-
62
- def initialize o
63
- super
64
- @options = {
65
- :basepath => '.',
66
- :extension => 'json',
67
- }
68
- @extension = 'json'
69
- @basepath = '.'
70
- end
71
- def serialize(data)
72
-
73
- if YARD::Config.options[:emit_json]
74
- path = YARD::Config.options[:emit_json]
75
- log.debug "Serializing json to #{path}"
76
- File.open!(path, "wb") {|f| f.write data }
77
- end
78
- if YARD::Config.options[:emit_json_stdout]
79
- puts data
80
- end
81
- end
82
- end
83
- end
84
-
85
- end
@@ -1,68 +0,0 @@
1
- require 'yard'
2
- require File.join(File.dirname(__FILE__), './json_registry_store')
3
-
4
- # TODO: As far as I can tell, monkeypatching is the officially recommended way
5
- # to extend these tools to cover custom usecases. Follow up on the YARD mailing
6
- # list or IRC to see if there is a better way.
7
-
8
- class YARD::CLI::Yardoc
9
- def all_objects
10
- YARD::Registry.all(:root, :module, :class, :type, :provider, :puppetnamespace, :hostclass, :definedtype)
11
- end
12
- end
13
-
14
- class YARD::CLI::Stats
15
- def stats_for_hostclasses
16
- output 'Puppet Classes', *type_statistics(:hostclass)
17
- end
18
-
19
- def stats_for_definedtypes
20
- output 'Puppet Defined Types', *type_statistics(:definedtype)
21
- end
22
-
23
- def stats_for_puppet_types
24
- output 'Puppet Types', *type_statistics(:type)
25
- end
26
-
27
- def stats_for_puppet_provider
28
- output 'Puppet Providers', *type_statistics(:provider)
29
- end
30
- end
31
-
32
- class YARD::Logger
33
- def show_progress
34
- return false if YARD.ruby18? # threading is too ineffective for progress support
35
- return false if YARD.windows? # windows has poor ANSI support
36
- return false unless io.tty? # no TTY support on IO
37
- # Here is the actual monkey patch. A simple fix to an inverted conditional.
38
- # Without this Pry is unusable for debugging as the progress bar goes
39
- # craaaaaaaazy.
40
- return false unless level > INFO # no progress in verbose/debug modes
41
- @show_progress
42
- end
43
-
44
- # Redirect Yard command line warnings to a log file called .yardwarns
45
- # Yard warnings may be irrelevant, spurious, or may not conform with our
46
- # styling and UX design. They are also printed on stdout by default.
47
- def warn warning
48
- f = File.new '.yardwarns', 'a'
49
- f.write warning
50
- f.close()
51
- end
52
- end
53
-
54
-
55
- # 15:04:42 radens | lsegal: where would you tell yard to use your custom RegistryStore?
56
- # 15:09:54 @lsegal | https://github.com/lsegal/yard/blob/master/lib/yard/registry.rb#L428-L435
57
- # 15:09:54 @lsegal | you would set that attr on Registry
58
- # 15:09:54 @lsegal | it might be worth expanding that API to swap out the store class used
59
- # 15:10:49 @lsegal | specifically
60
- # | https://github.com/lsegal/yard/blob/master/lib/yard/registry.rb#L190 and
61
- # | replace RegistryStore there with a storage_class attr
62
- module YARD::Registry
63
- class << self
64
- def clear
65
- self.thread_local_store = YARD::JsonRegistryStore.new
66
- end
67
- end
68
- end
@@ -1,30 +0,0 @@
1
- require 'yard'
2
- require 'puppet/pops'
3
-
4
- require 'puppet_x/puppetlabs/strings'
5
- require 'puppet_x/puppetlabs/strings//pops/yard_transformer'
6
-
7
- class PuppetX::PuppetLabs::Strings::YARD::PuppetParser < YARD::Parser::Base
8
- attr_reader :file, :source
9
-
10
- def initialize(source, filename)
11
- @source = source
12
- @file = filename
13
-
14
- @parser = Puppet::Pops::Parser::Parser.new()
15
- @transformer = PuppetX::PuppetLabs::Strings::Pops::YARDTransformer.new()
16
- end
17
-
18
- def parse
19
- @parse_result ||= @parser.parse_string(source)
20
- self
21
- end
22
-
23
- def enumerator
24
- statements = @transformer.transform(@parse_result)
25
-
26
- # Ensure an array is returned and prune any nil values.
27
- Array(statements).compact.reverse
28
- end
29
-
30
- end
@@ -1,9 +0,0 @@
1
- require 'puppet_x/puppetlabs/strings/yard/core_ext/yard'
2
- # Creates a new code object based on the directive
3
- class PuppetX::PuppetLabs::Strings::YARD::Tags::PuppetTypeParameterDirective < YARD::Tags::Directive
4
- def call
5
- return if object.nil?
6
- object.parameters << ([tag.text, tag.types].flatten)
7
- object.parameter_details << {:name => tag.name, :desc => tag.text, :exists? => true, :puppet_type => true}
8
- end
9
- end
@@ -1,34 +0,0 @@
1
- <div class="docstring">
2
- <div class="discussion">
3
- <p><%= htmlify(@class_details[:desc]) %></p>
4
- </div>
5
- </div>
6
- <div class="tags">
7
- <% if @class_details[:examples] != {}%>
8
- <div class="examples">
9
- <p class="tag_title">Examples:</p>
10
- <% @class_details[:examples].each do |title, text| %>
11
- <div class="inline"><p><%= title %></p></div>
12
- <pre class="example code"><code><span><%= text %></span></code></pre>
13
- <% end %>
14
- </div>
15
- <% end %>
16
- <% if @class_details[:since] %>
17
- <p class="tag_title">Since:</p>
18
- <ul class="since">
19
- <li>
20
- <div class="inline">
21
- <p><%= @class_details[:since] %></p>
22
- </div>
23
- </li>
24
- </ul>
25
- <% end %>
26
- <% if @class_details[:return] %>
27
- <p class="tag_title">Return:</p>
28
- <ul class="return">
29
- <li>
30
- <%= @html_helper.generate_return_types(@class_details[:return][1], @class_details[:return][0]) %>
31
- </li>
32
- </ul>
33
- <% end %>
34
- </div>
@@ -1,5 +0,0 @@
1
- <div class='module_header'>
2
- <h1>
3
- <%= @header_text %>
4
- </h1>
5
- </div>
@@ -1,6 +0,0 @@
1
- <h2>Parameter Summary</h2>
2
- <div class="tags">
3
- <ul class="param">
4
- <%= @html_helper.generate_parameters(@param_details, object) %>
5
- </ul>
6
- </div>
@@ -1,49 +0,0 @@
1
- include T('default/module')
2
-
3
- require File.join(File.dirname(__FILE__),'../html_helper')
4
- require File.join(File.dirname(__FILE__),'../template_helper')
5
-
6
- def init
7
- sections :header, :box_info, :pre_docstring, :docstring, :parameter_details
8
-
9
- @template_helper = TemplateHelper.new
10
- @html_helper = HTMLHelper.new
11
- @template_helper.check_parameters_match_docs object
12
- params = object.parameters.map { |param| param.first }
13
- param_tags = object.tags.find_all{ |tag| tag.tag_name == "param"}
14
- param_details = @template_helper.extract_param_details(params, param_tags) unless params.nil?
15
- @template_helper.check_types_match_docs object, param_details
16
-
17
- end
18
-
19
- def parameter_details
20
- return if object.parameters.empty?
21
-
22
- param_tags = object.tags.find_all{ |tag| tag.tag_name == "param"}
23
- params = object.parameters
24
-
25
- @param_details = []
26
-
27
- @param_details = @template_helper.extract_param_details(params, param_tags, true)
28
-
29
- erb(:parameter_details)
30
- end
31
-
32
- def header
33
- if object.type == :hostclass
34
- @header_text = "Puppet Class: #{object.name}"
35
- elsif object.type == :definedtype
36
- @header_text = "Puppet Defined Type: #{object.name}"
37
- else
38
- @header_text = "#{object.name}"
39
- end
40
-
41
- erb(:header)
42
- end
43
-
44
- def docstring
45
-
46
- @class_details = @template_helper.extract_tag_data(object)
47
-
48
- erb(:docstring)
49
- end
@@ -1,2 +0,0 @@
1
- <li><%= link_object(Registry.root, Registry.root.title, nil, false) %></li>
2
- <%= namespace_list %>
@@ -1 +0,0 @@
1
- <%= namespace_list(:namespace_types => [:hostclass, :definedtype]) %>
@@ -1,21 +0,0 @@
1
- <% unless P(:root, 'Puppet3xFunctions').is_a?(CodeObjects::Proxy) %>
2
- <li>
3
- <a class='toggle'></a>
4
- <%= link_object(P(:root, 'Puppet3xFunctions'), 'Puppet 3x Functions', nil, false) %>
5
- <small class='search_info'>Puppet3xFunctions</small>
6
- </li>
7
- <ul>
8
- <%= namespace_list(:root => P(:root,'Puppet3xFunctions'), :namespace_types => [:puppetnamespace, :method]) %>
9
- </ul>
10
- <% end %>
11
-
12
- <% unless P(:root, 'Puppet4xFunctions').is_a?(CodeObjects::Proxy) %>
13
- <li>
14
- <a class='toggle'></a>
15
- <%= link_object(P(:root, 'Puppet4xFunctions'), 'Puppet 4x Functions', nil, false) %>
16
- <small class='search_info'>Puppet4xFunctions</small>
17
- </li>
18
- <ul>
19
- <%= namespace_list(:root => P(:root,'Puppet4xFunctions'), :namespace_types => [:puppetnamespace, :method]) %>
20
- </ul>
21
- <% end %>
@@ -1 +0,0 @@
1
- <%= namespace_list(:namespace_types => [:provider]) %>
@@ -1 +0,0 @@
1
- <%= namespace_list(:namespace_types => [:type]) %>
@@ -1,82 +0,0 @@
1
- def generate_class_list
2
- @items = options.objects.select{|o| [:module, :class, :root].include? o.type} if options.objects
3
- @list_title = "Class List"
4
- @list_type = "class"
5
- generate_list_contents
6
- end
7
-
8
- def generate_puppet_manifest_list
9
- @items = options.objects.select{|o| [:hostclass, :definedtype].include? o.type} if options.objects
10
- @list_title = "Puppet Manifest List"
11
- # This is important. It causes some YARD JavaScript bits to hook in and
12
- # perform the correct formatting.
13
- @list_class = "class"
14
- @list_type = "puppet_manifest"
15
- generate_list_contents
16
- end
17
-
18
- def generate_puppet_plugin_list
19
- # NOTE: PuppetNamaspaceObject might eventually be used for more than just a
20
- # container for plugins...
21
- @items = options.objects.select{|o| [:puppetnamespace].include? o.type} if options.objects
22
- @list_title = "Puppet Plugin List"
23
- # This is important. It causes some YARD JavaScript bits to hook in and
24
- # perform the correct formatting.
25
- @list_class = "class"
26
- @list_type = "puppet_plugin"
27
- generate_list_contents
28
- end
29
-
30
- def generate_puppet_type_list
31
- @items = options.objects.select{|o| [:type].include? o.type} if options.objects
32
- @list_title = "Puppet Type List"
33
- @list_type = "puppet_type"
34
- generate_list_contents
35
- end
36
-
37
- def generate_puppet_provider_list
38
- @items = options.objects.select{|o| [:provider].include? o.type} if options.objects
39
- @list_title = "Puppet Provider List"
40
- @list_type = "puppet_provider"
41
- generate_list_contents
42
- end
43
-
44
- # A hacked version of class_list that can be instructed to only display certain
45
- # namespace types. This allows us to separate Puppet bits from Ruby bits.
46
- def namespace_list(opts = {})
47
- o = {
48
- :root => Registry.root,
49
- :namespace_types => [:module, :class]
50
- }.merge(opts)
51
-
52
- root = o[:root]
53
- namespace_types = o[:namespace_types]
54
-
55
- out = ""
56
- children = run_verifier(root.children)
57
- if root == Registry.root
58
- children += @items.select {|o| o.namespace.is_a?(CodeObjects::Proxy) }
59
- end
60
- children.reject {|c| c.nil? }.sort_by {|child| child.path }.map do |child|
61
- if namespace_types.include? child.type
62
- if child.namespace.is_a?(CodeObjects::Proxy)
63
- name = child.path
64
- elsif child.is_a?(PuppetX::PuppetLabs::Strings::YARD::CodeObjects::TypeObject) || child.is_a?(PuppetX::PuppetLabs::Strings::YARD::CodeObjects::ProviderObject)
65
- name = child.header_name
66
- else
67
- name = child.name
68
- end
69
- has_children = child.respond_to?(:children) && run_verifier(child.children).any? {|o| o.is_a?(CodeObjects::NamespaceObject) }
70
- out << "<li>"
71
- out << "<a class='toggle'></a> " if has_children
72
- out << linkify(child, name)
73
- out << " &lt; #{child.superclass.name}" if child.is_a?(CodeObjects::ClassObject) && child.superclass
74
- out << "<small class='search_info'>"
75
- out << child.namespace.title
76
- out << "</small>"
77
- out << "</li>"
78
- out << "<ul>#{namespace_list(:root => child, :namespace_types => namespace_types)}</ul>" if has_children
79
- end
80
- end
81
- out
82
- end
@@ -1,22 +0,0 @@
1
- <% n = 1 %>
2
- <dl class="box">
3
- <% if object.parent_class %>
4
- <dt class="r<%=n%>">Inherits:</dt>
5
- <dd class="r<%=n%>">
6
- <span class="inheritName"><%= linkify object.parent_class, object.parent_class.path %></span>
7
- <ul class="fullTree">
8
- <% object.inheritance_tree.reverse.each_with_index do |obj, i| %>
9
- <li class="next"><%= obj == object ? obj.path : linkify(obj, obj.path) %></li>
10
- <% end %>
11
- </ul>
12
- <a href="#" class="inheritanceTree">show all</a>
13
- </dd>
14
- <% n = 2 %>
15
- <% end %>
16
- <% unless object.root? %>
17
- <dt class="r<%=n%> last">Defined in:</dt>
18
- <dd class="r<%=n%> last"><%= erb(:defines) %></dd>
19
- <% end %>
20
- </dl>
21
- <div class="clear"></div>
22
-
@@ -1 +0,0 @@
1
- include T('default/definedtype/html')
@@ -1,4 +0,0 @@
1
- <div id="subclasses">
2
- <h2>Direct Known Subclasses</h2>
3
- <p class="children"><%= @subclasses.map {|child| linkify(child, child.path) }.join(", ") %></p>
4
- </div>