puppet-strings 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/puppet-strings/rake_tasks.rb +18 -0
- data/lib/puppet/application/strings.rb +4 -0
- data/lib/puppet/face/strings.rb +64 -0
- data/lib/puppet/feature/rgen.rb +3 -0
- data/lib/puppet/feature/yard.rb +3 -0
- data/lib/puppet_x/puppetlabs/strings.rb +64 -0
- data/lib/puppet_x/puppetlabs/strings/actions.rb +92 -0
- data/lib/puppet_x/puppetlabs/strings/pops/yard_statement.rb +79 -0
- data/lib/puppet_x/puppetlabs/strings/pops/yard_transformer.rb +47 -0
- data/lib/puppet_x/puppetlabs/strings/util.rb +65 -0
- data/lib/puppet_x/puppetlabs/strings/yard/code_objects/defined_type_object.rb +33 -0
- data/lib/puppet_x/puppetlabs/strings/yard/code_objects/host_class_object.rb +22 -0
- data/lib/puppet_x/puppetlabs/strings/yard/code_objects/method_object.rb +62 -0
- data/lib/puppet_x/puppetlabs/strings/yard/code_objects/provider_object.rb +24 -0
- data/lib/puppet_x/puppetlabs/strings/yard/code_objects/puppet_namespace_object.rb +48 -0
- data/lib/puppet_x/puppetlabs/strings/yard/code_objects/type_object.rb +42 -0
- data/lib/puppet_x/puppetlabs/strings/yard/core_ext/yard.rb +40 -0
- data/lib/puppet_x/puppetlabs/strings/yard/handlers/base.rb +13 -0
- data/lib/puppet_x/puppetlabs/strings/yard/handlers/defined_type_handler.rb +31 -0
- data/lib/puppet_x/puppetlabs/strings/yard/handlers/heredoc_helper.rb +80 -0
- data/lib/puppet_x/puppetlabs/strings/yard/handlers/host_class_handler.rb +42 -0
- data/lib/puppet_x/puppetlabs/strings/yard/handlers/provider_handler.rb +95 -0
- data/lib/puppet_x/puppetlabs/strings/yard/handlers/puppet_3x_function_handler.rb +54 -0
- data/lib/puppet_x/puppetlabs/strings/yard/handlers/puppet_4x_function_handler.rb +234 -0
- data/lib/puppet_x/puppetlabs/strings/yard/handlers/type_handler.rb +295 -0
- data/lib/puppet_x/puppetlabs/strings/yard/json_registry_store.rb +85 -0
- data/lib/puppet_x/puppetlabs/strings/yard/monkey_patches.rb +68 -0
- data/lib/puppet_x/puppetlabs/strings/yard/parser.rb +30 -0
- data/lib/puppet_x/puppetlabs/strings/yard/tags/directives.rb +9 -0
- data/lib/puppet_x/puppetlabs/strings/yard/templates/default/definedtype/html/docstring.erb +34 -0
- data/lib/puppet_x/puppetlabs/strings/yard/templates/default/definedtype/html/header.erb +5 -0
- data/lib/puppet_x/puppetlabs/strings/yard/templates/default/definedtype/html/parameter_details.erb +6 -0
- data/lib/puppet_x/puppetlabs/strings/yard/templates/default/definedtype/html/setup.rb +1 -0
- data/lib/puppet_x/puppetlabs/strings/yard/templates/default/definedtype/setup.rb +49 -0
- data/lib/puppet_x/puppetlabs/strings/yard/templates/default/fulldoc/html/full_list_class.erb +2 -0
- data/lib/puppet_x/puppetlabs/strings/yard/templates/default/fulldoc/html/full_list_puppet_manifest.erb +1 -0
- data/lib/puppet_x/puppetlabs/strings/yard/templates/default/fulldoc/html/full_list_puppet_plugin.erb +21 -0
- data/lib/puppet_x/puppetlabs/strings/yard/templates/default/fulldoc/html/full_list_puppet_provider.erb +1 -0
- data/lib/puppet_x/puppetlabs/strings/yard/templates/default/fulldoc/html/full_list_puppet_type.erb +1 -0
- data/lib/puppet_x/puppetlabs/strings/yard/templates/default/fulldoc/html/setup.rb +82 -0
- data/lib/puppet_x/puppetlabs/strings/yard/templates/default/hostclass/html/box_info.erb +22 -0
- data/lib/puppet_x/puppetlabs/strings/yard/templates/default/hostclass/html/setup.rb +1 -0
- data/lib/puppet_x/puppetlabs/strings/yard/templates/default/hostclass/html/subclasses.erb +4 -0
- data/lib/puppet_x/puppetlabs/strings/yard/templates/default/hostclass/setup.rb +21 -0
- data/lib/puppet_x/puppetlabs/strings/yard/templates/default/html_helper.rb +139 -0
- data/lib/puppet_x/puppetlabs/strings/yard/templates/default/layout/html/setup.rb +18 -0
- data/lib/puppet_x/puppetlabs/strings/yard/templates/default/method_details/html/header.erb +17 -0
- data/lib/puppet_x/puppetlabs/strings/yard/templates/default/method_details/setup.rb +21 -0
- data/lib/puppet_x/puppetlabs/strings/yard/templates/default/method_details/text/header.erb +2 -0
- data/lib/puppet_x/puppetlabs/strings/yard/templates/default/provider/html/command_details.erb +8 -0
- data/lib/puppet_x/puppetlabs/strings/yard/templates/default/provider/html/confine_details.erb +10 -0
- data/lib/puppet_x/puppetlabs/strings/yard/templates/default/provider/html/default_details.erb +10 -0
- data/lib/puppet_x/puppetlabs/strings/yard/templates/default/provider/html/docstring.erb +34 -0
- data/lib/puppet_x/puppetlabs/strings/yard/templates/default/provider/html/feature_details.erb +10 -0
- data/lib/puppet_x/puppetlabs/strings/yard/templates/default/provider/html/header.erb +5 -0
- data/lib/puppet_x/puppetlabs/strings/yard/templates/default/provider/html/setup.rb +1 -0
- data/lib/puppet_x/puppetlabs/strings/yard/templates/default/provider/setup.rb +50 -0
- data/lib/puppet_x/puppetlabs/strings/yard/templates/default/puppetnamespace/html/box_info.erb +11 -0
- data/lib/puppet_x/puppetlabs/strings/yard/templates/default/puppetnamespace/html/header.erb +5 -0
- data/lib/puppet_x/puppetlabs/strings/yard/templates/default/puppetnamespace/html/method_details_list.erb +53 -0
- data/lib/puppet_x/puppetlabs/strings/yard/templates/default/puppetnamespace/html/method_summary.erb +20 -0
- data/lib/puppet_x/puppetlabs/strings/yard/templates/default/puppetnamespace/html/setup.rb +1 -0
- data/lib/puppet_x/puppetlabs/strings/yard/templates/default/puppetnamespace/setup.rb +91 -0
- data/lib/puppet_x/puppetlabs/strings/yard/templates/default/template_helper.rb +192 -0
- data/lib/puppet_x/puppetlabs/strings/yard/templates/default/type/html/docstring.erb +34 -0
- data/lib/puppet_x/puppetlabs/strings/yard/templates/default/type/html/header.erb +5 -0
- data/lib/puppet_x/puppetlabs/strings/yard/templates/default/type/html/parameter_details.erb +12 -0
- data/lib/puppet_x/puppetlabs/strings/yard/templates/default/type/html/provider_details.erb +10 -0
- data/lib/puppet_x/puppetlabs/strings/yard/templates/default/type/html/setup.rb +1 -0
- data/lib/puppet_x/puppetlabs/strings/yard/templates/default/type/setup.rb +55 -0
- metadata +142 -0
|
@@ -0,0 +1,85 @@
|
|
|
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
|
|
@@ -0,0 +1,68 @@
|
|
|
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
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
|
@@ -0,0 +1,34 @@
|
|
|
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>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
include T('default/module/html')
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= namespace_list(:namespace_types => [:hostclass, :definedtype]) %>
|
data/lib/puppet_x/puppetlabs/strings/yard/templates/default/fulldoc/html/full_list_puppet_plugin.erb
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
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 %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= namespace_list(:namespace_types => [:provider]) %>
|
data/lib/puppet_x/puppetlabs/strings/yard/templates/default/fulldoc/html/full_list_puppet_type.erb
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= namespace_list(:namespace_types => [:type]) %>
|
|
@@ -0,0 +1,82 @@
|
|
|
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 << " < #{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
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
include T('default/definedtype/html')
|