puppet-strings 2.1.0 → 2.2.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 +5 -5
- data/CHANGELOG.md +18 -3
- data/Gemfile +3 -2
- data/Rakefile +5 -0
- data/lib/puppet-strings.rb +10 -1
- data/lib/puppet-strings/describe.rb +68 -0
- data/lib/puppet-strings/json.rb +0 -38
- data/lib/puppet-strings/markdown/base.rb +18 -16
- data/lib/puppet-strings/markdown/templates/function.erb +26 -0
- data/lib/puppet-strings/markdown/templates/resource_type.erb +4 -0
- data/lib/puppet-strings/tasks/generate.rb +7 -1
- data/lib/puppet-strings/version.rb +1 -1
- data/lib/puppet-strings/yard/code_objects/class.rb +1 -1
- data/lib/puppet-strings/yard/code_objects/defined_type.rb +1 -1
- data/lib/puppet-strings/yard/code_objects/function.rb +3 -3
- data/lib/puppet-strings/yard/code_objects/plan.rb +1 -1
- data/lib/puppet-strings/yard/code_objects/provider.rb +1 -1
- data/lib/puppet-strings/yard/code_objects/type.rb +3 -2
- data/lib/puppet-strings/yard/handlers.rb +1 -0
- data/lib/puppet-strings/yard/handlers/ruby/base.rb +11 -0
- data/lib/puppet-strings/yard/handlers/ruby/function_handler.rb +1 -9
- data/lib/puppet-strings/yard/handlers/ruby/provider_handler.rb +1 -9
- data/lib/puppet-strings/yard/handlers/ruby/rsapi_handler.rb +1 -1
- data/lib/puppet-strings/yard/handlers/ruby/type_base.rb +130 -0
- data/lib/puppet-strings/yard/handlers/ruby/type_extras_handler.rb +56 -0
- data/lib/puppet-strings/yard/handlers/ruby/type_handler.rb +3 -115
- data/lib/puppet-strings/yard/parsers/json/parser.rb +3 -1
- data/lib/puppet-strings/yard/tags/overload_tag.rb +1 -1
- data/lib/puppet-strings/yard/util.rb +48 -0
- data/lib/puppet/face/strings.rb +66 -1
- data/spec/fixtures/unit/markdown/output.md +64 -0
- data/spec/fixtures/unit/markdown/output_with_plan.md +64 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/unit/puppet-strings/describe_spec.rb +141 -0
- data/spec/unit/puppet-strings/json_spec.rb +65 -11
- data/spec/unit/puppet-strings/markdown_spec.rb +13 -0
- data/spec/unit/puppet-strings/yard/handlers/json/task_handler_spec.rb +4 -12
- data/spec/unit/puppet-strings/yard/handlers/ruby/function_handler_spec.rb +1 -1
- data/spec/unit/puppet-strings/yard/handlers/ruby/rsapi_handler_spec.rb +21 -0
- data/spec/unit/puppet-strings/yard/handlers/ruby/type_handler_spec.rb +26 -0
- data/spec/unit/puppet-strings/yard/parsers/json/parser_spec.rb +5 -3
- metadata +7 -6
- data/spec/fixtures/unit/json/output.json +0 -660
- data/spec/fixtures/unit/json/output_with_plan.json +0 -697
- data/spec/fixtures/unit/json/output_without_puppet_function.json +0 -480
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9556dd124a1f5f4dfcaf4457232efbea310988d8
|
4
|
+
data.tar.gz: 3ef01d946f16d66c1d3af2c32345a90364ef57c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 516ae9d909f068fc6c25cbb0f8839b06a16509201bfb7081f0f9ee985088a740780495ce00d50ac5d1c12560ac6d35fad7d2234dc31fc206ad79aa3ce8d5ddbb
|
7
|
+
data.tar.gz: eb5ec2204cac028fa9a27d7c5536694e3f07669d854e7323dba6d03d7cfeff369b92358ee19d4db9cb43fcc44df0f57540b1b41080eca6f1e21fc759e1c8d011
|
data/CHANGELOG.md
CHANGED
@@ -3,16 +3,31 @@
|
|
3
3
|
All significant changes to this repo will be summarized in this file.
|
4
4
|
|
5
5
|
|
6
|
-
## [v2.
|
6
|
+
## [v2.2.0](https://github.com/puppetlabs/puppet-strings/tree/v2.2.0) (2019-04-05)
|
7
|
+
|
8
|
+
[Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/v2.1.0...v2.2.0)
|
9
|
+
|
10
|
+
Added
|
11
|
+
|
12
|
+
- \(PDOC-272\) Add required features attribute [\#194](https://github.com/puppetlabs/puppet-strings/pull/194) ([kris-bosland](https://github.com/kris-bosland))
|
13
|
+
- \(maint\) Implement a strings:generate:reference task [\#192](https://github.com/puppetlabs/puppet-strings/pull/192) ([ekohl](https://github.com/ekohl))
|
14
|
+
- \(PDOC-265\) Add examples to function reference docs [\#188](https://github.com/puppetlabs/puppet-strings/pull/188) ([ekohl](https://github.com/ekohl))
|
15
|
+
- \(PDOC-252\) Add describe features to puppet-strings face [\#183](https://github.com/puppetlabs/puppet-strings/pull/183) ([kris-bosland](https://github.com/kris-bosland))
|
16
|
+
|
17
|
+
Fixed
|
18
|
+
|
19
|
+
- \(PDOC-266\) Silence 'unexpected construct regexp\_literal' warning [\#189](https://github.com/puppetlabs/puppet-strings/pull/189) ([seanmil](https://github.com/seanmil))
|
20
|
+
|
21
|
+
## [v2.1.0](https://github.com/puppetlabs/puppet-strings/tree/v2.1.0) (2018-06-26)
|
7
22
|
|
8
23
|
[Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/2.0.0...v2.1.0)
|
9
24
|
|
10
|
-
|
25
|
+
Added
|
11
26
|
|
12
27
|
- \(PDOC-212, PDOC-213\) add support for @note and @todo [\#182](https://github.com/puppetlabs/puppet-strings/pull/182) ([eputnam](https://github.com/eputnam))
|
13
28
|
- \(PDOC-255\) markdown table of contents update [\#181](https://github.com/puppetlabs/puppet-strings/pull/181) ([eputnam](https://github.com/eputnam))
|
14
29
|
|
15
|
-
|
30
|
+
Fixed
|
16
31
|
|
17
32
|
- \(PDOC-259\) relax ruby requirement to 2.1.0 from 2.1.9 [\#184](https://github.com/puppetlabs/puppet-strings/pull/184) ([DavidS](https://github.com/DavidS))
|
18
33
|
|
data/Gemfile
CHANGED
@@ -18,7 +18,8 @@ group :test do
|
|
18
18
|
gem 'puppetlabs_spec_helper'
|
19
19
|
gem 'serverspec'
|
20
20
|
gem 'simplecov-console'
|
21
|
-
gem
|
21
|
+
gem 'rspec', '~> 3.1'
|
22
|
+
gem 'json_spec', '~> 1.1', '>= 1.1.5'
|
22
23
|
end
|
23
24
|
|
24
25
|
group :acceptance do
|
@@ -34,4 +35,4 @@ group :development do
|
|
34
35
|
gem 'pry-byebug'
|
35
36
|
end
|
36
37
|
|
37
|
-
gem 'rubocop', '
|
38
|
+
gem 'rubocop', '~> 0.49'
|
data/Rakefile
CHANGED
@@ -2,6 +2,11 @@ require 'bundler/gem_tasks'
|
|
2
2
|
#require 'puppetlabs_spec_helper/rake_tasks'
|
3
3
|
require 'puppet-lint/tasks/puppet-lint'
|
4
4
|
|
5
|
+
require 'rspec/core/rake_task'
|
6
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
7
|
+
t.exclude_pattern = "spec/acceptance/**/*.rb"
|
8
|
+
end
|
9
|
+
|
5
10
|
# Add our own tasks
|
6
11
|
require 'puppet-strings/tasks'
|
7
12
|
|
data/lib/puppet-strings.rb
CHANGED
@@ -53,7 +53,7 @@ module PuppetStrings
|
|
53
53
|
YARD::CLI::Yardoc.run(*args)
|
54
54
|
|
55
55
|
# If outputting JSON, render the output
|
56
|
-
if options[:json]
|
56
|
+
if options[:json] && !options[:describe]
|
57
57
|
render_json(file)
|
58
58
|
end
|
59
59
|
|
@@ -61,6 +61,10 @@ module PuppetStrings
|
|
61
61
|
if options[:markdown]
|
62
62
|
render_markdown(file)
|
63
63
|
end
|
64
|
+
|
65
|
+
if options[:describe]
|
66
|
+
render_describe(options[:describe_types], options[:describe_list], options[:providers])
|
67
|
+
end
|
64
68
|
end
|
65
69
|
|
66
70
|
def self.puppet_5?
|
@@ -77,6 +81,11 @@ module PuppetStrings
|
|
77
81
|
PuppetStrings::Markdown.render(path)
|
78
82
|
end
|
79
83
|
|
84
|
+
def self.render_describe(describe_types, list = false, providers = false)
|
85
|
+
require 'puppet-strings/describe'
|
86
|
+
PuppetStrings::Describe.render(describe_types, list, providers)
|
87
|
+
end
|
88
|
+
|
80
89
|
# Runs the YARD documentation server.
|
81
90
|
# @param [Array<String>] args The arguments to YARD.
|
82
91
|
def self.run_server(*args)
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'puppet-strings/json'
|
3
|
+
|
4
|
+
# The module for command line documentation related functionality.
|
5
|
+
module PuppetStrings::Describe
|
6
|
+
# Renders requested types or a summarized list in the current YARD registry to STDOUT.
|
7
|
+
# @param [Array] describe_types The list of names of the types to be displayed.
|
8
|
+
# @param [bool] list Create the summarized list instead of describing each type.
|
9
|
+
# @param [bool] providers Show details of the providers.
|
10
|
+
# @return [void]
|
11
|
+
def self.render(describe_types = [], list = false, providers = false)
|
12
|
+
document = {
|
13
|
+
defined_types: YARD::Registry.all(:puppet_defined_type).sort_by!(&:name).map!(&:to_hash),
|
14
|
+
resource_types: YARD::Registry.all(:puppet_type).sort_by!(&:name).map!(&:to_hash),
|
15
|
+
}
|
16
|
+
|
17
|
+
if list
|
18
|
+
puts "These are the types known to puppet:"
|
19
|
+
document[:resource_types].each { |t| list_one_type(t) }
|
20
|
+
else
|
21
|
+
document[:providers] = YARD::Registry.all(:puppet_provider).sort_by!(&:name).map!(&:to_hash)
|
22
|
+
|
23
|
+
type_names = {}
|
24
|
+
describe_types.each { |name| type_names[name] = true }
|
25
|
+
|
26
|
+
document[:resource_types].each do |t|
|
27
|
+
show_one_type(t, providers) if type_names[t[:name].to_s]
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.show_one_type(resource_type, providers = false)
|
33
|
+
puts "\n%{name}\n%{underscore}" % { name: resource_type[:name], underscore: "=" * resource_type[:name].length }
|
34
|
+
puts resource_type[:docstring][:text]
|
35
|
+
|
36
|
+
combined_list = (resource_type[:parameters].nil? ? [] : resource_type[:parameters]) +
|
37
|
+
(resource_type[:properties].nil? ? [] : resource_type[:properties])
|
38
|
+
|
39
|
+
if combined_list.any?
|
40
|
+
puts "\nParameters\n----------"
|
41
|
+
combined_list.sort_by { |p| p[:name] }.each { |p| show_one_parameter(p) }
|
42
|
+
puts "\nProviders\n---------"
|
43
|
+
end
|
44
|
+
#Show providers here - list or provide details
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.show_one_parameter(parameter)
|
48
|
+
puts "\n- **%{name}**\n" % { name: parameter[:name] }
|
49
|
+
puts parameter[:description]
|
50
|
+
puts "Valid values are `%{values}`." % { values: parameter[:values].join("`, `") } unless parameter[:values].nil?
|
51
|
+
puts "Requires features %{required_features}." % { required_features: parameter[:required_features] } unless parameter[:required_features].nil?
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.list_one_type(type)
|
55
|
+
targetlength = 48
|
56
|
+
shortento = targetlength - 4
|
57
|
+
contentstring = type[:docstring][:text]
|
58
|
+
end_of_line = contentstring.index("\n") # "." gives closer results to old describeb, but breaks for '.k5login'
|
59
|
+
if !end_of_line.nil?
|
60
|
+
contentstring = contentstring[0..end_of_line]
|
61
|
+
end
|
62
|
+
if contentstring.length > targetlength
|
63
|
+
contentstring = contentstring[0..shortento] + ' ...'
|
64
|
+
end
|
65
|
+
|
66
|
+
puts "%-15s - %-s" % [type[:name], contentstring]
|
67
|
+
end
|
68
|
+
end
|
data/lib/puppet-strings/json.rb
CHANGED
@@ -26,42 +26,4 @@ module PuppetStrings::Json
|
|
26
26
|
puts JSON.pretty_generate(document)
|
27
27
|
end
|
28
28
|
end
|
29
|
-
|
30
|
-
# Converts a list of tags into an array of hashes.
|
31
|
-
# @param [Array] tags List of tags to be converted into an array of hashes.
|
32
|
-
# @return [Array] Returns an array of tag hashes.
|
33
|
-
def self.tags_to_hashes(tags)
|
34
|
-
# Skip over the API tags that are public
|
35
|
-
tags.select { |t| (t.tag_name != 'api' || t.text != 'public') }.map do |t|
|
36
|
-
next t.to_hash if t.respond_to?(:to_hash)
|
37
|
-
|
38
|
-
tag = { tag_name: t.tag_name }
|
39
|
-
# grab nested information for @option tags
|
40
|
-
if tag[:tag_name] == 'option'
|
41
|
-
tag[:opt_name] = t.pair.name
|
42
|
-
tag[:opt_text] = t.pair.text
|
43
|
-
tag[:opt_types] = t.pair.types
|
44
|
-
tag[:parent] = t.name
|
45
|
-
end
|
46
|
-
tag[:text] = t.text if t.text
|
47
|
-
tag[:types] = t.types if t.types
|
48
|
-
tag[:name] = t.name if t.name
|
49
|
-
tag
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
# Converts a YARD::Docstring (or String) to a docstring hash for JSON output.
|
54
|
-
# @param [YARD::Docstring, String] docstring The docstring to convert to a hash.
|
55
|
-
# @param [Array] select_tags List of tags to select. Other tags will be filtered out.
|
56
|
-
# @return [Hash] Returns a hash representation of the given docstring.
|
57
|
-
def self.docstring_to_hash(docstring, select_tags=nil)
|
58
|
-
hash = {}
|
59
|
-
hash[:text] = docstring
|
60
|
-
if docstring.is_a? YARD::Docstring
|
61
|
-
tags = tags_to_hashes(docstring.tags.select { |t| select_tags.nil? || select_tags.include?(t.tag_name.to_sym) })
|
62
|
-
|
63
|
-
hash[:tags] = tags unless tags.empty?
|
64
|
-
end
|
65
|
-
hash
|
66
|
-
end
|
67
29
|
end
|
@@ -60,9 +60,9 @@ module PuppetStrings::Markdown
|
|
60
60
|
:summary => 'summary',
|
61
61
|
:note => 'note',
|
62
62
|
:todo => 'todo' }.each do |method_name, tag_name|
|
63
|
-
# @return [String] unless the tag is nil or the string.
|
63
|
+
# @return [String] unless the tag is nil or the string.empty?
|
64
64
|
define_method method_name do
|
65
|
-
@tags.
|
65
|
+
@tags.find { |tag| tag[:tag_name] == tag_name && !tag[:text].empty? }[:text] if @tags.any? { |tag| tag[:tag_name] == tag_name && !tag[:text].empty? }
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
@@ -78,37 +78,37 @@ module PuppetStrings::Markdown
|
|
78
78
|
|
79
79
|
# @return [String] data type of return value
|
80
80
|
def return_type
|
81
|
-
@tags.
|
81
|
+
@tags.find { |tag| tag[:tag_name] == 'return' }[:types][0] if @tags.any? { |tag| tag[:tag_name] == 'return' }
|
82
82
|
end
|
83
83
|
|
84
84
|
# @return [String] text from @since tag
|
85
85
|
def since
|
86
|
-
@tags.
|
86
|
+
@tags.find { |tag| tag[:tag_name] == 'since' }[:text] if @tags.any? { |tag| tag[:tag_name] == 'since' }
|
87
87
|
end
|
88
88
|
|
89
89
|
# @return [Array] @see tag hashes
|
90
90
|
def see
|
91
|
-
|
91
|
+
select_tags('see')
|
92
92
|
end
|
93
93
|
|
94
94
|
# @return [Array] parameter tag hashes
|
95
95
|
def params
|
96
|
-
|
96
|
+
select_tags('param')
|
97
97
|
end
|
98
98
|
|
99
99
|
# @return [Array] example tag hashes
|
100
100
|
def examples
|
101
|
-
|
101
|
+
select_tags('example')
|
102
102
|
end
|
103
103
|
|
104
104
|
# @return [Array] raise tag hashes
|
105
105
|
def raises
|
106
|
-
|
106
|
+
select_tags('raise')
|
107
107
|
end
|
108
108
|
|
109
109
|
# @return [Array] option tag hashes
|
110
110
|
def options
|
111
|
-
|
111
|
+
select_tags('option')
|
112
112
|
end
|
113
113
|
|
114
114
|
# @param parameter_name
|
@@ -119,7 +119,7 @@ module PuppetStrings::Markdown
|
|
119
119
|
opts_for_p unless opts_for_p.nil? || opts_for_p.length.zero?
|
120
120
|
end
|
121
121
|
|
122
|
-
# @return [
|
122
|
+
# @return [Hash] any defaults found for the component
|
123
123
|
def defaults
|
124
124
|
@registry[:defaults] unless @registry[:defaults].nil?
|
125
125
|
end
|
@@ -153,12 +153,7 @@ module PuppetStrings::Markdown
|
|
153
153
|
end
|
154
154
|
|
155
155
|
def private?
|
156
|
-
|
157
|
-
api = @tags.find { |tag| tag[:tag_name] == 'api' }
|
158
|
-
unless api.nil?
|
159
|
-
result = api[:text] == 'private' ? true : false
|
160
|
-
end
|
161
|
-
result
|
156
|
+
@tags.any? { |tag| tag[:tag_name] == 'api' && tag[:text] == 'private' }
|
162
157
|
end
|
163
158
|
|
164
159
|
# @return [String] full markdown rendering of a component
|
@@ -166,5 +161,12 @@ module PuppetStrings::Markdown
|
|
166
161
|
file = File.join(File.dirname(__FILE__),"templates/#{template}")
|
167
162
|
ERB.new(File.read(file), nil, '-').result(binding)
|
168
163
|
end
|
164
|
+
|
165
|
+
private
|
166
|
+
|
167
|
+
def select_tags(name)
|
168
|
+
tags = @tags.select { |tag| tag[:tag_name] == name }
|
169
|
+
tags.empty? ? nil : tags
|
170
|
+
end
|
169
171
|
end
|
170
172
|
end
|
@@ -4,10 +4,13 @@ Type: <%= type %>
|
|
4
4
|
|
5
5
|
<% if text -%>
|
6
6
|
<%= text %>
|
7
|
+
|
7
8
|
<% elsif summary -%>
|
8
9
|
<%= summary %>
|
10
|
+
|
9
11
|
<% else -%>
|
10
12
|
<%= "The #{name} function." %>
|
13
|
+
|
11
14
|
<% end -%>
|
12
15
|
<% if todo -%>
|
13
16
|
* **TODO** <%= todo %>
|
@@ -17,7 +20,18 @@ Type: <%= type %>
|
|
17
20
|
* **Note** <%= note %>
|
18
21
|
|
19
22
|
<% end -%>
|
23
|
+
<% if examples -%>
|
24
|
+
#### Examples
|
20
25
|
|
26
|
+
<% examples.each do |eg| -%>
|
27
|
+
##### <%= eg[:name] %>
|
28
|
+
|
29
|
+
```puppet
|
30
|
+
<%= eg[:text] %>
|
31
|
+
```
|
32
|
+
|
33
|
+
<% end -%>
|
34
|
+
<% end -%>
|
21
35
|
<% signatures.each do |sig| -%>
|
22
36
|
#### `<%= sig.signature %>`
|
23
37
|
|
@@ -45,6 +59,18 @@ Raises:
|
|
45
59
|
* <%= error_type(r[:text]) %> <%= error_text(r[:text]) %>
|
46
60
|
<% end -%>
|
47
61
|
|
62
|
+
<% end -%>
|
63
|
+
<% if sig.examples -%>
|
64
|
+
##### Examples
|
65
|
+
|
66
|
+
<% sig.examples.each do |eg| -%>
|
67
|
+
###### <%= eg[:name] %>
|
68
|
+
|
69
|
+
```puppet
|
70
|
+
<%= eg[:text] %>
|
71
|
+
```
|
72
|
+
|
73
|
+
<% end -%>
|
48
74
|
<% end -%>
|
49
75
|
<% if sig.params -%>
|
50
76
|
<% sig.params.each do |param| -%>
|
@@ -121,6 +121,10 @@ Options:
|
|
121
121
|
<% if param[:default] -%>
|
122
122
|
Default value: <%= value_string(param[:default]) %>
|
123
123
|
|
124
|
+
<% end -%>
|
125
|
+
<% if param[:required_features] -%>
|
126
|
+
Required features: <%= param[:required_features] %>.
|
127
|
+
|
124
128
|
<% end -%>
|
125
129
|
<% end -%>
|
126
130
|
<% end -%>
|
@@ -41,5 +41,11 @@ namespace :strings do
|
|
41
41
|
|
42
42
|
PuppetStrings.generate(patterns, options)
|
43
43
|
end
|
44
|
-
end
|
45
44
|
|
45
|
+
namespace :generate do
|
46
|
+
desc 'Generate Puppet Reference documentation.'
|
47
|
+
task :reference, [:patterns, :debug, :backtrace] do |t, args|
|
48
|
+
Rake::Task['strings:generate'].invoke(args[:patterns], args[:debug], args[:backtrace], nil, 'false', 'true')
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -50,7 +50,7 @@ class PuppetStrings::Yard::CodeObjects::Class < PuppetStrings::Yard::CodeObjects
|
|
50
50
|
hash[:file] = file
|
51
51
|
hash[:line] = line
|
52
52
|
hash[:inherits] = statement.parent_class if statement.parent_class
|
53
|
-
hash[:docstring] = PuppetStrings::
|
53
|
+
hash[:docstring] = PuppetStrings::Yard::Util.docstring_to_hash(docstring)
|
54
54
|
defaults = Hash[*parameters.select{ |p| !p[1].nil? }.flatten]
|
55
55
|
hash[:defaults] = defaults unless defaults.empty?
|
56
56
|
hash[:source] = source unless source && source.empty?
|
@@ -49,7 +49,7 @@ class PuppetStrings::Yard::CodeObjects::DefinedType < PuppetStrings::Yard::CodeO
|
|
49
49
|
hash[:name] = name
|
50
50
|
hash[:file] = file
|
51
51
|
hash[:line] = line
|
52
|
-
hash[:docstring] = PuppetStrings::
|
52
|
+
hash[:docstring] = PuppetStrings::Yard::Util.docstring_to_hash(docstring)
|
53
53
|
defaults = Hash[*parameters.select{ |p| !p[1].nil? }.flatten]
|
54
54
|
hash[:defaults] = defaults unless defaults.empty?
|
55
55
|
hash[:source] = source unless source && source.empty?
|
@@ -88,13 +88,13 @@ class PuppetStrings::Yard::CodeObjects::Function < PuppetStrings::Yard::CodeObje
|
|
88
88
|
if self.has_tag? :overload
|
89
89
|
# loop over overloads and append onto the signatures array
|
90
90
|
self.tags(:overload).each do |o|
|
91
|
-
hash[:signatures] << { :signature => o.signature, :docstring => PuppetStrings::
|
91
|
+
hash[:signatures] << { :signature => o.signature, :docstring => PuppetStrings::Yard::Util.docstring_to_hash(o.docstring, [:param, :option, :return, :example]) }
|
92
92
|
end
|
93
93
|
else
|
94
|
-
hash[:signatures] << { :signature => self.signature, :docstring => PuppetStrings::
|
94
|
+
hash[:signatures] << { :signature => self.signature, :docstring => PuppetStrings::Yard::Util.docstring_to_hash(docstring, [:param, :option, :return, :example]) }
|
95
95
|
end
|
96
96
|
|
97
|
-
hash[:docstring] = PuppetStrings::
|
97
|
+
hash[:docstring] = PuppetStrings::Yard::Util.docstring_to_hash(docstring)
|
98
98
|
defaults = Hash[*parameters.select{ |p| !p[1].nil? }.flatten]
|
99
99
|
hash[:defaults] = defaults unless defaults.empty?
|
100
100
|
hash[:source] = source unless source && source.empty?
|
@@ -47,7 +47,7 @@ class PuppetStrings::Yard::CodeObjects::Plan < PuppetStrings::Yard::CodeObjects:
|
|
47
47
|
hash[:name] = name
|
48
48
|
hash[:file] = file
|
49
49
|
hash[:line] = line
|
50
|
-
hash[:docstring] = PuppetStrings::
|
50
|
+
hash[:docstring] = PuppetStrings::Yard::Util.docstring_to_hash(docstring)
|
51
51
|
defaults = Hash[*parameters.select{ |p| !p[1].nil? }.flatten]
|
52
52
|
hash[:defaults] = defaults unless defaults.empty?
|
53
53
|
hash[:source] = source unless source && source.empty?
|
@@ -82,7 +82,7 @@ class PuppetStrings::Yard::CodeObjects::Provider < PuppetStrings::Yard::CodeObje
|
|
82
82
|
hash[:type_name] = type_name
|
83
83
|
hash[:file] = file
|
84
84
|
hash[:line] = line
|
85
|
-
hash[:docstring] = PuppetStrings::
|
85
|
+
hash[:docstring] = PuppetStrings::Yard::Util.docstring_to_hash(docstring)
|
86
86
|
hash[:confines] = confines if confines && !confines.empty?
|
87
87
|
hash[:features] = features if features && !features.empty?
|
88
88
|
hash[:defaults] = defaults if defaults && !defaults.empty?
|