puppet-strings 4.0.0 → 4.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d62acfc0a3e4fa9561fc3d3291a70335101c9705697b7736c17eb270547a0c2e
4
- data.tar.gz: 81606aea417506c5e2d3041d042df2b8a5299b08d6cf517993fe92019bd3b9ec
3
+ metadata.gz: a436988d26135b32aebfa60a1629c0bb0abe3901498c323ba626720920adb6a5
4
+ data.tar.gz: 505f15e76bfa4fc30f9f0a3effd3fa6869c28c9c62d824fe84bd0a463a8ae57d
5
5
  SHA512:
6
- metadata.gz: 261ed46f4fd0da48e210942d6d61b3bbac7dc6e1bb3fabe101a30651b3cb0377e0864ed9f4ff7ebbea477a288ef6e09f477bca366cfd71564b74eda6a60c7d86
7
- data.tar.gz: 2aa3781199b8cb71bf9356c92a83df920d433fe07917c80ad500db8c16a54bcbf21ada74fcd41d4a063c6bad6ab9a874e830b4bde82ccfb4170749b31b6f6ba8
6
+ metadata.gz: 863c8107391d017e15ef16d94b834e7cccf5c6b64e2026f20bd92aa38ba88a21ef635dfe2b80f5ad5008f381fe797368b7d0cf56bb4688a72fd0ddc23230ab49
7
+ data.tar.gz: 12f98c88971353202a5656798c2c9762b8e4b6806258d89ffbcaade4b84abed6957a045df181da4500e870b170c324f3621269c52f465060464db2b09e067063
data/CHANGELOG.md CHANGED
@@ -5,6 +5,22 @@ All notable changes to this project will be documented in this file.
5
5
 
6
6
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org).
7
7
 
8
+ ## [v4.1.1](https://github.com/puppetlabs/puppet-strings/tree/v4.1.1) - 2023-11-22
9
+
10
+ [Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/v4.1.0...v4.1.1)
11
+
12
+ ### Fixed
13
+
14
+ - Fix option tag handling with no data types [#361](https://github.com/puppetlabs/puppet-strings/pull/361) ([seanmil](https://github.com/seanmil))
15
+
16
+ ## [v4.1.0](https://github.com/puppetlabs/puppet-strings/tree/v4.1.0) - 2023-07-04
17
+
18
+ [Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/v4.0.0...v4.1.0)
19
+
20
+ ### Added
21
+
22
+ - (CONT-1193) - Add `--providers` and `--list-providers` flags [#357](https://github.com/puppetlabs/puppet-strings/pull/357) ([jordanbreen28](https://github.com/jordanbreen28))
23
+
8
24
  ## [v4.0.0](https://github.com/puppetlabs/puppet-strings/tree/v4.0.0) - 2023-04-25
9
25
 
10
26
  [Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/v4.0.0.rc.1...v4.0.0)
@@ -13,13 +29,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
13
29
 
14
30
  [Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/v3.0.1...v4.0.0.rc.1)
15
31
 
32
+ ### Changed
33
+ - (CONT-812) Puppet 8 / Ruby 3 support [#348](https://github.com/puppetlabs/puppet-strings/pull/348) ([chelnak](https://github.com/chelnak))
34
+
16
35
  ### Added
17
36
 
18
37
  - Add deprecated tag [#342](https://github.com/puppetlabs/puppet-strings/pull/342) ([b4ldr](https://github.com/b4ldr))
19
38
 
20
- ### Changed
21
- - (CONT-812) Puppet 8 / Ruby 3 support [#348](https://github.com/puppetlabs/puppet-strings/pull/348) ([chelnak](https://github.com/chelnak))
22
-
23
39
  ## [v3.0.1](https://github.com/puppetlabs/puppet-strings/tree/v3.0.1) - 2022-10-25
24
40
 
25
41
  [Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/v3.0.0...v3.0.1)
@@ -32,16 +48,16 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
32
48
 
33
49
  [Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/v2.9.0...v3.0.0)
34
50
 
35
- ### Added
36
-
37
- - (#223) Use code blocks as appropriate in Markdown [#319](https://github.com/puppetlabs/puppet-strings/pull/319) ([danielparks](https://github.com/danielparks))
38
- - Use tilde heredocs for readability [#317](https://github.com/puppetlabs/puppet-strings/pull/317) ([danielparks](https://github.com/danielparks))
39
-
40
51
  ### Changed
41
52
  - (CONT-228) Remove deprecated emit flags [#329](https://github.com/puppetlabs/puppet-strings/pull/329) ([chelnak](https://github.com/chelnak))
42
53
  - (CONT-228) Bump ruby version [#326](https://github.com/puppetlabs/puppet-strings/pull/326) ([chelnak](https://github.com/chelnak))
43
54
  - (#301) Update minimum Ruby version to 2.5.0 [#313](https://github.com/puppetlabs/puppet-strings/pull/313) ([danielparks](https://github.com/danielparks))
44
55
 
56
+ ### Added
57
+
58
+ - (#223) Use code blocks as appropriate in Markdown [#319](https://github.com/puppetlabs/puppet-strings/pull/319) ([danielparks](https://github.com/danielparks))
59
+ - Use tilde heredocs for readability [#317](https://github.com/puppetlabs/puppet-strings/pull/317) ([danielparks](https://github.com/danielparks))
60
+
45
61
  ### Fixed
46
62
 
47
63
  - (#240) Fix output of default values that are expressions [#315](https://github.com/puppetlabs/puppet-strings/pull/315) ([danielparks](https://github.com/danielparks))
@@ -88,13 +104,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
88
104
 
89
105
  [Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/v2.5.0...v2.6.0)
90
106
 
107
+ ### Changed
108
+ - (MAINT) Drop Ruby 2.1.x and Puppet 4.x compatibility [#253](https://github.com/puppetlabs/puppet-strings/pull/253) ([scotje](https://github.com/scotje))
109
+
91
110
  ### Added
92
111
 
93
112
  - Improved markdown templates [#252](https://github.com/puppetlabs/puppet-strings/pull/252) ([kozl](https://github.com/kozl))
94
113
 
95
- ### Changed
96
- - (MAINT) Drop Ruby 2.1.x and Puppet 4.x compatibility [#253](https://github.com/puppetlabs/puppet-strings/pull/253) ([scotje](https://github.com/scotje))
97
-
98
114
  ### Fixed
99
115
 
100
116
  - Do not fail in case return tag has no type specified [#268](https://github.com/puppetlabs/puppet-strings/pull/268) ([tiandrey](https://github.com/tiandrey))
@@ -181,15 +197,15 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
181
197
 
182
198
  [Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/1.2.1...2.0.0)
183
199
 
200
+ ### Changed
201
+ - bump required ruby and puppet versions [#178](https://github.com/puppetlabs/puppet-strings/pull/178) ([eputnam](https://github.com/eputnam))
202
+
184
203
  ### Added
185
204
 
186
205
  - (PDOC-238) add generated message to markdown [#175](https://github.com/puppetlabs/puppet-strings/pull/175) ([eputnam](https://github.com/eputnam))
187
206
  - (PDOC-228) puppet plan support [#168](https://github.com/puppetlabs/puppet-strings/pull/168) ([eputnam](https://github.com/eputnam))
188
207
  - (PDOC-206) support for tasks [#161](https://github.com/puppetlabs/puppet-strings/pull/161) ([eputnam](https://github.com/eputnam))
189
208
 
190
- ### Changed
191
- - bump required ruby and puppet versions [#178](https://github.com/puppetlabs/puppet-strings/pull/178) ([eputnam](https://github.com/eputnam))
192
-
193
209
  ### Fixed
194
210
 
195
211
  - (PDOC-36) fix hack for README urls [#176](https://github.com/puppetlabs/puppet-strings/pull/176) ([eputnam](https://github.com/eputnam))
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Puppet strings
2
2
 
3
- [![ci](https://github.com/puppetlabs/puppet-strings/actions/workflows/ci.yml/badge.svg)](https://github.com/puppetlabs/puppet-strings/actions/workflows/ci.yml) [![Gem Version](https://badge.fury.io/rb/puppet-strings.svg)](https://badge.fury.io/rb/puppet-strings)
3
+ [![ci](https://github.com/puppetlabs/puppet-strings/actions/workflows/ci.yml/badge.svg)](https://github.com/puppetlabs/puppet-strings/actions/workflows/ci.yml)
4
+ [![Gem Version](https://badge.fury.io/rb/puppet-strings.svg)](https://badge.fury.io/rb/puppet-strings)
5
+ [![Code Owners](https://img.shields.io/badge/owners-DevX--team-blue)](https://github.com/puppetlabs/puppet-strings/blob/main/CODEOWNERS)
4
6
 
5
7
  Puppet Strings generates documentation for Puppet code and extensions written in Puppet and Ruby.
6
8
  Strings processes code and YARD-style code comments to create documentation in HTML, Markdown, or JSON formats.
@@ -107,7 +109,7 @@ An example of running the acceptance tests locally with Docker:
107
109
  4. Install test items; Puppet Agent, our test module, and the puppet-strings gem built from this source code
108
110
 
109
111
  ``` bash
110
- bundle exec rake 'litmus:install_agent[puppet6]'
112
+ bundle exec rake 'litmus:install_agent[puppet8]'
111
113
  bundle exec rake 'litmus:install_modules_from_directory[./spec/fixtures/acceptance/modules]'
112
114
  bundle exec rake litmus:install_gems
113
115
  ```
@@ -124,6 +126,10 @@ An example of running the acceptance tests locally with Docker:
124
126
  bundle exec rake litmus:tear_down
125
127
  ```
126
128
 
129
+ ## License
130
+
131
+ This codebase is licensed under Apache 2.0. However, the open source dependencies included in this codebase might be subject to other software licenses such as AGPL, GPL2.0, and MIT.
132
+
127
133
  ## Support
128
134
 
129
135
  Please log issues in [GitHub issues](https://github.com/puppetlabs/puppet-strings/issues).
@@ -3,7 +3,7 @@
3
3
  require 'puppet/face'
4
4
 
5
5
  # Implements the 'puppet strings' interface.
6
- Puppet::Face.define(:strings, '0.0.1') do
6
+ Puppet::Face.define(:strings, '0.0.1') do # rubocop:disable Metrics/BlockLength
7
7
  summary 'Generate Puppet documentation with YARD.'
8
8
 
9
9
  action(:generate) do
@@ -83,7 +83,10 @@ Puppet::Face.define(:strings, '0.0.1') do
83
83
  summary 'list types'
84
84
  end
85
85
  option '--providers' do
86
- summary 'provide details on providers'
86
+ summary 'provide details on providers for each type'
87
+ end
88
+ option '--list-providers' do
89
+ summary 'list all providers'
87
90
  end
88
91
 
89
92
  # TODO: Implement the rest of describe behavior
@@ -96,6 +99,9 @@ Puppet::Face.define(:strings, '0.0.1') do
96
99
  # * --list:
97
100
  # List all types
98
101
 
102
+ # * --list-providers:
103
+ # list all providers
104
+
99
105
  # * --meta:
100
106
  # List all metaparameters
101
107
 
@@ -160,6 +166,8 @@ Puppet::Face.define(:strings, '0.0.1') do
160
166
  generate_options[:describe] = true
161
167
  generate_options[:describe_types] = options[:describe_types]
162
168
  generate_options[:describe_list] = options[:list]
169
+ generate_options[:providers] = options[:providers]
170
+ generate_options[:list_providers] = options[:list_providers]
163
171
  end
164
172
 
165
173
  format = options[:format]
@@ -7,31 +7,38 @@ require 'puppet-strings/json'
7
7
  module PuppetStrings::Describe
8
8
  # Renders requested types or a summarized list in the current YARD registry to STDOUT.
9
9
  # @param [Array] describe_types The list of names of the types to be displayed.
10
- # @param [bool] list Create the summarized list instead of describing each type.
11
- # @param [bool] _providers Show details of the providers.
10
+ # @param [bool] list_types Create the summarized list instead of describing each type.
11
+ # @param [bool] show_type_providers Show details of the providers of a specified type.
12
+ # @param [bool] list_providers Create a summarized list of providers.
12
13
  # @return [void]
13
- def self.render(describe_types = [], list = false, _providers = false)
14
+ def self.render(describe_types = [], list_types = false, show_type_providers = true, list_providers = false)
14
15
  document = {
15
16
  defined_types: YARD::Registry.all(:puppet_defined_type).sort_by!(&:name).map!(&:to_hash),
16
- resource_types: YARD::Registry.all(:puppet_type).sort_by!(&:name).map!(&:to_hash)
17
+ resource_types: YARD::Registry.all(:puppet_type).sort_by!(&:name).map!(&:to_hash),
18
+ providers: YARD::Registry.all(:puppet_provider).sort_by!(&:name).map!(&:to_hash)
17
19
  }
18
-
19
- if list
20
+ # if --list flag passed, produce a summarized list of types
21
+ if list_types
20
22
  puts 'These are the types known to puppet:'
21
- document[:resource_types].each { |t| list_one_type(t) }
22
- else
23
- document[:providers] = YARD::Registry.all(:puppet_provider).sort_by!(&:name).map!(&:to_hash)
23
+ document[:resource_types].each { |t| list_one(t) }
24
24
 
25
+ # if a type(s) has been passed, show the details of that type(s)
26
+ elsif describe_types
25
27
  type_names = {}
26
28
  describe_types.each { |name| type_names[name] = true }
27
29
 
28
30
  document[:resource_types].each do |t|
29
- show_one_type(t) if type_names[t[:name].to_s]
31
+ show_one_type(t, show_type_providers) if type_names[t[:name].to_s]
30
32
  end
33
+
34
+ # if --providers flag passed, produce a summarized list of providers
35
+ elsif list_providers
36
+ puts 'These are the providers known to puppet:'
37
+ document[:providers].each { |t| list_one(t) }
31
38
  end
32
39
  end
33
40
 
34
- def self.show_one_type(resource_type)
41
+ def self.show_one_type(resource_type, providers = true)
35
42
  puts format("\n%<name>s\n%<underscore>s", name: resource_type[:name], underscore: '=' * resource_type[:name].length)
36
43
  puts resource_type[:docstring][:text]
37
44
 
@@ -42,8 +49,10 @@ module PuppetStrings::Describe
42
49
 
43
50
  puts "\nParameters\n----------"
44
51
  combined_list.sort_by { |p| p[:name] }.each { |p| show_one_parameter(p) }
52
+ return unless providers
53
+
45
54
  puts "\nProviders\n---------"
46
- # Show providers here - list or provide details
55
+ resource_type[:providers]&.sort_by { |p| p[:name] }&.each { |p| puts p[:name].to_s.ljust(15) }
47
56
  end
48
57
 
49
58
  def self.show_one_parameter(parameter)
@@ -53,14 +62,14 @@ module PuppetStrings::Describe
53
62
  puts format('Requires features %<required_features>s.', required_features: parameter[:required_features]) unless parameter[:required_features].nil?
54
63
  end
55
64
 
56
- def self.list_one_type(type)
65
+ def self.list_one(object)
57
66
  targetlength = 48
58
67
  shortento = targetlength - 4
59
- contentstring = type[:docstring][:text]
68
+ contentstring = object[:docstring][:text]
60
69
  end_of_line = contentstring.index("\n") # "." gives closer results to old describeb, but breaks for '.k5login'
61
70
  contentstring = contentstring[0..end_of_line] unless end_of_line.nil?
62
71
  contentstring = "#{contentstring[0..shortento]} ..." if contentstring.length > targetlength
63
72
 
64
- puts "#{type[:name].to_s.ljust(15)} - #{contentstring}"
73
+ puts "#{object[:name].to_s.ljust(15)} - #{contentstring}"
65
74
  end
66
75
  end
@@ -70,7 +70,11 @@ Data type:<%= code_maybe_block(param[:types].join(', ')) %>
70
70
  Options:
71
71
 
72
72
  <% options_for_param(param[:name]).each do |o| -%>
73
+ <% if o[:opt_types] -%>
73
74
  * **<%= o[:opt_name] %>** `<%= o[:opt_types][0] %>`: <%= o[:opt_text] %>
75
+ <% else -%>
76
+ * **<%= o[:opt_name] %>**: <%= o[:opt_text] %>
77
+ <% end -%>
74
78
  <% end -%>
75
79
 
76
80
  <% end -%>
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PuppetStrings
4
- VERSION = '4.0.0'
4
+ VERSION = '4.1.1'
5
5
  end
@@ -143,6 +143,8 @@ class PuppetStrings::Yard::Handlers::Ruby::DataTypeHandler < PuppetStrings::Yard
143
143
  @literal_visitor.visit_this_0(self, ast)
144
144
  end
145
145
 
146
+ # TODO: Fix the rubocop violations in this file between the following rubocop:disable/enable lines
147
+ # rubocop:disable Naming/MethodName
146
148
  # ----- The following methods are different/additions from the original Literal_evaluator
147
149
  def literal_Object(o)
148
150
  # Ignore any other object types
@@ -214,6 +216,7 @@ class PuppetStrings::Yard::Handlers::Ruby::DataTypeHandler < PuppetStrings::Yard
214
216
  result[literal(entry.key)] = literal(entry.value)
215
217
  end
216
218
  end
219
+ # rubocop:enable Naming/MethodName
217
220
  end
218
221
 
219
222
  # Extracts the datatype attributes from a Puppet Data Type interface hash.
@@ -322,7 +322,7 @@ class PuppetStrings::Yard::Handlers::Ruby::FunctionHandler < PuppetStrings::Yard
322
322
  end
323
323
 
324
324
  type ||= tag&.types ? tag.type : 'Any'
325
- type = optional ? "Optional[#{type}]" : type
325
+ type = "Optional[#{type}]" if optional
326
326
 
327
327
  object.parameters << [name, to_puppet_literal(default)]
328
328
 
@@ -40,6 +40,8 @@ class PuppetStrings::Yard::Parsers::Puppet::Parser < YARD::Parser::Base
40
40
 
41
41
  private
42
42
 
43
+ # TODO: Fix the rubocop violations in this file between the following rubocop:disable/enable lines
44
+ # rubocop:disable Naming/MethodName
43
45
  def transform_Program(o)
44
46
  # Cache the lines of the source text; we'll use this to locate comments
45
47
  @lines = o.source_text.lines.to_a
@@ -83,4 +85,5 @@ class PuppetStrings::Yard::Parsers::Puppet::Parser < YARD::Parser::Base
83
85
  def transform_Object(o)
84
86
  # Ignore anything else (will be compacted out of the resulting array)
85
87
  end
88
+ # rubocop:enable Naming/MethodName
86
89
  end
@@ -75,8 +75,8 @@ class PuppetStrings::Yard::Tags::OverloadTag < YARD::Tags::Tag
75
75
  # @param [Array] args The args passed to the method.
76
76
  # @param block The block passed to the method.
77
77
  # @return Returns what the method call on the object would return.
78
- def method_missing(method_name, *args, &block)
79
- return object.send(method_name, *args, &block) if object.respond_to? method_name
78
+ def method_missing(method_name, ...)
79
+ return object.send(method_name, ...) if object.respond_to? method_name
80
80
 
81
81
  super
82
82
  end
@@ -55,7 +55,7 @@ module PuppetStrings
55
55
 
56
56
  return unless options[:describe]
57
57
 
58
- render_describe(options[:describe_types], options[:describe_list], options[:providers])
58
+ render_describe(options[:describe_types], options[:describe_list], options[:providers], options[:list_providers])
59
59
  end
60
60
 
61
61
  def self.puppet_5?
@@ -72,9 +72,9 @@ module PuppetStrings
72
72
  PuppetStrings::Markdown.render(path)
73
73
  end
74
74
 
75
- def self.render_describe(describe_types, list = false, providers = false)
75
+ def self.render_describe(describe_types, list = false, show_providers = true, list_providers = false)
76
76
  require 'puppet-strings/describe'
77
- PuppetStrings::Describe.render(describe_types, list, providers)
77
+ PuppetStrings::Describe.render(describe_types, list, show_providers, list_providers)
78
78
  end
79
79
 
80
80
  # Runs the YARD documentation server.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-strings
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-25 00:00:00.000000000 Z
11
+ date: 2023-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rgen