openvox-strings 5.0.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/CHANGELOG.md +407 -0
- data/LICENSE +177 -0
- data/README.md +116 -0
- data/lib/openvox-strings/describe.rb +75 -0
- data/lib/openvox-strings/json.rb +33 -0
- data/lib/openvox-strings/markdown/base.rb +236 -0
- data/lib/openvox-strings/markdown/data_type.rb +39 -0
- data/lib/openvox-strings/markdown/defined_type.rb +20 -0
- data/lib/openvox-strings/markdown/function.rb +59 -0
- data/lib/openvox-strings/markdown/helpers.rb +21 -0
- data/lib/openvox-strings/markdown/puppet_class.rb +20 -0
- data/lib/openvox-strings/markdown/puppet_plan.rb +20 -0
- data/lib/openvox-strings/markdown/puppet_task.rb +29 -0
- data/lib/openvox-strings/markdown/resource_type.rb +56 -0
- data/lib/openvox-strings/markdown/templates/classes_and_defines.erb +94 -0
- data/lib/openvox-strings/markdown/templates/data_type.erb +101 -0
- data/lib/openvox-strings/markdown/templates/data_type_function.erb +67 -0
- data/lib/openvox-strings/markdown/templates/function.erb +106 -0
- data/lib/openvox-strings/markdown/templates/puppet_task.erb +28 -0
- data/lib/openvox-strings/markdown/templates/resource_type.erb +156 -0
- data/lib/openvox-strings/markdown/templates/table_of_contents.erb +26 -0
- data/lib/openvox-strings/markdown.rb +81 -0
- data/lib/openvox-strings/monkey_patches/display_object_command.rb +16 -0
- data/lib/openvox-strings/tasks/generate.rb +54 -0
- data/lib/openvox-strings/tasks/gh_pages.rb +72 -0
- data/lib/openvox-strings/tasks/validate.rb +42 -0
- data/lib/openvox-strings/tasks.rb +14 -0
- data/lib/openvox-strings/version.rb +5 -0
- data/lib/openvox-strings/yard/code_objects/base.rb +16 -0
- data/lib/openvox-strings/yard/code_objects/class.rb +60 -0
- data/lib/openvox-strings/yard/code_objects/data_type.rb +102 -0
- data/lib/openvox-strings/yard/code_objects/data_type_alias.rb +60 -0
- data/lib/openvox-strings/yard/code_objects/defined_type.rb +59 -0
- data/lib/openvox-strings/yard/code_objects/function.rb +106 -0
- data/lib/openvox-strings/yard/code_objects/group.rb +33 -0
- data/lib/openvox-strings/yard/code_objects/plan.rb +59 -0
- data/lib/openvox-strings/yard/code_objects/provider.rb +98 -0
- data/lib/openvox-strings/yard/code_objects/task.rb +69 -0
- data/lib/openvox-strings/yard/code_objects/type.rb +196 -0
- data/lib/openvox-strings/yard/code_objects.rb +14 -0
- data/lib/openvox-strings/yard/handlers/helpers.rb +10 -0
- data/lib/openvox-strings/yard/handlers/json/base.rb +8 -0
- data/lib/openvox-strings/yard/handlers/json/task_handler.rb +34 -0
- data/lib/openvox-strings/yard/handlers/puppet/base.rb +52 -0
- data/lib/openvox-strings/yard/handlers/puppet/class_handler.rb +29 -0
- data/lib/openvox-strings/yard/handlers/puppet/data_type_alias_handler.rb +26 -0
- data/lib/openvox-strings/yard/handlers/puppet/defined_type_handler.rb +29 -0
- data/lib/openvox-strings/yard/handlers/puppet/function_handler.rb +54 -0
- data/lib/openvox-strings/yard/handlers/puppet/plan_handler.rb +29 -0
- data/lib/openvox-strings/yard/handlers/ruby/base.rb +55 -0
- data/lib/openvox-strings/yard/handlers/ruby/data_type_handler.rb +411 -0
- data/lib/openvox-strings/yard/handlers/ruby/function_handler.rb +386 -0
- data/lib/openvox-strings/yard/handlers/ruby/provider_handler.rb +127 -0
- data/lib/openvox-strings/yard/handlers/ruby/rsapi_handler.rb +157 -0
- data/lib/openvox-strings/yard/handlers/ruby/type_base.rb +146 -0
- data/lib/openvox-strings/yard/handlers/ruby/type_extras_handler.rb +65 -0
- data/lib/openvox-strings/yard/handlers/ruby/type_handler.rb +105 -0
- data/lib/openvox-strings/yard/handlers.rb +28 -0
- data/lib/openvox-strings/yard/parsers/json/parser.rb +38 -0
- data/lib/openvox-strings/yard/parsers/json/task_statement.rb +37 -0
- data/lib/openvox-strings/yard/parsers/puppet/parser.rb +89 -0
- data/lib/openvox-strings/yard/parsers/puppet/statement.rb +182 -0
- data/lib/openvox-strings/yard/parsers.rb +14 -0
- data/lib/openvox-strings/yard/tags/enum_tag.rb +13 -0
- data/lib/openvox-strings/yard/tags/factory.rb +18 -0
- data/lib/openvox-strings/yard/tags/overload_tag.rb +112 -0
- data/lib/openvox-strings/yard/tags/parameter_directive.rb +25 -0
- data/lib/openvox-strings/yard/tags/property_directive.rb +25 -0
- data/lib/openvox-strings/yard/tags/summary_tag.rb +10 -0
- data/lib/openvox-strings/yard/tags.rb +11 -0
- data/lib/openvox-strings/yard/templates/default/fulldoc/html/css/common.css +8 -0
- data/lib/openvox-strings/yard/templates/default/fulldoc/html/full_list_puppet_class.erb +9 -0
- data/lib/openvox-strings/yard/templates/default/fulldoc/html/full_list_puppet_data_type.erb +10 -0
- data/lib/openvox-strings/yard/templates/default/fulldoc/html/full_list_puppet_defined_type.erb +9 -0
- data/lib/openvox-strings/yard/templates/default/fulldoc/html/full_list_puppet_function.erb +10 -0
- data/lib/openvox-strings/yard/templates/default/fulldoc/html/full_list_puppet_plan.erb +9 -0
- data/lib/openvox-strings/yard/templates/default/fulldoc/html/full_list_puppet_provider.erb +10 -0
- data/lib/openvox-strings/yard/templates/default/fulldoc/html/full_list_puppet_task.erb +9 -0
- data/lib/openvox-strings/yard/templates/default/fulldoc/html/full_list_puppet_type.erb +9 -0
- data/lib/openvox-strings/yard/templates/default/fulldoc/html/setup.rb +93 -0
- data/lib/openvox-strings/yard/templates/default/layout/html/footer.erb +3 -0
- data/lib/openvox-strings/yard/templates/default/layout/html/objects.erb +37 -0
- data/lib/openvox-strings/yard/templates/default/layout/html/setup.rb +231 -0
- data/lib/openvox-strings/yard/templates/default/puppet_class/html/box_info.erb +26 -0
- data/lib/openvox-strings/yard/templates/default/puppet_class/html/deprecated.erb +6 -0
- data/lib/openvox-strings/yard/templates/default/puppet_class/html/header.erb +1 -0
- data/lib/openvox-strings/yard/templates/default/puppet_class/html/note.erb +6 -0
- data/lib/openvox-strings/yard/templates/default/puppet_class/html/overview.erb +6 -0
- data/lib/openvox-strings/yard/templates/default/puppet_class/html/setup.rb +16 -0
- data/lib/openvox-strings/yard/templates/default/puppet_class/html/source.erb +12 -0
- data/lib/openvox-strings/yard/templates/default/puppet_class/html/summary.erb +4 -0
- data/lib/openvox-strings/yard/templates/default/puppet_class/html/todo.erb +6 -0
- data/lib/openvox-strings/yard/templates/default/puppet_data_type/html/box_info.erb +10 -0
- data/lib/openvox-strings/yard/templates/default/puppet_data_type/html/deprecated.erb +6 -0
- data/lib/openvox-strings/yard/templates/default/puppet_data_type/html/header.erb +1 -0
- data/lib/openvox-strings/yard/templates/default/puppet_data_type/html/method_details_list.erb +6 -0
- data/lib/openvox-strings/yard/templates/default/puppet_data_type/html/note.erb +6 -0
- data/lib/openvox-strings/yard/templates/default/puppet_data_type/html/overview.erb +6 -0
- data/lib/openvox-strings/yard/templates/default/puppet_data_type/html/setup.rb +15 -0
- data/lib/openvox-strings/yard/templates/default/puppet_data_type/html/source.erb +12 -0
- data/lib/openvox-strings/yard/templates/default/puppet_data_type/html/summary.erb +4 -0
- data/lib/openvox-strings/yard/templates/default/puppet_data_type/html/todo.erb +6 -0
- data/lib/openvox-strings/yard/templates/default/puppet_data_type_alias/html/alias_of.erb +10 -0
- data/lib/openvox-strings/yard/templates/default/puppet_data_type_alias/html/box_info.erb +10 -0
- data/lib/openvox-strings/yard/templates/default/puppet_data_type_alias/html/deprecated.erb +6 -0
- data/lib/openvox-strings/yard/templates/default/puppet_data_type_alias/html/header.erb +1 -0
- data/lib/openvox-strings/yard/templates/default/puppet_data_type_alias/html/note.erb +6 -0
- data/lib/openvox-strings/yard/templates/default/puppet_data_type_alias/html/overview.erb +6 -0
- data/lib/openvox-strings/yard/templates/default/puppet_data_type_alias/html/setup.rb +19 -0
- data/lib/openvox-strings/yard/templates/default/puppet_data_type_alias/html/source.erb +12 -0
- data/lib/openvox-strings/yard/templates/default/puppet_data_type_alias/html/summary.erb +4 -0
- data/lib/openvox-strings/yard/templates/default/puppet_data_type_alias/html/todo.erb +6 -0
- data/lib/openvox-strings/yard/templates/default/puppet_defined_type/html/box_info.erb +10 -0
- data/lib/openvox-strings/yard/templates/default/puppet_defined_type/html/deprecated.erb +6 -0
- data/lib/openvox-strings/yard/templates/default/puppet_defined_type/html/header.erb +1 -0
- data/lib/openvox-strings/yard/templates/default/puppet_defined_type/html/note.erb +6 -0
- data/lib/openvox-strings/yard/templates/default/puppet_defined_type/html/overview.erb +6 -0
- data/lib/openvox-strings/yard/templates/default/puppet_defined_type/html/setup.rb +7 -0
- data/lib/openvox-strings/yard/templates/default/puppet_defined_type/html/source.erb +12 -0
- data/lib/openvox-strings/yard/templates/default/puppet_defined_type/html/summary.erb +4 -0
- data/lib/openvox-strings/yard/templates/default/puppet_defined_type/html/todo.erb +6 -0
- data/lib/openvox-strings/yard/templates/default/puppet_function/html/box_info.erb +14 -0
- data/lib/openvox-strings/yard/templates/default/puppet_function/html/deprecated.erb +6 -0
- data/lib/openvox-strings/yard/templates/default/puppet_function/html/header.erb +1 -0
- data/lib/openvox-strings/yard/templates/default/puppet_function/html/note.erb +6 -0
- data/lib/openvox-strings/yard/templates/default/puppet_function/html/overview.erb +18 -0
- data/lib/openvox-strings/yard/templates/default/puppet_function/html/setup.rb +7 -0
- data/lib/openvox-strings/yard/templates/default/puppet_function/html/source.erb +12 -0
- data/lib/openvox-strings/yard/templates/default/puppet_function/html/summary.erb +4 -0
- data/lib/openvox-strings/yard/templates/default/puppet_function/html/todo.erb +6 -0
- data/lib/openvox-strings/yard/templates/default/puppet_plan/html/box_info.erb +10 -0
- data/lib/openvox-strings/yard/templates/default/puppet_plan/html/deprecated.erb +6 -0
- data/lib/openvox-strings/yard/templates/default/puppet_plan/html/header.erb +1 -0
- data/lib/openvox-strings/yard/templates/default/puppet_plan/html/note.erb +6 -0
- data/lib/openvox-strings/yard/templates/default/puppet_plan/html/overview.erb +6 -0
- data/lib/openvox-strings/yard/templates/default/puppet_plan/html/setup.rb +13 -0
- data/lib/openvox-strings/yard/templates/default/puppet_plan/html/source.erb +12 -0
- data/lib/openvox-strings/yard/templates/default/puppet_plan/html/summary.erb +4 -0
- data/lib/openvox-strings/yard/templates/default/puppet_plan/html/todo.erb +6 -0
- data/lib/openvox-strings/yard/templates/default/puppet_provider/html/box_info.erb +14 -0
- data/lib/openvox-strings/yard/templates/default/puppet_provider/html/collection.erb +17 -0
- data/lib/openvox-strings/yard/templates/default/puppet_provider/html/features.erb +12 -0
- data/lib/openvox-strings/yard/templates/default/puppet_provider/html/header.erb +1 -0
- data/lib/openvox-strings/yard/templates/default/puppet_provider/html/overview.erb +6 -0
- data/lib/openvox-strings/yard/templates/default/puppet_provider/html/setup.rb +31 -0
- data/lib/openvox-strings/yard/templates/default/puppet_provider/html/summary.erb +4 -0
- data/lib/openvox-strings/yard/templates/default/puppet_task/html/box_info.erb +9 -0
- data/lib/openvox-strings/yard/templates/default/puppet_task/html/header.erb +1 -0
- data/lib/openvox-strings/yard/templates/default/puppet_task/html/input.erb +5 -0
- data/lib/openvox-strings/yard/templates/default/puppet_task/html/overview.erb +6 -0
- data/lib/openvox-strings/yard/templates/default/puppet_task/html/parameters.erb +16 -0
- data/lib/openvox-strings/yard/templates/default/puppet_task/html/setup.rb +24 -0
- data/lib/openvox-strings/yard/templates/default/puppet_task/html/supports_noop.erb +3 -0
- data/lib/openvox-strings/yard/templates/default/puppet_type/html/box_info.erb +20 -0
- data/lib/openvox-strings/yard/templates/default/puppet_type/html/deprecated.erb +6 -0
- data/lib/openvox-strings/yard/templates/default/puppet_type/html/features.erb +13 -0
- data/lib/openvox-strings/yard/templates/default/puppet_type/html/header.erb +1 -0
- data/lib/openvox-strings/yard/templates/default/puppet_type/html/note.erb +6 -0
- data/lib/openvox-strings/yard/templates/default/puppet_type/html/overview.erb +6 -0
- data/lib/openvox-strings/yard/templates/default/puppet_type/html/parameters.erb +35 -0
- data/lib/openvox-strings/yard/templates/default/puppet_type/html/setup.rb +36 -0
- data/lib/openvox-strings/yard/templates/default/puppet_type/html/summary.erb +4 -0
- data/lib/openvox-strings/yard/templates/default/puppet_type/html/todo.erb +6 -0
- data/lib/openvox-strings/yard/templates/default/tags/html/enum.erb +17 -0
- data/lib/openvox-strings/yard/templates/default/tags/html/puppet_overload.erb +12 -0
- data/lib/openvox-strings/yard/templates/default/tags/setup.rb +20 -0
- data/lib/openvox-strings/yard/util.rb +87 -0
- data/lib/openvox-strings/yard.rb +132 -0
- data/lib/openvox-strings.rb +88 -0
- data/lib/puppet/application/strings.rb +7 -0
- data/lib/puppet/face/strings.rb +185 -0
- data/lib/puppet/feature/rgen.rb +5 -0
- data/lib/puppet/feature/yard.rb +5 -0
- metadata +263 -0
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The module for custom YARD parsers.
|
4
|
+
module OpenvoxStrings::Yard::Parsers
|
5
|
+
# The module for custom YARD parsers for JSON.
|
6
|
+
module JSON
|
7
|
+
require 'openvox-strings/yard/parsers/json/parser'
|
8
|
+
end
|
9
|
+
|
10
|
+
# The module for custom YARD parsers for the Puppet language.
|
11
|
+
module Puppet
|
12
|
+
require 'openvox-strings/yard/parsers/puppet/parser'
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,13 @@
|
|
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
|
+
class OpenvoxStrings::Yard::Tags::EnumTag < YARD::Tags::OptionTag
|
7
|
+
# Registers the tag with YARD.
|
8
|
+
# @return [void]
|
9
|
+
def self.register!
|
10
|
+
YARD::Tags::Library.define_tag('puppet.enum', :enum, :with_enums)
|
11
|
+
YARD::Tags::Library.visible_tags.place(:enum).after(:option)
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'yard/tags/default_factory'
|
4
|
+
require 'openvox-strings/yard/tags/enum_tag'
|
5
|
+
|
6
|
+
# Factory for creating tags.
|
7
|
+
class OpenvoxStrings::Yard::Tags::Factory < YARD::Tags::DefaultFactory
|
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
|
+
OpenvoxStrings::Yard::Tags::EnumTag.new(tag_name, name, parse_tag_with_name(tag_name, text))
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,112 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Implements an overload tag for Puppet functions
|
4
|
+
#
|
5
|
+
# This differs from Yard's overload tag in that the signatures are formatted according to Puppet language rules.
|
6
|
+
class OpenvoxStrings::Yard::Tags::OverloadTag < YARD::Tags::Tag
|
7
|
+
attr_reader :parameters, :docstring
|
8
|
+
|
9
|
+
# Initializes the overload tag.
|
10
|
+
# @param [String, Symbol] name The name of the function being overloaded.
|
11
|
+
# @param [String] docstring The docstring for the overload.
|
12
|
+
# @return [void]
|
13
|
+
def initialize(name, docstring)
|
14
|
+
super(:overload, nil)
|
15
|
+
@name = name.to_s
|
16
|
+
@parameters = []
|
17
|
+
@docstring = YARD::Docstring.new(docstring)
|
18
|
+
end
|
19
|
+
|
20
|
+
# Gets the signature of the overload.
|
21
|
+
# @return [String] Returns the signature of the overload.
|
22
|
+
def signature
|
23
|
+
tags = self.tags(:param)
|
24
|
+
args = @parameters.map do |parameter|
|
25
|
+
name, default = parameter
|
26
|
+
tag = tags.find { |t| t.name == name } if tags
|
27
|
+
type = tag&.types ? "#{tag.type} " : 'Any '
|
28
|
+
prefix = (name[0]).to_s if name.start_with?('*', '&')
|
29
|
+
name = name[1..] if prefix
|
30
|
+
default = " = #{default}" if default
|
31
|
+
"#{type}#{prefix}$#{name}#{default}"
|
32
|
+
end.join(', ')
|
33
|
+
"#{@name}(#{args})"
|
34
|
+
end
|
35
|
+
|
36
|
+
# Adds a tag to the overload's docstring.
|
37
|
+
# @param [YARD::Tag] tag The tag to add to the overload's docstring.
|
38
|
+
# @return [void]
|
39
|
+
def add_tag(tag)
|
40
|
+
@docstring.add_tag(tag)
|
41
|
+
end
|
42
|
+
|
43
|
+
# Gets the first tag of the given name.
|
44
|
+
# @param [String, Symbol] name The name of the tag.
|
45
|
+
# @return [YARD::Tag] Returns the first tag if found or nil if not found.
|
46
|
+
def tag(name)
|
47
|
+
@docstring.tag(name)
|
48
|
+
end
|
49
|
+
|
50
|
+
# Gets all tags or tags of a given name.
|
51
|
+
# @param [String, Symbol] name The name of the tag to get or nil for all tags.
|
52
|
+
# @return [Array<Yard::Tag>] Returns an array of tags.
|
53
|
+
def tags(name = nil)
|
54
|
+
@docstring.tags(name)
|
55
|
+
end
|
56
|
+
|
57
|
+
# Determines if a tag with the given name is present.
|
58
|
+
# @param [String, Symbol] name The tag name.
|
59
|
+
# @return [Boolean] Returns true if there is at least one tag with the given name or false if not.
|
60
|
+
def has_tag?(name) # rubocop:disable Naming/PredicateName
|
61
|
+
@docstring.has_tag?(name)
|
62
|
+
end
|
63
|
+
|
64
|
+
# Sets the object associated with this tag.
|
65
|
+
# @param [Object] value The object to associate with this tag.
|
66
|
+
# @return [void]
|
67
|
+
def object=(value)
|
68
|
+
super
|
69
|
+
@docstring.object = value
|
70
|
+
@docstring.tags.each { |tag| tag.object = value }
|
71
|
+
end
|
72
|
+
|
73
|
+
# Responsible for forwarding method calls to the associated object.
|
74
|
+
# @param [Symbol] method_name The method being invoked.
|
75
|
+
# @param [Array] args The args passed to the method.
|
76
|
+
# @param block The block passed to the method.
|
77
|
+
# @return Returns what the method call on the object would return.
|
78
|
+
def method_missing(method_name, ...)
|
79
|
+
return object.send(method_name, ...) if object.respond_to? method_name
|
80
|
+
|
81
|
+
super
|
82
|
+
end
|
83
|
+
|
84
|
+
# Determines if the associated object responds to the give missing method name.
|
85
|
+
# @param [Symbol, String] method_name The name of the method to check.
|
86
|
+
# @param [Boolean] include_all True to include all methods in the check or false for only public methods.
|
87
|
+
# @return [Boolean] Returns true if the object responds to the method or false if not.
|
88
|
+
def respond_to_missing?(method_name, include_all = false)
|
89
|
+
object.respond_to?(method_name, include_all) || super
|
90
|
+
end
|
91
|
+
|
92
|
+
# Gets the type of the object associated with this tag.
|
93
|
+
# @return [Symbol] Returns the type of the object associated with this tag.
|
94
|
+
def type
|
95
|
+
object.type
|
96
|
+
end
|
97
|
+
|
98
|
+
# Converts the overload tag to a hash representation.
|
99
|
+
# @return [Hash] Returns a hash representation of the overload.
|
100
|
+
def to_hash
|
101
|
+
hash = {}
|
102
|
+
hash[:tag_name] = tag_name
|
103
|
+
hash[:text] = text if text
|
104
|
+
hash[:signature] = signature
|
105
|
+
hash[:docstring] = OpenvoxStrings::Yard::Util.docstring_to_hash(docstring) unless docstring.blank?
|
106
|
+
defaults = Hash[*parameters.reject { |p| p[1].nil? }.flatten]
|
107
|
+
hash[:defaults] = defaults unless defaults.empty?
|
108
|
+
hash[:types] = types if types
|
109
|
+
hash[:name] = name if name
|
110
|
+
hash
|
111
|
+
end
|
112
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'openvox-strings/yard/code_objects'
|
4
|
+
|
5
|
+
# Implements a parameter directive (e.g. #@!puppet.type.param) for documenting Puppet resource types.
|
6
|
+
class OpenvoxStrings::Yard::Tags::ParameterDirective < YARD::Tags::Directive
|
7
|
+
# Called to invoke the directive.
|
8
|
+
# @return [void]
|
9
|
+
def call
|
10
|
+
return unless object.respond_to?(:add_parameter)
|
11
|
+
|
12
|
+
# Add a parameter to the resource
|
13
|
+
parameter = OpenvoxStrings::Yard::CodeObjects::Type::Parameter.new(tag.name, tag.text)
|
14
|
+
tag.types&.each do |value|
|
15
|
+
parameter.add(value)
|
16
|
+
end
|
17
|
+
object.add_parameter parameter
|
18
|
+
end
|
19
|
+
|
20
|
+
# Registers the directive with YARD.
|
21
|
+
# @return [void]
|
22
|
+
def self.register!
|
23
|
+
YARD::Tags::Library.define_directive('puppet.type.param', :with_types_and_name, self)
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'openvox-strings/yard/code_objects'
|
4
|
+
|
5
|
+
# Implements a parameter directive (e.g. #@!puppet.type.property) for documenting Puppet resource types.
|
6
|
+
class OpenvoxStrings::Yard::Tags::PropertyDirective < YARD::Tags::Directive
|
7
|
+
# Called to invoke the directive.
|
8
|
+
# @return [void]
|
9
|
+
def call
|
10
|
+
return unless object.respond_to?(:add_property)
|
11
|
+
|
12
|
+
# Add a property to the resource
|
13
|
+
property = OpenvoxStrings::Yard::CodeObjects::Type::Property.new(tag.name, tag.text)
|
14
|
+
tag.types&.each do |value|
|
15
|
+
property.add(value)
|
16
|
+
end
|
17
|
+
object.add_property property
|
18
|
+
end
|
19
|
+
|
20
|
+
# Registers the directive with YARD.
|
21
|
+
# @return [void]
|
22
|
+
def self.register!
|
23
|
+
YARD::Tags::Library.define_directive('puppet.type.property', :with_types_and_name, self)
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Implements a summary tag for general purpose short descriptions
|
4
|
+
class OpenvoxStrings::Yard::Tags::SummaryTag < YARD::Tags::Tag
|
5
|
+
# Registers the tag with YARD.
|
6
|
+
# @return [void]
|
7
|
+
def self.register!
|
8
|
+
YARD::Tags::Library.define_tag('puppet.summary', :summary)
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The module for custom YARD tags.
|
4
|
+
module OpenvoxStrings::Yard::Tags
|
5
|
+
require 'openvox-strings/yard/tags/factory'
|
6
|
+
require 'openvox-strings/yard/tags/parameter_directive'
|
7
|
+
require 'openvox-strings/yard/tags/property_directive'
|
8
|
+
require 'openvox-strings/yard/tags/overload_tag'
|
9
|
+
require 'openvox-strings/yard/tags/summary_tag'
|
10
|
+
require 'openvox-strings/yard/tags/enum_tag'
|
11
|
+
end
|
@@ -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 %>
|
@@ -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
|
+
<small><%= item.function_type %></small>
|
7
|
+
</div>
|
8
|
+
</li>
|
9
|
+
<% even = !even %>
|
10
|
+
<% end %>
|
@@ -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(true)) %>
|
6
|
+
<small>Resource type: <em><%=item.type_name%></em></small>
|
7
|
+
</div>
|
8
|
+
</li>
|
9
|
+
<% even = !even %>
|
10
|
+
<% end %>
|
@@ -0,0 +1,93 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Generates the searchable Puppet class list.
|
4
|
+
# @return [void]
|
5
|
+
def generate_puppet_class_list
|
6
|
+
@items = Registry.all(:puppet_class).sort_by { |c| c.name.to_s }
|
7
|
+
@list_title = 'Puppet Class List'
|
8
|
+
@list_type = 'puppet_class'
|
9
|
+
generate_list_contents
|
10
|
+
end
|
11
|
+
|
12
|
+
# Generates the searchable Puppet data type list.
|
13
|
+
# @return [void]
|
14
|
+
def generate_puppet_data_type_list
|
15
|
+
@items = Registry.all(:puppet_data_type, :puppet_data_type_alias).sort_by { |dt| dt.name.to_s }
|
16
|
+
@list_title = 'Data Type List'
|
17
|
+
@list_type = 'puppet_data_type'
|
18
|
+
generate_list_contents
|
19
|
+
end
|
20
|
+
|
21
|
+
# Generates the searchable Puppet defined type list.
|
22
|
+
# @return [void]
|
23
|
+
def generate_puppet_defined_type_list
|
24
|
+
@items = Registry.all(:puppet_defined_type).sort_by { |dt| dt.name.to_s }
|
25
|
+
@list_title = 'Defined Type List'
|
26
|
+
@list_type = 'puppet_defined_type'
|
27
|
+
generate_list_contents
|
28
|
+
end
|
29
|
+
|
30
|
+
# Generates the searchable Puppet resource type list.
|
31
|
+
# @return [void]
|
32
|
+
def generate_puppet_type_list
|
33
|
+
@items = Registry.all(:puppet_type).sort_by { |t| t.name.to_s }
|
34
|
+
@list_title = 'Resource Type List'
|
35
|
+
@list_type = 'puppet_type'
|
36
|
+
generate_list_contents
|
37
|
+
end
|
38
|
+
|
39
|
+
# Generates the searchable Puppet provider list.
|
40
|
+
# @return [void]
|
41
|
+
def generate_puppet_provider_list
|
42
|
+
@items = Registry.all(:puppet_provider).sort_by { |p| p.name.to_s }
|
43
|
+
@list_title = 'Provider List'
|
44
|
+
@list_type = 'puppet_provider'
|
45
|
+
generate_list_contents
|
46
|
+
end
|
47
|
+
|
48
|
+
# Generates the searchable Puppet function list.
|
49
|
+
# @return [void]
|
50
|
+
def generate_puppet_function_list
|
51
|
+
@items = Registry.all(:puppet_function).sort_by { |f| f.name.to_s }
|
52
|
+
@list_title = 'Puppet Function List'
|
53
|
+
@list_type = 'puppet_function'
|
54
|
+
generate_list_contents
|
55
|
+
end
|
56
|
+
|
57
|
+
# Generates the searchable Ruby method list.
|
58
|
+
# @return [void]
|
59
|
+
def generate_method_list
|
60
|
+
@items = prune_method_listing(Registry.all(:method), false)
|
61
|
+
@items = @items.reject { |m| m.name.to_s =~ /=$/ && m.is_attribute? }
|
62
|
+
@items = @items.sort_by { |m| m.name.to_s }
|
63
|
+
@list_title = 'Ruby Method List'
|
64
|
+
@list_type = 'method'
|
65
|
+
generate_list_contents
|
66
|
+
end
|
67
|
+
|
68
|
+
# Generate a searchable Ruby class list in the output.
|
69
|
+
# @return [void]
|
70
|
+
def generate_class_list
|
71
|
+
@items = options.objects if options.objects
|
72
|
+
@list_title = 'Ruby Class List'
|
73
|
+
@list_type = 'class'
|
74
|
+
generate_list_contents
|
75
|
+
end
|
76
|
+
|
77
|
+
# Generates the searchable Puppet Task list.
|
78
|
+
# @return [void]
|
79
|
+
def generate_puppet_task_list
|
80
|
+
@items = Registry.all(:puppet_task).sort_by { |t| t.name.to_s }
|
81
|
+
@list_title = 'Puppet Task List'
|
82
|
+
@list_type = 'puppet_task'
|
83
|
+
generate_list_contents
|
84
|
+
end
|
85
|
+
|
86
|
+
# Generates the searchable Puppet Plan list.
|
87
|
+
# @return [void]
|
88
|
+
def generate_puppet_plan_list
|
89
|
+
@items = Registry.all(:puppet_plan).sort_by { |t| t.name.to_s }
|
90
|
+
@list_title = 'Puppet Plan List'
|
91
|
+
@list_type = 'puppet_plan'
|
92
|
+
generate_list_contents
|
93
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<% unless @objects_by_letter.empty? %>
|
2
|
+
<h2><%= @title %></h2>
|
3
|
+
|
4
|
+
<% i = 0 %>
|
5
|
+
<table>
|
6
|
+
<tr>
|
7
|
+
<td valign='top' width="33%">
|
8
|
+
<% @objects_by_letter.sort_by {|l,o| l.to_s }.each do |letter, objects| %>
|
9
|
+
<% if (i += 1) % 8 == 0 %>
|
10
|
+
</td>
|
11
|
+
<td valign='top' width="33%">
|
12
|
+
<% i = 0 %>
|
13
|
+
<% end %>
|
14
|
+
<ul id="alpha_<%= letter %>" class="alpha">
|
15
|
+
<li class="letter"><%= letter %></li>
|
16
|
+
<ul>
|
17
|
+
<% objects.each do |obj| %>
|
18
|
+
<li>
|
19
|
+
<%= linkify obj, obj.name %>
|
20
|
+
<% if (obj.type == :module || obj.type == :class) && !obj.namespace.root? %>
|
21
|
+
<small>(<%= obj.namespace.path %>)</small>
|
22
|
+
<% elsif obj.type == :puppet_provider %>
|
23
|
+
<small>(Resource type: <%= obj.type_name %>)</small>
|
24
|
+
<% elsif obj.type == :puppet_function %>
|
25
|
+
<small>(<%= obj.function_type %>)</small>
|
26
|
+
<% elsif obj.type == :puppet_data_type_alias %>
|
27
|
+
<small>(Alias)</small>
|
28
|
+
<% end %>
|
29
|
+
</li>
|
30
|
+
<% end %>
|
31
|
+
</ul>
|
32
|
+
</ul>
|
33
|
+
<% end %>
|
34
|
+
</td>
|
35
|
+
</tr>
|
36
|
+
</table>
|
37
|
+
<% end %>
|