puppet-strings 2.1.0 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +78 -4
  3. data/CONTRIBUTING.md +32 -2
  4. data/README.md +81 -17
  5. data/lib/puppet-strings.rb +13 -4
  6. data/lib/puppet-strings/describe.rb +68 -0
  7. data/lib/puppet-strings/json.rb +2 -38
  8. data/lib/puppet-strings/markdown.rb +3 -1
  9. data/lib/puppet-strings/markdown/base.rb +37 -16
  10. data/lib/puppet-strings/markdown/data_type.rb +34 -0
  11. data/lib/puppet-strings/markdown/data_types.rb +41 -0
  12. data/lib/puppet-strings/markdown/function.rb +2 -2
  13. data/lib/puppet-strings/markdown/resource_type.rb +19 -2
  14. data/lib/puppet-strings/markdown/table_of_contents.rb +1 -0
  15. data/lib/puppet-strings/markdown/templates/classes_and_defines.erb +12 -4
  16. data/lib/puppet-strings/markdown/templates/data_type.erb +93 -0
  17. data/lib/puppet-strings/markdown/templates/data_type_function.erb +67 -0
  18. data/lib/puppet-strings/markdown/templates/function.erb +36 -1
  19. data/lib/puppet-strings/markdown/templates/puppet_task.erb +1 -1
  20. data/lib/puppet-strings/markdown/templates/resource_type.erb +32 -12
  21. data/lib/puppet-strings/markdown/templates/table_of_contents.erb +6 -6
  22. data/lib/puppet-strings/tasks/generate.rb +10 -3
  23. data/lib/puppet-strings/version.rb +1 -1
  24. data/lib/puppet-strings/yard.rb +16 -0
  25. data/lib/puppet-strings/yard/code_objects.rb +2 -0
  26. data/lib/puppet-strings/yard/code_objects/class.rb +2 -2
  27. data/lib/puppet-strings/yard/code_objects/data_type.rb +100 -0
  28. data/lib/puppet-strings/yard/code_objects/data_type_alias.rb +58 -0
  29. data/lib/puppet-strings/yard/code_objects/defined_type.rb +2 -2
  30. data/lib/puppet-strings/yard/code_objects/function.rb +4 -4
  31. data/lib/puppet-strings/yard/code_objects/plan.rb +2 -2
  32. data/lib/puppet-strings/yard/code_objects/provider.rb +1 -1
  33. data/lib/puppet-strings/yard/code_objects/task.rb +1 -1
  34. data/lib/puppet-strings/yard/code_objects/type.rb +48 -6
  35. data/lib/puppet-strings/yard/handlers.rb +3 -0
  36. data/lib/puppet-strings/yard/handlers/puppet/data_type_alias_handler.rb +24 -0
  37. data/lib/puppet-strings/yard/handlers/ruby/base.rb +12 -1
  38. data/lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb +393 -0
  39. data/lib/puppet-strings/yard/handlers/ruby/function_handler.rb +2 -12
  40. data/lib/puppet-strings/yard/handlers/ruby/provider_handler.rb +1 -9
  41. data/lib/puppet-strings/yard/handlers/ruby/rsapi_handler.rb +3 -3
  42. data/lib/puppet-strings/yard/handlers/ruby/type_base.rb +135 -0
  43. data/lib/puppet-strings/yard/handlers/ruby/type_extras_handler.rb +56 -0
  44. data/lib/puppet-strings/yard/handlers/ruby/type_handler.rb +9 -115
  45. data/lib/puppet-strings/yard/parsers/json/parser.rb +4 -2
  46. data/lib/puppet-strings/yard/parsers/puppet/parser.rb +14 -7
  47. data/lib/puppet-strings/yard/parsers/puppet/statement.rb +25 -0
  48. data/lib/puppet-strings/yard/tags.rb +2 -0
  49. data/lib/puppet-strings/yard/tags/enum_tag.rb +12 -0
  50. data/lib/puppet-strings/yard/tags/factory.rb +16 -0
  51. data/lib/puppet-strings/yard/tags/overload_tag.rb +2 -2
  52. data/lib/puppet-strings/yard/templates/default/fulldoc/html/full_list_puppet_data_type.erb +10 -0
  53. data/lib/puppet-strings/yard/templates/default/fulldoc/html/setup.rb +9 -0
  54. data/lib/puppet-strings/yard/templates/default/layout/html/objects.erb +2 -0
  55. data/lib/puppet-strings/yard/templates/default/layout/html/setup.rb +18 -1
  56. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/box_info.erb +10 -0
  57. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/header.erb +1 -0
  58. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/method_details_list.erb +6 -0
  59. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/note.erb +6 -0
  60. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/overview.erb +6 -0
  61. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/setup.rb +13 -0
  62. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/source.erb +12 -0
  63. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/summary.erb +4 -0
  64. data/lib/puppet-strings/yard/templates/default/puppet_data_type/html/todo.erb +6 -0
  65. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/alias_of.erb +10 -0
  66. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/box_info.erb +10 -0
  67. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/header.erb +1 -0
  68. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/note.erb +6 -0
  69. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/overview.erb +6 -0
  70. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/setup.rb +17 -0
  71. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/source.erb +12 -0
  72. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/summary.erb +4 -0
  73. data/lib/puppet-strings/yard/templates/default/puppet_data_type_alias/html/todo.erb +6 -0
  74. data/lib/puppet-strings/yard/templates/default/puppet_type/html/setup.rb +3 -1
  75. data/lib/puppet-strings/yard/templates/default/tags/html/enum.erb +17 -0
  76. data/lib/puppet-strings/yard/templates/default/tags/setup.rb +7 -0
  77. data/lib/puppet-strings/yard/util.rb +48 -0
  78. data/lib/puppet/face/strings.rb +68 -3
  79. metadata +36 -45
  80. data/Gemfile +0 -37
  81. data/HISTORY.md +0 -218
  82. data/JSON.md +0 -802
  83. data/Rakefile +0 -93
  84. data/codecov.yml +0 -3
  85. data/misc/ANNOUNCEMENT_TEMPLATE.md +0 -40
  86. data/spec/acceptance/emit_json_options.rb +0 -71
  87. data/spec/acceptance/generate_markdown_spec.rb +0 -49
  88. data/spec/acceptance/lib/util.rb +0 -163
  89. data/spec/acceptance/running_strings_generate.rb +0 -54
  90. data/spec/fixtures/acceptance/modules/test/functions/add.pp +0 -9
  91. data/spec/fixtures/acceptance/modules/test/lib/puppet/functions/4x_function.rb +0 -5
  92. data/spec/fixtures/acceptance/modules/test/lib/puppet/parser/functions/function3x.rb +0 -2
  93. data/spec/fixtures/acceptance/modules/test/lib/puppet/provider/server/linux.rb +0 -9
  94. data/spec/fixtures/acceptance/modules/test/lib/puppet/type/database.rb +0 -15
  95. data/spec/fixtures/acceptance/modules/test/manifests/init.pp +0 -27
  96. data/spec/fixtures/acceptance/modules/test/manifests/triple_nested_classes.pp +0 -27
  97. data/spec/fixtures/acceptance/modules/test/metadata.json +0 -6
  98. data/spec/fixtures/unit/json/output.json +0 -660
  99. data/spec/fixtures/unit/json/output_with_plan.json +0 -697
  100. data/spec/fixtures/unit/json/output_without_puppet_function.json +0 -480
  101. data/spec/fixtures/unit/markdown/output.md +0 -444
  102. data/spec/fixtures/unit/markdown/output_with_plan.md +0 -478
  103. data/spec/spec_helper.rb +0 -45
  104. data/spec/spec_helper_acceptance.rb +0 -28
  105. data/spec/unit/puppet-strings/json_spec.rb +0 -229
  106. data/spec/unit/puppet-strings/markdown/base_spec.rb +0 -146
  107. data/spec/unit/puppet-strings/markdown_spec.rb +0 -283
  108. data/spec/unit/puppet-strings/yard/code_objects/task_spec.rb +0 -92
  109. data/spec/unit/puppet-strings/yard/handlers/json/task_handler_spec.rb +0 -124
  110. data/spec/unit/puppet-strings/yard/handlers/puppet/class_handler_spec.rb +0 -217
  111. data/spec/unit/puppet-strings/yard/handlers/puppet/defined_type_handler_spec.rb +0 -231
  112. data/spec/unit/puppet-strings/yard/handlers/puppet/function_handler_spec.rb +0 -315
  113. data/spec/unit/puppet-strings/yard/handlers/ruby/function_handler_spec.rb +0 -729
  114. data/spec/unit/puppet-strings/yard/handlers/ruby/provider_handler_spec.rb +0 -139
  115. data/spec/unit/puppet-strings/yard/handlers/ruby/rsapi_handler_spec.rb +0 -214
  116. data/spec/unit/puppet-strings/yard/handlers/ruby/type_handler_spec.rb +0 -269
  117. data/spec/unit/puppet-strings/yard/parsers/json/parser_spec.rb +0 -70
  118. data/spec/unit/puppet-strings/yard/parsers/json/task_statement_spec.rb +0 -56
  119. data/spec/unit/puppet-strings/yard/parsers/puppet/parser_spec.rb +0 -209
  120. data/spec/unit/puppet-strings/yard/util_spec.rb +0 -48
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b656b5430c108d15ea909e2381ca758884b51c910505ab36880f76be538b5eff
4
- data.tar.gz: 6951a084211bbdc7d0d760865acae0e839ceadadd8df337d33938097083b4bc1
3
+ metadata.gz: 543437ac3fd3177245de47e563235b3f99194299f1c1cf14132bed3850de5056
4
+ data.tar.gz: 4aaa21554b916ca541ae3ce04a21ab34912375499347a816292858915aa803cf
5
5
  SHA512:
6
- metadata.gz: 0c359ad4b8a62e978e16f01cf17a50e86d9c011fc13ce3bde9757f2f57074d92c8df7b78119b88bd8551510adb3cf2cbe5adb5644e99e2415ed830d6744eccfe
7
- data.tar.gz: ed4d414529d500e4dfa696271e757c4daecd3df98c89ab83b2c7f956ac16a1392779c3fcf0d601d1c91c70a75a0e8745ce36bfef6679dac9f36a7cc3428aca76
6
+ metadata.gz: c73e04ec0c084f0000751eaa618ed5daa0efcfebf101e1d63832ab46403d0eff01ab628c028eae368097d2b3500c2e869d292c0fa07ad4eb68392773125b3ddf
7
+ data.tar.gz: 2a40adbd4874289129cecca5164f65ce3021a83a7cc3559bd6a6b28e3154020e1a9cd5a076c119827072feb47e2f6fe562924cfd63158f4c3e924ba132e0ddcd
@@ -3,16 +3,90 @@
3
3
  All significant changes to this repo will be summarized in this file.
4
4
 
5
5
 
6
- ## [v2.1.0](https://github.com/puppetlabs/puppet-strings/tree/v2.1.0) (2018-06-25)
6
+ ## [v2.5.0](https://github.com/puppetlabs/puppet-strings/tree/v2.5.0) (2020-07-15)
7
+
8
+ [Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/v2.4.0...v2.5.0)
9
+
10
+ Added
11
+
12
+ - \(GH-225\) Document functions in Puppet Datatypes [\#235](https://github.com/puppetlabs/puppet-strings/pull/235) ([glennsarti](https://github.com/glennsarti))
13
+ - Add checks to resource\_type handler and code objects [\#232](https://github.com/puppetlabs/puppet-strings/pull/232) ([scotje](https://github.com/scotje))
14
+ - \(\#227\) Inject `provider` into params list for types with providers [\#231](https://github.com/puppetlabs/puppet-strings/pull/231) ([scotje](https://github.com/scotje))
15
+
16
+ Fixed
17
+
18
+ - \(\#242\) Wrap names in backticks when rendering to markdown [\#243](https://github.com/puppetlabs/puppet-strings/pull/243) ([scotje](https://github.com/scotje))
19
+ - Eliminate trailing spaces w/o descriptions [\#224](https://github.com/puppetlabs/puppet-strings/pull/224) ([binford2k](https://github.com/binford2k))
20
+
21
+ **Closed issues:**
22
+
23
+ - text rendering as emojis in strings generated docs [\#242](https://github.com/puppetlabs/puppet-strings/issues/242)
24
+ - Puppet Classes not Listed in Left Frame Contents [\#241](https://github.com/puppetlabs/puppet-strings/issues/241)
25
+ - exec type in generated docs missing attributes `creates`, `onlyif` [\#229](https://github.com/puppetlabs/puppet-strings/issues/229)
26
+ - \[Feature\] Document functions in Puppet Datatypes [\#225](https://github.com/puppetlabs/puppet-strings/issues/225)
27
+ - Document usage [\#8](https://github.com/puppetlabs/puppet-strings/issues/8)
28
+ - Need a search box on the main page [\#1](https://github.com/puppetlabs/puppet-strings/issues/1)
29
+
30
+ ## [v2.4.0](https://github.com/puppetlabs/puppet-strings/tree/v2.4.0) (2020-02-20)
31
+
32
+ [Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/v2.3.1...v2.4.0)
33
+
34
+ Added
35
+
36
+ - Add missing HTML output support for enum tag [\#218](https://github.com/puppetlabs/puppet-strings/pull/218) ([seanmil](https://github.com/seanmil))
37
+ - \(PDOC-295\) Add @enum tag support for Enum data types [\#215](https://github.com/puppetlabs/puppet-strings/pull/215) ([seanmil](https://github.com/seanmil))
38
+ - Expanded default search glob for plans. [\#214](https://github.com/puppetlabs/puppet-strings/pull/214) ([Raskil](https://github.com/Raskil))
39
+
40
+ **Merged pull requests:**
41
+
42
+ - \(MAINT\) Release prep for 2.4.0 [\#221](https://github.com/puppetlabs/puppet-strings/pull/221) ([scotje](https://github.com/scotje))
43
+
44
+ ## [v2.3.1](https://github.com/puppetlabs/puppet-strings/tree/v2.3.1) (2019-09-23)
45
+
46
+ [Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/v2.3.0...v2.3.1)
47
+
48
+ Fixed
49
+
50
+ - \(maint\) Use parameters method instead of json\['parameters'\] [\#211](https://github.com/puppetlabs/puppet-strings/pull/211) ([lucywyman](https://github.com/lucywyman))
51
+ - \(PDOC-285\) Fix data\_type\_handler for errors and numbers [\#209](https://github.com/puppetlabs/puppet-strings/pull/209) ([glennsarti](https://github.com/glennsarti))
52
+
53
+ ## [v2.3.0](https://github.com/puppetlabs/puppet-strings/tree/v2.3.0) (2019-07-17)
54
+
55
+ [Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/v2.2.0...v2.3.0)
56
+
57
+ Added
58
+
59
+ - Add Puppet Data Type documentation [\#199](https://github.com/puppetlabs/puppet-strings/pull/199) ([glennsarti](https://github.com/glennsarti))
60
+
61
+ Fixed
62
+
63
+ - \(PDOC-283\) Fix namespaced symbols [\#205](https://github.com/puppetlabs/puppet-strings/pull/205) ([glennsarti](https://github.com/glennsarti))
64
+
65
+ ## [v2.2.0](https://github.com/puppetlabs/puppet-strings/tree/v2.2.0) (2019-04-05)
66
+
67
+ [Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/v2.1.0...v2.2.0)
68
+
69
+ Added
70
+
71
+ - \(PDOC-272\) Add required features attribute [\#194](https://github.com/puppetlabs/puppet-strings/pull/194) ([kris-bosland](https://github.com/kris-bosland))
72
+ - \(maint\) Implement a strings:generate:reference task [\#192](https://github.com/puppetlabs/puppet-strings/pull/192) ([ekohl](https://github.com/ekohl))
73
+ - \(PDOC-265\) Add examples to function reference docs [\#188](https://github.com/puppetlabs/puppet-strings/pull/188) ([ekohl](https://github.com/ekohl))
74
+ - \(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))
75
+
76
+ Fixed
77
+
78
+ - \(PDOC-266\) Silence 'unexpected construct regexp\_literal' warning [\#189](https://github.com/puppetlabs/puppet-strings/pull/189) ([seanmil](https://github.com/seanmil))
79
+
80
+ ## [v2.1.0](https://github.com/puppetlabs/puppet-strings/tree/v2.1.0) (2018-06-26)
7
81
 
8
82
  [Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/2.0.0...v2.1.0)
9
83
 
10
- **Implemented enhancements:**
84
+ Added
11
85
 
12
86
  - \(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
87
  - \(PDOC-255\) markdown table of contents update [\#181](https://github.com/puppetlabs/puppet-strings/pull/181) ([eputnam](https://github.com/eputnam))
14
88
 
15
- **Merged pull requests:**
89
+ Fixed
16
90
 
17
91
  - \(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
92
 
@@ -236,4 +310,4 @@ All related tickets can be found under the [PDOC][PDOC JIRA] JIRA project with t
236
310
  - Strings will no longer crash when documenting 3x functions with less than two arguments passed into newfunction **(PDOC-27)**
237
311
 
238
312
 
239
- \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
313
+ \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
@@ -7,13 +7,44 @@ that we can have a chance of keeping on top of things.
7
7
 
8
8
  ## Getting Started
9
9
 
10
- * Make sure you have a [Jira account](http://tickets.puppetlabs.com)
11
10
  * Make sure you have a [GitHub account](https://github.com/signup/free)
12
11
  * Submit a ticket for your issue, assuming one does not already exist.
13
12
  * Clearly describe the issue including steps to reproduce when it is a bug.
14
13
  * Make sure you fill in the earliest version that you know has the issue.
15
14
  * Fork the repository on GitHub
16
15
 
16
+ ## Submit an issue
17
+
18
+ We use GitHub Issues for issue tracking on puppet-strings.
19
+
20
+ Before you submit your issue, take a minute to...
21
+
22
+ 1. **Use the GitHub issue search** — check if the issue has already been
23
+ reported.
24
+
25
+ 2. **Check if the issue has been fixed** — try to reproduce it using the
26
+ latest `master` or release tag.
27
+
28
+ A good bug report shouldn't leave others needing to chase you up for more
29
+ information. Please try to be as **detailed as possible** in your issue. What is
30
+ your environment? What steps will reproduce the issue?
31
+
32
+ Example:
33
+
34
+ > Short and descriptive example issue title
35
+ >
36
+ > A summary of the issue with details about the environment it occurs in (Ruby version, Puppet version, Strings version, etc). If
37
+ > suitable, include the steps required to reproduce the bug.
38
+ >
39
+ > 1. This is the first step
40
+ > 2. This is the second step
41
+ > 3. Further steps, etc.
42
+ >
43
+ > Any other information you want to share that is relevant to the issue being
44
+ > reported. This might include the lines of code that you have identified as
45
+ > causing the bug, and potential solutions (and your opinions on their
46
+ > merits).
47
+
17
48
  ## Making Changes
18
49
 
19
50
  * Create a topic branch from where you want to base your work.
@@ -98,7 +129,6 @@ To cut a new release, from a current `master` checkout:
98
129
  # Additional Resources
99
130
 
100
131
  * [More information on contributing](http://links.puppet.com/contribute-to-puppet)
101
- * [Bug tracker (Jira)](http://tickets.puppet.com)
102
132
  * [Contributor License Agreement](http://links.puppet.com/cla)
103
133
  * [General GitHub documentation](http://help.github.com/)
104
134
  * [GitHub pull request documentation](http://help.github.com/send-pull-requests/)
data/README.md CHANGED
@@ -8,36 +8,43 @@ Puppet Strings generates documentation for Puppet code and extensions written in
8
8
  | | |
9
9
  | -------------- |---------------------------------------------------------------- |
10
10
  | *Code* | [GitHub][repo] |
11
- | *Issues* | [Puppet JIRA Tracker][JIRA] |
11
+ | *Issues* | [GitHub issues][issues] |
12
12
  | *License* | [Apache 2.0][LICENSE] |
13
13
  | *Change log* | [CHANGELOG.md][changelog] |
14
14
  | *Contributing* | [CONTRIBUTING.md][contributing] and [COMMITTERS.md][committers] |
15
15
 
16
- [repo]: https://github.com/puppetlabs/puppet-strings
17
- [JIRA]: https://tickets.puppetlabs.com/browse/PDOC
18
- [LICENSE]: https://github.com/puppetlabs/puppet-strings/blob/master/LICENSE
19
- [changelog]: https://github.com/puppetlabs/puppet-strings/blob/master/CHANGELOG.md
20
- [contributing]: https://github.com/puppetlabs/puppet-strings/blob/master/CONTRIBUTING.md
21
- [committers]: https://github.com/puppetlabs/puppet-strings/blob/master/COMMITTERS.md
22
-
23
16
  ## Installing Puppet Strings
24
17
 
25
18
  ### Requirements
26
19
 
27
20
  * Ruby 2.1.9 or newer
28
- * Puppet 4.0 or newer
29
- * The `yard` Ruby gem
21
+ * Puppet 4.0.0 or newer
30
22
 
31
23
  ### Install Puppet Strings
32
24
 
33
- 1. Install the YARD gem by running `gem install yard`
34
- 1. Install the `puppet-strings` gem by running `gem install puppet-strings`
35
- 1. **Optional**: Set YARD options for Strings
25
+ Installation instructions vary slightly depending on how you have installed Puppet:
26
+
27
+ #### Installing Puppet Strings with [`puppet-agent`](https://puppet.com/docs/puppet/6.4/about_agent.html#what-puppet-agent-and-puppetserver-are) package
28
+
29
+ Install the `puppet-strings` gem into the `puppet-agent` environment:
30
+
31
+ ```
32
+ sudo /opt/puppetlabs/puppet/bin/gem install puppet-strings
33
+ ```
34
+
35
+ #### Installing Puppet Strings with standalone `puppet` gem
36
36
 
37
- To use YARD options with Puppet Strings, specify a `yardopts` file in the same directory in which you run `puppet strings`. Puppet Strings supports the Markdown format and automatically sets the YARD `markup` option to `markdown`.
37
+ Install the `puppet-strings` gem into the same Ruby installation where you have installed the `puppet` gem:
38
38
 
39
- To see a list of available YARD options, run `yard help doc`. For details about YARD options configuration, see the [YARD docs](http://www.rubydoc.info/gems/yard/file/docs/GettingStarted.md#config).
39
+ ```
40
+ gem install puppet-strings
41
+ ```
40
42
 
43
+ ### Configure Puppet Strings (Optional)
44
+
45
+ To use YARD options with Puppet Strings, specify a `.yardopts` file in the same directory in which you run `puppet strings`. Puppet Strings supports the Markdown format and automatically sets the YARD `markup` option to `markdown`.
46
+
47
+ To see a list of available YARD options, run `yard help doc`. For details about YARD options configuration, see the [YARD docs](http://www.rubydoc.info/gems/yard/file/docs/GettingStarted.md#config).
41
48
 
42
49
  ## Generating documentation with Puppet Strings
43
50
 
@@ -74,12 +81,69 @@ To run specs, run the `spec` rake task:
74
81
  $ bundle install --path .bundle/gems
75
82
  $ bundle exec rake spec
76
83
 
84
+ ### Running Acceptance Tests
85
+
86
+ We are experimenting with a new tool for running acceptance tests. It's name is [puppet_litmus](https://github.com/puppetlabs/puppet_litmus) and replaces beaker as the test runner.
87
+
88
+ An example of running the acceptance tests locally with Docker:
89
+
90
+ 1. Ensure [Docker](https://www.docker.com/products/docker-desktop) is installed and running.
91
+
92
+ 2. Install Ruby gems. This step can be skipped if you have already followed the [Running Specs](#running-specs) instructions
93
+
94
+ ``` text
95
+ $ bundle install --path .bundle/gems
96
+ ```
97
+
98
+ 3. Provision a docker container, in this case CentOS 7
99
+
100
+ ``` text
101
+ $ bundle exec rake litmus:provision[docker, centos:7]
102
+ ```
103
+
104
+ 4. Install test items; Puppet Agent, our test module, and the puppet-strings gem built from this source code
105
+
106
+ ``` text
107
+ $ bundle exec rake litmus:install_agent[puppet6]
108
+ $ bundle exec rake litmus:install_module_fixtures
109
+ $ bundle exec rake litmus:install_gems
110
+ ```
111
+
112
+ 5. Run the acceptance tests. These tests can be run more than once without the need to run the provisioning steps again
113
+
114
+ ``` text
115
+ $ bundle exec rake litmus:acceptance:parallel
116
+ ```
117
+
118
+ 6. Remove any test containers
119
+
120
+ ``` text
121
+ $ bundle exec rake litmus:tear_down
122
+ ```
123
+
124
+ The [Litmus Wiki](https://github.com/puppetlabs/puppet_litmus/wiki) contains more indepth information about Litmus. There is also a tutorial on using Litmus with an example [Puppet Module](https://github.com/puppetlabs/puppet_litmus/wiki/Tutorial:-use-Litmus-to-execute-acceptance-tests-with-a-sample-module-(MoTD)#install-the-necessary-gems-for-the-module)
125
+
126
+
127
+ An example of run the acceptance tests follow the instructions [here].
128
+
77
129
  ## Support
78
130
 
79
- Please log tickets and issues in our [JIRA tracker][JIRA]. A [mailing list](https://groups.google.com/forum/?fromgroups#!forum/puppet-users) is available for asking questions and getting help from others.
131
+ Please log issues in [GitHub issues][issues]. Check out [CONTRIBUTING.md][contributing] for tips on writing _the best_ issues.
80
132
 
81
- There is also an active #puppet channel on the Freenode IRC network.
133
+ A [mailing list](https://groups.google.com/forum/?fromgroups#!forum/puppet-users) is available for asking questions and getting help from others.
134
+
135
+ There is also an active community on the [Puppet community Slack][] in the #forge-modules channel.
82
136
 
83
137
  We use semantic version numbers for our releases and recommend that users upgrade to patch releases and minor releases as they become available.
84
138
 
85
139
  Bug fixes and ongoing development will occur in minor releases for the current major version. Security fixes will be ported to a previous major version on a best-effort basis, until the previous major version is no longer maintained.
140
+
141
+
142
+ [repo]: https://github.com/puppetlabs/puppet-strings
143
+ [issues]: https://github.com/puppetlabs/puppet-strings/issues
144
+ [LICENSE]: https://github.com/puppetlabs/puppet-strings/blob/master/LICENSE
145
+ [changelog]: https://github.com/puppetlabs/puppet-strings/blob/master/CHANGELOG.md
146
+ [contributing]: https://github.com/puppetlabs/puppet-strings/blob/master/CONTRIBUTING.md
147
+ [committers]: https://github.com/puppetlabs/puppet-strings/blob/master/COMMITTERS.md
148
+ [Puppet community Slack]: https://slack.puppet.com
149
+
@@ -7,7 +7,7 @@ module PuppetStrings
7
7
  types/**/*.pp
8
8
  lib/**/*.rb
9
9
  tasks/*.json
10
- plans/*.pp
10
+ plans/**/*.pp
11
11
  ).freeze
12
12
 
13
13
  # Generates documentation.
@@ -27,8 +27,9 @@ module PuppetStrings
27
27
 
28
28
  # Format the arguments to YARD
29
29
  args = ['doc']
30
+ args << '--no-progress'
30
31
  args << '--debug' if options[:debug]
31
- args << '--backtrace' if options[:backtrace]
32
+ args << '--backtrace' if options[:debug]
32
33
  args << "-m#{options[:markup] || 'markdown'}"
33
34
 
34
35
  file = nil
@@ -42,7 +43,6 @@ module PuppetStrings
42
43
  args << '-n'
43
44
  args << '-q' unless file
44
45
  args << '--no-stats' unless file
45
- args << '--no-progress' unless file
46
46
  end
47
47
 
48
48
  yard_args = options[:yard_args]
@@ -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
@@ -8,6 +8,8 @@ module PuppetStrings::Json
8
8
  def self.render(file = nil)
9
9
  document = {
10
10
  puppet_classes: YARD::Registry.all(:puppet_class).sort_by!(&:name).map!(&:to_hash),
11
+ data_types: YARD::Registry.all(:puppet_data_type).sort_by!(&:name).map!(&:to_hash),
12
+ data_type_aliases: YARD::Registry.all(:puppet_data_type_alias).sort_by!(&:name).map!(&:to_hash),
11
13
  defined_types: YARD::Registry.all(:puppet_defined_type).sort_by!(&:name).map!(&:to_hash),
12
14
  resource_types: YARD::Registry.all(:puppet_type).sort_by!(&:name).map!(&:to_hash),
13
15
  providers: YARD::Registry.all(:puppet_provider).sort_by!(&:name).map!(&:to_hash),
@@ -26,42 +28,4 @@ module PuppetStrings::Json
26
28
  puts JSON.pretty_generate(document)
27
29
  end
28
30
  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
31
  end