puppet-strings 2.5.0 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +33 -6
  3. data/lib/puppet-strings.rb +2 -0
  4. data/lib/puppet-strings/describe.rb +2 -0
  5. data/lib/puppet-strings/json.rb +2 -0
  6. data/lib/puppet-strings/markdown.rb +11 -9
  7. data/lib/puppet-strings/markdown/base.rb +11 -3
  8. data/lib/puppet-strings/markdown/data_type.rb +2 -0
  9. data/lib/puppet-strings/markdown/data_types.rb +3 -1
  10. data/lib/puppet-strings/markdown/defined_type.rb +2 -0
  11. data/lib/puppet-strings/markdown/defined_types.rb +3 -1
  12. data/lib/puppet-strings/markdown/function.rb +9 -7
  13. data/lib/puppet-strings/markdown/functions.rb +3 -1
  14. data/lib/puppet-strings/markdown/puppet_class.rb +2 -0
  15. data/lib/puppet-strings/markdown/puppet_classes.rb +3 -1
  16. data/lib/puppet-strings/markdown/puppet_plan.rb +2 -0
  17. data/lib/puppet-strings/markdown/puppet_plans.rb +3 -1
  18. data/lib/puppet-strings/markdown/puppet_task.rb +2 -0
  19. data/lib/puppet-strings/markdown/puppet_tasks.rb +3 -1
  20. data/lib/puppet-strings/markdown/resource_type.rb +2 -0
  21. data/lib/puppet-strings/markdown/resource_types.rb +3 -1
  22. data/lib/puppet-strings/markdown/table_of_contents.rb +3 -1
  23. data/lib/puppet-strings/markdown/templates/classes_and_defines.erb +7 -3
  24. data/lib/puppet-strings/markdown/templates/data_type.erb +12 -4
  25. data/lib/puppet-strings/markdown/templates/data_type_function.erb +1 -1
  26. data/lib/puppet-strings/markdown/templates/function.erb +1 -1
  27. data/lib/puppet-strings/markdown/templates/puppet_task.erb +1 -1
  28. data/lib/puppet-strings/markdown/templates/resource_type.erb +8 -2
  29. data/lib/puppet-strings/monkey_patches/display_object_command.rb +2 -0
  30. data/lib/puppet-strings/tasks.rb +2 -0
  31. data/lib/puppet-strings/tasks/generate.rb +2 -0
  32. data/lib/puppet-strings/tasks/gh_pages.rb +3 -0
  33. data/lib/puppet-strings/version.rb +3 -1
  34. data/lib/puppet-strings/yard.rb +3 -0
  35. data/lib/puppet-strings/yard/code_objects.rb +2 -0
  36. data/lib/puppet-strings/yard/code_objects/base.rb +2 -0
  37. data/lib/puppet-strings/yard/code_objects/class.rb +4 -2
  38. data/lib/puppet-strings/yard/code_objects/data_type.rb +4 -2
  39. data/lib/puppet-strings/yard/code_objects/data_type_alias.rb +2 -0
  40. data/lib/puppet-strings/yard/code_objects/defined_type.rb +4 -2
  41. data/lib/puppet-strings/yard/code_objects/function.rb +6 -3
  42. data/lib/puppet-strings/yard/code_objects/group.rb +3 -0
  43. data/lib/puppet-strings/yard/code_objects/plan.rb +4 -2
  44. data/lib/puppet-strings/yard/code_objects/provider.rb +6 -0
  45. data/lib/puppet-strings/yard/code_objects/task.rb +2 -0
  46. data/lib/puppet-strings/yard/code_objects/type.rb +3 -0
  47. data/lib/puppet-strings/yard/handlers.rb +2 -0
  48. data/lib/puppet-strings/yard/handlers/helpers.rb +2 -0
  49. data/lib/puppet-strings/yard/handlers/json/base.rb +2 -0
  50. data/lib/puppet-strings/yard/handlers/json/task_handler.rb +2 -0
  51. data/lib/puppet-strings/yard/handlers/puppet/base.rb +3 -0
  52. data/lib/puppet-strings/yard/handlers/puppet/class_handler.rb +2 -0
  53. data/lib/puppet-strings/yard/handlers/puppet/data_type_alias_handler.rb +2 -0
  54. data/lib/puppet-strings/yard/handlers/puppet/defined_type_handler.rb +2 -0
  55. data/lib/puppet-strings/yard/handlers/puppet/function_handler.rb +3 -1
  56. data/lib/puppet-strings/yard/handlers/puppet/plan_handler.rb +2 -0
  57. data/lib/puppet-strings/yard/handlers/ruby/base.rb +5 -0
  58. data/lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb +33 -17
  59. data/lib/puppet-strings/yard/handlers/ruby/function_handler.rb +9 -7
  60. data/lib/puppet-strings/yard/handlers/ruby/provider_handler.rb +13 -0
  61. data/lib/puppet-strings/yard/handlers/ruby/rsapi_handler.rb +4 -1
  62. data/lib/puppet-strings/yard/handlers/ruby/type_base.rb +14 -6
  63. data/lib/puppet-strings/yard/handlers/ruby/type_extras_handler.rb +5 -2
  64. data/lib/puppet-strings/yard/handlers/ruby/type_handler.rb +12 -1
  65. data/lib/puppet-strings/yard/parsers.rb +2 -0
  66. data/lib/puppet-strings/yard/parsers/json/parser.rb +2 -0
  67. data/lib/puppet-strings/yard/parsers/json/task_statement.rb +2 -0
  68. data/lib/puppet-strings/yard/parsers/puppet/parser.rb +12 -10
  69. data/lib/puppet-strings/yard/parsers/puppet/statement.rb +4 -0
  70. data/lib/puppet-strings/yard/tags.rb +2 -0
  71. data/lib/puppet-strings/yard/tags/enum_tag.rb +2 -0
  72. data/lib/puppet-strings/yard/tags/factory.rb +2 -0
  73. data/lib/puppet-strings/yard/tags/overload_tag.rb +4 -1
  74. data/lib/puppet-strings/yard/tags/parameter_directive.rb +5 -4
  75. data/lib/puppet-strings/yard/tags/property_directive.rb +5 -4
  76. data/lib/puppet-strings/yard/tags/summary_tag.rb +2 -0
  77. data/lib/puppet-strings/yard/templates/default/puppet_function/html/setup.rb +1 -1
  78. data/lib/puppet-strings/yard/util.rb +4 -1
  79. data/lib/puppet/application/strings.rb +2 -0
  80. data/lib/puppet/face/strings.rb +4 -1
  81. data/lib/puppet/feature/rgen.rb +2 -0
  82. data/lib/puppet/feature/yard.rb +2 -0
  83. metadata +5 -5
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'yard/tags/option_tag'
2
4
 
3
5
  # Implements an enum tag for describing enumerated value data types
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'yard/tags/default_factory'
2
4
  require 'puppet-strings/yard/tags/enum_tag'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Implements an overload tag for Puppet functions
2
4
  #
3
5
  # This differs from Yard's overload tag in that the signatures are formatted according to Puppet language rules.
@@ -22,7 +24,7 @@ class PuppetStrings::Yard::Tags::OverloadTag < YARD::Tags::Tag
22
24
  args = @parameters.map do |parameter|
23
25
  name, default = parameter
24
26
  tag = tags.find { |t| t.name == name } if tags
25
- type = tag && tag.types ? "#{tag.type} " : 'Any '
27
+ type = tag&.types ? "#{tag.type} " : 'Any '
26
28
  prefix = "#{name[0]}" if name.start_with?('*', '&')
27
29
  name = name[1..-1] if prefix
28
30
  default = " = #{default}" if default
@@ -75,6 +77,7 @@ class PuppetStrings::Yard::Tags::OverloadTag < YARD::Tags::Tag
75
77
  # @return Returns what the method call on the object would return.
76
78
  def method_missing(method_name, *args, &block)
77
79
  return object.send(method_name, *args, &block) if object.respond_to? method_name
80
+
78
81
  super
79
82
  end
80
83
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'puppet-strings/yard/code_objects'
2
4
 
3
5
  # Implements a parameter directive (e.g. #@!puppet.type.param) for documenting Puppet resource types.
@@ -5,14 +7,13 @@ class PuppetStrings::Yard::Tags::ParameterDirective < YARD::Tags::Directive
5
7
  # Called to invoke the directive.
6
8
  # @return [void]
7
9
  def call
8
- return unless object && object.respond_to?(:add_parameter)
10
+ return unless object&.respond_to?(:add_parameter)
11
+
9
12
  # Add a parameter to the resource
10
13
  parameter = PuppetStrings::Yard::CodeObjects::Type::Parameter.new(tag.name, tag.text)
11
- if tag.types
12
- tag.types.each do |value|
14
+ tag.types&.each do |value|
13
15
  parameter.add(value)
14
16
  end
15
- end
16
17
  object.add_parameter parameter
17
18
  end
18
19
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'puppet-strings/yard/code_objects'
2
4
 
3
5
  # Implements a parameter directive (e.g. #@!puppet.type.property) for documenting Puppet resource types.
@@ -5,14 +7,13 @@ class PuppetStrings::Yard::Tags::PropertyDirective < YARD::Tags::Directive
5
7
  # Called to invoke the directive.
6
8
  # @return [void]
7
9
  def call
8
- return unless object && object.respond_to?(:add_property)
10
+ return unless object&.respond_to?(:add_property)
11
+
9
12
  # Add a property to the resource
10
13
  property = PuppetStrings::Yard::CodeObjects::Type::Property.new(tag.name, tag.text)
11
- if tag.types
12
- tag.types.each do |value|
14
+ tag.types&.each do |value|
13
15
  property.add(value)
14
16
  end
15
- end
16
17
  object.add_property property
17
18
  end
18
19
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Implements a summary tag for general purpose short descriptions
2
4
 
3
5
  class PuppetStrings::Yard::Tags::SummaryTag < YARD::Tags::Tag
@@ -1,5 +1,5 @@
1
1
  # Initializes the template.
2
2
  # @return [void]
3
3
  def init
4
- sections :header, :box_info, :summary, :overview, :note, :todo, [T('tags'), :source]
4
+ sections :header, :box_info, :summary, :overview, [:note, :todo, T('tags'), :source]
5
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'puppet/util'
2
4
 
3
5
  # The module for various puppet-strings utility helpers.
@@ -24,8 +26,9 @@ module PuppetStrings::Yard::Util
24
26
  # @return [String] HTML document with links converted
25
27
  def self.github_to_yard_links(data)
26
28
  data.scan(/href\=\"\#(.+)\"/).each do |bad_link|
27
- data.gsub!("=\"##{bad_link.first}\"", "=\"#label-#{bad_link.first.capitalize.gsub('-', '+')}\"")
29
+ data = data.gsub("=\"##{bad_link.first}\"", "=\"#label-#{bad_link.first.capitalize.gsub('-', '+')}\"")
28
30
  end
31
+
29
32
  data
30
33
  end
31
34
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'puppet/application/face_base'
2
4
 
3
5
  # Implements the 'puppet strings' application.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'puppet/face'
2
4
 
3
5
  # Implements the 'puppet strings' interface.
@@ -57,6 +59,7 @@ Puppet::Face.define(:strings, '0.0.1') do
57
59
  environment = Puppet.lookup(:current_environment)
58
60
  environment.modules.each do |mod|
59
61
  next unless modules.empty? || modules.include?(mod.name)
62
+
60
63
  db = File.join(mod.path, '.yardoc')
61
64
  patterns = PuppetStrings::DEFAULT_SEARCH_PATTERNS.map do |p|
62
65
  File.join(mod.path, p)
@@ -145,7 +148,7 @@ Puppet::Face.define(:strings, '0.0.1') do
145
148
  def check_required_features
146
149
  raise RuntimeError, "The 'yard' gem must be installed in order to use this face." unless Puppet.features.yard?
147
150
  raise RuntimeError, "The 'rgen' gem must be installed in order to use this face." unless Puppet.features.rgen?
148
- raise RuntimeError, 'This face requires Ruby 1.9 or greater.' if RUBY_VERSION =~ /^1\.8/
151
+ raise RuntimeError, 'This face requires Ruby 1.9 or greater.' if RUBY_VERSION.match?(/^1\.8/)
149
152
  end
150
153
 
151
154
  # Builds the options to PuppetStrings.generate.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'puppet/util/feature'
2
4
 
3
5
  Puppet.features.add(:rgen, :libs => ['rgen/metamodel_builder', 'rgen/ecore/ecore'])
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'puppet/util/feature'
2
4
 
3
5
  Puppet.features.add(:yard, :libs => ['yard'])
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: 2.5.0
4
+ version: 2.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-16 00:00:00.000000000 Z
11
+ date: 2021-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: yard
@@ -235,15 +235,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
235
235
  requirements:
236
236
  - - ">="
237
237
  - !ruby/object:Gem::Version
238
- version: 2.1.0
238
+ version: 2.3.0
239
239
  required_rubygems_version: !ruby/object:Gem::Requirement
240
240
  requirements:
241
241
  - - ">="
242
242
  - !ruby/object:Gem::Version
243
243
  version: '0'
244
244
  requirements:
245
- - puppet, >= 4.0.0
246
- rubygems_version: 3.0.4
245
+ - puppet, >= 5.0.0
246
+ rubygems_version: 3.2.5
247
247
  signing_key:
248
248
  specification_version: 4
249
249
  summary: Puppet documentation via YARD