puppet-strings 4.1.3 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8f5cc43b3dfbc54e6a559b97f6b7bce4e5a8d6a94ff46f118095c7bcde517bbb
4
- data.tar.gz: 2dd5bac66f509884479026f24b154f81e13e78edef723b1f482036447f0d942c
3
+ metadata.gz: 15e623045d2f26993f1193bde5d1a00c6eff406dff7eb4e3e40b198f74dfa92c
4
+ data.tar.gz: f9428ce6e6ce52b7a7ce92a755c0c1592e5eb0cd5e96c82aa4fd829a7877b0e5
5
5
  SHA512:
6
- metadata.gz: b7203752a05e060ab1b92f9f2b952ab7cea1cb681ae7f1bd45368427f6202555bec2efb884f78f9ff27385fe6b931e037fd02234f9326073e26fbd72701e325c
7
- data.tar.gz: 6d0afed23ef6b0a60600d85f359375887303759b59fba5661644f26aa0cd3ca3dfc2f154dca94397531cd1d1a562560c78f46f4262d604a92ead1f68f2168e9b
6
+ metadata.gz: fff9cbb435f70ff2d4d41c8956737c1a7adf1f2fb14110eb044a79e69d710e61b421828399b90c0ec4ee745d9c0ae0da5c4b538a9da1d89fbeb4f27822695988
7
+ data.tar.gz: 57fbf41d3236e9543a6313694ef3ecd01d96556ac93bb4f35cd4c9ea1f9d1267d47ba04f525fc9a07bf5cf1acd38b0ba23b9c2a24f008a8b1827e2c10c28eebb
data/CHANGELOG.md CHANGED
@@ -5,6 +5,20 @@ 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
+ ## [v5.0.0](https://github.com/puppetlabs/puppet-strings/tree/v5.0.0) - 2025-06-09
9
+
10
+ [Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/v4.1.3...v5.0.0)
11
+
12
+ ### Changed
13
+
14
+ - (CAT-2281) Remove puppet 7 infrastructure [#407](https://github.com/puppetlabs/puppet-strings/pull/407) ([LukasAud](https://github.com/LukasAud))
15
+
16
+ ### Fixed
17
+
18
+ - Rake task allows for a different commit message [#408](https://github.com/puppetlabs/puppet-strings/pull/408) ([ghoneycutt](https://github.com/ghoneycutt))
19
+ - clarifies the puppet-strings usage [#405](https://github.com/puppetlabs/puppet-strings/pull/405) ([binford2k](https://github.com/binford2k))
20
+ - List puppet as runtime dependency [#404](https://github.com/puppetlabs/puppet-strings/pull/404) ([bastelfreak](https://github.com/bastelfreak))
21
+
8
22
  ## [v4.1.3](https://github.com/puppetlabs/puppet-strings/tree/v4.1.3) - 2024-09-05
9
23
 
10
24
  [Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/v4.1.2...v4.1.3)
data/README.md CHANGED
@@ -11,8 +11,8 @@ Strings processes code and YARD-style code comments to create documentation in H
11
11
 
12
12
  ### Requirements
13
13
 
14
- * Ruby 2.7.0 or newer
15
- * Puppet 7.0.0 or newer
14
+ * Ruby 3.1.0 or newer
15
+ * Puppet 8.0.0 or newer
16
16
 
17
17
  ### Install Puppet Strings
18
18
 
@@ -4,7 +4,7 @@ require 'puppet/face'
4
4
 
5
5
  # Implements the 'puppet strings' interface.
6
6
  Puppet::Face.define(:strings, '0.0.1') do # rubocop:disable Metrics/BlockLength
7
- summary 'Generate Puppet documentation with YARD.'
7
+ summary 'Generate Puppet module documentation with YARD.'
8
8
 
9
9
  action(:generate) do
10
10
  default
@@ -181,7 +181,7 @@ module PuppetStrings::Markdown
181
181
  def toc_info
182
182
  {
183
183
  name: name.to_s,
184
- link: link,
184
+ link:,
185
185
  desc: summary || @registry[:docstring][:text][0..140].tr("\n", ' '),
186
186
  private: private?
187
187
  }
@@ -11,7 +11,9 @@ namespace :strings do
11
11
 
12
12
  Dir.chdir('doc') do
13
13
  system 'git checkout gh-pages'
14
+ exit 1 unless $?.success?
14
15
  system 'git pull --rebase origin gh-pages'
16
+ exit 1 unless $?.success?
15
17
  end
16
18
  else
17
19
  git_uri = `git config --get remote.origin.url`.strip
@@ -20,9 +22,13 @@ namespace :strings do
20
22
  Dir.mkdir('doc')
21
23
  Dir.chdir('doc') do
22
24
  system 'git init'
25
+ exit 1 unless $?.success?
23
26
  system "git remote add origin #{git_uri}"
27
+ exit 1 unless $?.success?
24
28
  system 'git pull origin gh-pages'
29
+ exit 1 unless $?.success?
25
30
  system 'git checkout -b gh-pages'
31
+ exit 1 unless $?.success?
26
32
  end
27
33
  end
28
34
  end
@@ -35,15 +41,23 @@ namespace :strings do
35
41
  end
36
42
  end
37
43
 
38
- task :push do
44
+ # Task to push the gh-pages branch. Argument :msg_prefix is the beginning
45
+ # of the message and the actual commit will have "at Revision <git_sha>"
46
+ # appended.
47
+ task :push, [:msg_prefix] do |_t, args|
48
+ msg_prefix = args[:msg_prefix] || '[strings] Generated Documentation Update'
49
+
39
50
  output = `git describe --long 2>/dev/null`
40
51
  # If a project has never been tagged, fall back to latest SHA
41
52
  git_sha = output.empty? ? `git log --pretty=format:'%H' -n 1` : output
42
53
 
43
54
  Dir.chdir('doc') do
44
55
  system 'git add .'
45
- system "git commit -m '[strings] Generated Documentation Update at Revision #{git_sha}'"
56
+ exit 1 unless $?.success?
57
+ system "git commit -m '#{msg_prefix} at Revision #{git_sha}'"
58
+ # Do not check status of commit, as it will error if there are no changes.
46
59
  system 'git push origin gh-pages -f'
60
+ exit 1 unless $?.success?
47
61
  end
48
62
  end
49
63
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PuppetStrings
4
- VERSION = '4.1.3'
4
+ VERSION = '5.0.0'
5
5
  end
@@ -94,7 +94,7 @@ class PuppetStrings::Yard::CodeObjects::Function < PuppetStrings::Yard::CodeObje
94
94
  hash[:signatures] << { signature: o.signature, docstring: PuppetStrings::Yard::Util.docstring_to_hash(o.docstring, %i[param option enum return example]) }
95
95
  end
96
96
  else
97
- hash[:signatures] << { signature: signature, docstring: PuppetStrings::Yard::Util.docstring_to_hash(docstring, %i[param option enum return example]) }
97
+ hash[:signatures] << { signature:, docstring: PuppetStrings::Yard::Util.docstring_to_hash(docstring, %i[param option enum return example]) }
98
98
  end
99
99
 
100
100
  hash[:docstring] = PuppetStrings::Yard::Util.docstring_to_hash(docstring)
@@ -21,7 +21,7 @@ class PuppetStrings::Yard::Handlers::Puppet::Base < YARD::Handlers::Base
21
21
  tags.each do |tag|
22
22
  next if statement.parameters.find { |p| tag.name == p.name }
23
23
 
24
- log.warn "The @param tag for parameter '#{tag.name}' has no matching parameter at #{statement.file}:#{statement.line}." unless tag.name == 'name' || tag.name == 'title'
24
+ log.warn "The @param tag for parameter '#{tag.name}' has no matching parameter at #{statement.file}:#{statement.line}." unless %w[name title].include?(tag.name)
25
25
  end
26
26
 
27
27
  # Assign the types for the parameter
@@ -6,7 +6,7 @@ require 'ripper'
6
6
  class PuppetStrings::Yard::Handlers::Ruby::Base < YARD::Handlers::Ruby::Base
7
7
  # A regular expression for detecting the start of a Ruby heredoc.
8
8
  # Note: the first character of the heredoc start may have been cut off by YARD.
9
- HEREDOC_START = /^<?<[-~]?['"]?(\w+)['"]?[^\n]*\n?/.freeze
9
+ HEREDOC_START = /^<?<[-~]?['"]?(\w+)['"]?[^\n]*\n?/
10
10
 
11
11
  protected
12
12
 
@@ -237,7 +237,7 @@ class PuppetStrings::Yard::Handlers::Ruby::DataTypeHandler < PuppetStrings::Yard
237
237
  default = value['value'] unless value['value'].nil?
238
238
  end
239
239
  data_type = [data_type] unless data_type.nil? || data_type.is_a?(Array)
240
- params_hash[key] = { types: data_type, default: default }
240
+ params_hash[key] = { types: data_type, default: }
241
241
  end
242
242
 
243
243
  params_hash
@@ -61,7 +61,7 @@ class PuppetStrings::Yard::Handlers::Ruby::ProviderHandler < PuppetStrings::Yard
61
61
  # Look for a call to a dispatch method with a block
62
62
  next unless
63
63
  child.method_name &&
64
- (child.method_name.source == 'desc' || child.method_name.source == 'doc=') &&
64
+ ['desc', 'doc='].include?(child.method_name.source) &&
65
65
  child.parameters(false).count == 1
66
66
 
67
67
  docstring = node_as_string(child.parameters[0])
@@ -34,7 +34,7 @@ class PuppetStrings::Yard::Handlers::Ruby::TypeBase < PuppetStrings::Yard::Handl
34
34
  elsif child.is_a?(YARD::Parser::Ruby::MethodCallNode)
35
35
  # Look for a call to a dispatch method with a block
36
36
  next unless child.method_name &&
37
- (child.method_name.source == 'desc' || child.method_name.source == 'doc=') &&
37
+ ['desc', 'doc='].include?(child.method_name.source) &&
38
38
  child.parameters(false).count == 1
39
39
 
40
40
  docstring = node_as_string(child.parameters[0])
@@ -7,7 +7,7 @@ module PuppetStrings::Yard::Parsers::Puppet
7
7
  # Represents the base Puppet language statement.
8
8
  class Statement
9
9
  # The pattern for parsing docstring comments.
10
- COMMENT_REGEX = /^\s*#+\s?/.freeze
10
+ COMMENT_REGEX = /^\s*#+\s?/
11
11
 
12
12
  attr_reader :source, :file, :line, :docstring, :comments_range
13
13
 
@@ -170,7 +170,7 @@ module PuppetStrings::Yard::Parsers::Puppet
170
170
  case type_expr
171
171
  when Puppet::Pops::Model::AccessExpression
172
172
  # TODO: I don't like rebuilding the source from the AST, but AccessExpressions don't expose the original source
173
- @alias_of = +"#{PuppetStrings::Yard::Util.ast_to_text(type_expr.left_expr)}[" # alias_of should be mutable so we add a + to the string.
173
+ @alias_of = "#{PuppetStrings::Yard::Util.ast_to_text(type_expr.left_expr)}[" # alias_of should be mutable so we add a + to the string.
174
174
  @alias_of << type_expr.keys.map { |key| PuppetStrings::Yard::Util.ast_to_text(key) }.join(', ')
175
175
  @alias_of << ']'
176
176
  else
@@ -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
@@ -4,13 +4,7 @@
4
4
  # @return [Array<YARD::Tag>] Returns the parameter tags if the object should have parameters.
5
5
  def param
6
6
  tag(:param) if
7
- object.type == :method ||
8
- object.type == :puppet_class ||
9
- object.type == :puppet_data_type ||
10
- object.type == :puppet_defined_type ||
11
- object.type == :puppet_function ||
12
- object.type == :puppet_task ||
13
- object.type == :puppet_plan
7
+ %i[method puppet_class puppet_data_type puppet_defined_type puppet_function puppet_task puppet_plan].include?(object.type)
14
8
  end
15
9
 
16
10
  # Renders the overload section.
@@ -40,7 +40,7 @@ module PuppetStrings::Yard::Util
40
40
 
41
41
  tag = { tag_name: t.tag_name }
42
42
  # grab nested information for @option and @enum tags
43
- if tag[:tag_name] == 'option' || tag[:tag_name] == 'enum'
43
+ if %w[option enum].include?(tag[:tag_name])
44
44
  tag[:opt_name] = t.pair.name
45
45
  tag[:opt_text] = t.pair.text
46
46
  tag[:opt_types] = t.pair.types if t.pair.types
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-strings
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.3
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-05 00:00:00.000000000 Z
11
+ date: 2025-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: puppet
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 8.0.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 8.0.0
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: rgen
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -31,9 +45,6 @@ dependencies:
31
45
  - - "~>"
32
46
  - !ruby/object:Gem::Version
33
47
  version: '0.9'
34
- - - "<"
35
- - !ruby/object:Gem::Version
36
- version: 0.9.37
37
48
  type: :runtime
38
49
  prerelease: false
39
50
  version_requirements: !ruby/object:Gem::Requirement
@@ -41,10 +52,7 @@ dependencies:
41
52
  - - "~>"
42
53
  - !ruby/object:Gem::Version
43
54
  version: '0.9'
44
- - - "<"
45
- - !ruby/object:Gem::Version
46
- version: 0.9.37
47
- description:
55
+ description:
48
56
  email: info@puppet.com
49
57
  executables: []
50
58
  extensions: []
@@ -232,7 +240,7 @@ homepage: https://github.com/puppetlabs/puppet-strings
232
240
  licenses:
233
241
  - Apache-2.0
234
242
  metadata: {}
235
- post_install_message:
243
+ post_install_message:
236
244
  rdoc_options: []
237
245
  require_paths:
238
246
  - lib
@@ -240,16 +248,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
240
248
  requirements:
241
249
  - - ">="
242
250
  - !ruby/object:Gem::Version
243
- version: 2.7.0
251
+ version: 3.1.0
244
252
  required_rubygems_version: !ruby/object:Gem::Requirement
245
253
  requirements:
246
254
  - - ">="
247
255
  - !ruby/object:Gem::Version
248
256
  version: '0'
249
- requirements:
250
- - puppet, >= 7.0.0
251
- rubygems_version: 3.1.6
252
- signing_key:
257
+ requirements: []
258
+ rubygems_version: 3.3.27
259
+ signing_key:
253
260
  specification_version: 4
254
261
  summary: Puppet documentation via YARD
255
262
  test_files: []