puppet-strings 2.6.0 → 2.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9aa1aa13861fd95a237ca2abd1ef890dfbcba1b7757c2dd609d648b803df7a33
4
- data.tar.gz: 55d8b1903917fcd24fbb53dbe1433449a75eb88544071fdf0e2bf2d0eeb2fe11
3
+ metadata.gz: 9397d83c2092aed842ea468c79012270659c27b5c9ad85e1a67f614ca3fef2a2
4
+ data.tar.gz: 65bc26d31881eefbb6de381a29afe1de4274bfeb2f1748969af60f9e30dcb9fe
5
5
  SHA512:
6
- metadata.gz: 394ad674391503b4a894857035fbe190678bba4b264d6093935005b22322beda448fb38470ba92acedb191e1faec8dab01ccd0cc14ba807ca5b39cc6bff6b2fc
7
- data.tar.gz: 420511c57607c8d76eb2d3e8b6417a84d3ac4247c3fc64ddd83a23fa50aba570b1e984e1a67a3c56c929c4ac8aeebf84726cd14e39ad689405ee8726281ae1dd
6
+ metadata.gz: a20053eca0ac726c86ea1b21596f1c66a98f9a28679ee00c4d9b64afe30d3f9fa9ce9d67bec6dd28ef9ff4c5c70f8f0b075d43c5d07c87c382265433bda13993
7
+ data.tar.gz: a476bfcc359d3e2603902f080a7d54f4e80b04d18b470dc0e8980c20cc7b4452e44ea7e344db4bf7702ce5c3b9aa7745d52d75e5cadc5991313d596de97f0d4a
data/CHANGELOG.md CHANGED
@@ -3,6 +3,62 @@
3
3
  All significant changes to this repo will be summarized in this file.
4
4
 
5
5
 
6
+ ## [v2.9.0](https://github.com/puppetlabs/puppet-strings/tree/v2.9.0) (2021-11-29)
7
+
8
+ [Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/v2.8.0...v2.9.0)
9
+
10
+ Added
11
+
12
+ - Add strings:validate:reference task [\#293](https://github.com/puppetlabs/puppet-strings/issues/293)
13
+
14
+ Fixed
15
+
16
+ - Fix rare undefined method `any?' for nil:NilClass error [\#289](https://github.com/puppetlabs/puppet-strings/pull/289) ([sanfrancrisko](https://github.com/sanfrancrisko))
17
+
18
+ **Closed issues:**
19
+
20
+ - Error: undefined method `any?' for nil:NilClass when generating documentation [\#287](https://github.com/puppetlabs/puppet-strings/issues/287)
21
+ - Update changelog with recent commits [\#283](https://github.com/puppetlabs/puppet-strings/issues/283)
22
+ - Please document the `author` tag [\#256](https://github.com/puppetlabs/puppet-strings/issues/256)
23
+
24
+ **Merged pull requests:**
25
+
26
+ - Implement a strings:validate:reference task [\#291](https://github.com/puppetlabs/puppet-strings/pull/291) ([ekohl](https://github.com/ekohl))
27
+
28
+ ## [v2.8.0](https://github.com/puppetlabs/puppet-strings/tree/v2.8.0) (2021-07-19)
29
+
30
+ [Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/v2.7.0...v2.8.0)
31
+
32
+ Added
33
+
34
+ - \(DOCUMENT-1232\) Add support for ensurable in types\_extras\_handler [\#281](https://github.com/puppetlabs/puppet-strings/pull/281) ([joshcooper](https://github.com/joshcooper))
35
+
36
+ **Merged pull requests:**
37
+
38
+ - \(FIXUP\) Check for nil before injecting provider param into Types [\#285](https://github.com/puppetlabs/puppet-strings/pull/285) ([scotje](https://github.com/scotje))
39
+ - README.md: update link to docs [\#276](https://github.com/puppetlabs/puppet-strings/pull/276) ([kenyon](https://github.com/kenyon))
40
+
41
+ ## [v2.7.0](https://github.com/puppetlabs/puppet-strings/tree/v2.7.0) (2021-05-17)
42
+
43
+ [Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/v2.6.0...v2.7.0)
44
+
45
+ Added
46
+
47
+ - Add supported\_features to puppet strings input/output for types [\#228](https://github.com/puppetlabs/puppet-strings/issues/228)
48
+
49
+ Fixed
50
+
51
+ - `file` type is missing `ensure` in generated reference docs [\#230](https://github.com/puppetlabs/puppet-strings/issues/230)
52
+
53
+ **Closed issues:**
54
+
55
+ - class with "apply" attribute causes parser error [\#251](https://github.com/puppetlabs/puppet-strings/issues/251)
56
+
57
+ **Merged pull requests:**
58
+
59
+ - Update CODEOWNERS [\#272](https://github.com/puppetlabs/puppet-strings/pull/272) ([binford2k](https://github.com/binford2k))
60
+ - Only set tasks = true when parsing plans. [\#266](https://github.com/puppetlabs/puppet-strings/pull/266) ([binford2k](https://github.com/binford2k))
61
+
6
62
  ## [v2.6.0](https://github.com/puppetlabs/puppet-strings/tree/v2.6.0) (2021-01-18)
7
63
 
8
64
  [Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/v2.5.0...v2.6.0)
@@ -17,6 +73,7 @@ Fixed
17
73
  - Handle a missing description gracefully [\#260](https://github.com/puppetlabs/puppet-strings/pull/260) ([scotje](https://github.com/scotje))
18
74
  - Fix ERB failure - parameters without descriptions [\#255](https://github.com/puppetlabs/puppet-strings/pull/255) ([trevor-vaughan](https://github.com/trevor-vaughan))
19
75
  - puppet\_function template: fix tags, source [\#249](https://github.com/puppetlabs/puppet-strings/pull/249) ([raemer](https://github.com/raemer))
76
+ - Handle a missing description gracefully [\#246](https://github.com/puppetlabs/puppet-strings/pull/246) ([ekohl](https://github.com/ekohl))
20
77
 
21
78
  Changed
22
79
 
@@ -26,7 +83,6 @@ Changed
26
83
 
27
84
  - Tags \(Parameter, Returns\) not generated in HTML output [\#248](https://github.com/puppetlabs/puppet-strings/issues/248)
28
85
  - Can we get 2.5.0 released please [\#244](https://github.com/puppetlabs/puppet-strings/issues/244)
29
- - Add supported\_features to puppet strings input/output for types [\#228](https://github.com/puppetlabs/puppet-strings/issues/228)
30
86
  - Provider attribute is missing in generated types documentation [\#227](https://github.com/puppetlabs/puppet-strings/issues/227)
31
87
 
32
88
  ## [v2.5.0](https://github.com/puppetlabs/puppet-strings/tree/v2.5.0) (2020-07-16)
@@ -36,6 +92,7 @@ Changed
36
92
  Added
37
93
 
38
94
  - \(GH-225\) Document functions in Puppet Datatypes [\#235](https://github.com/puppetlabs/puppet-strings/pull/235) ([glennsarti](https://github.com/glennsarti))
95
+ - Add checks to resource\_type handler and code objects [\#232](https://github.com/puppetlabs/puppet-strings/pull/232) ([scotje](https://github.com/scotje))
39
96
  - \(\#227\) Inject `provider` into params list for types with providers [\#231](https://github.com/puppetlabs/puppet-strings/pull/231) ([scotje](https://github.com/scotje))
40
97
 
41
98
  Fixed
@@ -62,7 +119,6 @@ Fixed
62
119
 
63
120
  Added
64
121
 
65
- - Add checks to resource\_type handler and code objects [\#232](https://github.com/puppetlabs/puppet-strings/pull/232) ([scotje](https://github.com/scotje))
66
122
  - Add missing HTML output support for enum tag [\#218](https://github.com/puppetlabs/puppet-strings/pull/218) ([seanmil](https://github.com/seanmil))
67
123
  - \(PDOC-295\) Add @enum tag support for Enum data types [\#215](https://github.com/puppetlabs/puppet-strings/pull/215) ([seanmil](https://github.com/seanmil))
68
124
  - Expanded default search glob for plans. [\#214](https://github.com/puppetlabs/puppet-strings/pull/214) ([Raskil](https://github.com/Raskil))
@@ -88,6 +144,10 @@ Added
88
144
 
89
145
  - Add Puppet Data Type documentation [\#199](https://github.com/puppetlabs/puppet-strings/pull/199) ([glennsarti](https://github.com/glennsarti))
90
146
 
147
+ Fixed
148
+
149
+ - \(PDOC-283\) Fix namespaced symbols [\#205](https://github.com/puppetlabs/puppet-strings/pull/205) ([glennsarti](https://github.com/glennsarti))
150
+
91
151
  ## [v2.2.0](https://github.com/puppetlabs/puppet-strings/tree/v2.2.0) (2019-04-05)
92
152
 
93
153
  [Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/v2.1.0...v2.2.0)
@@ -101,7 +161,6 @@ Added
101
161
 
102
162
  Fixed
103
163
 
104
- - \(PDOC-283\) Fix namespaced symbols [\#205](https://github.com/puppetlabs/puppet-strings/pull/205) ([glennsarti](https://github.com/glennsarti))
105
164
  - \(PDOC-266\) Silence 'unexpected construct regexp\_literal' warning [\#189](https://github.com/puppetlabs/puppet-strings/pull/189) ([seanmil](https://github.com/seanmil))
106
165
 
107
166
  ## [v2.1.0](https://github.com/puppetlabs/puppet-strings/tree/v2.1.0) (2018-06-26)
@@ -233,7 +292,7 @@ All related tickets can be found under the [PDOC][PDOC JIRA] JIRA project with t
233
292
  - Note: this means Markdown text in YARD comments and tags, not a change in the output of strings
234
293
  - New commandline options: --emit-json and --emit-json-stdout to generate JSON documentation **(PDOC-84)**
235
294
  - Runtime dependency on Puppet has been removed, allowing strings to function in Puppet Enterprise 3.8 **(PDOC-80)**
236
- - Note that the gem still requires puppet. We recommend that the strings gem be installed with puppet, as suggested in the [README](https://github.com/puppetlabs/puppet-strings/blob/master/README.md#installing-puppet-strings)
295
+ - Note that the gem still requires puppet. We recommend that the strings gem be installed with puppet, as suggested in the [README](https://github.com/puppetlabs/puppet-strings/blob/main/README.md#installing-puppet-strings)
237
296
  - New gemspec requirement on Ruby version 1.9.3, the oldest supported Ruby version
238
297
 
239
298
  ### BugFixes
@@ -253,8 +312,8 @@ All related tickets can be found under the [PDOC][PDOC JIRA] JIRA project with t
253
312
  ### Features
254
313
  - Support for JSON output **(PDOC-23)**
255
314
  - Strings now has the ability to produce a JSON representation of a given puppet module
256
- - The details of the JSON schema can be found [here](https://github.com/puppetlabs/puppet-strings/blob/master/json_dom.md)
257
- - For details on how to generate JSON, see the [README](https://github.com/puppetlabs/puppet-strings/blob/master/README.md#running-puppet-strings)
315
+ - The details of the JSON schema can be found [here](https://github.com/puppetlabs/puppet-strings/blob/main/json_dom.md)
316
+ - For details on how to generate JSON, see the [README](https://github.com/puppetlabs/puppet-strings/blob/main/README.md#running-puppet-strings)
258
317
  - Migrate to ruby gems as a distribution method **(PDOC-28)**
259
318
  - This is the last release of strings that will be available as a puppet module
260
319
  - The 0.4.0 release will be released concurrently as a ruby gem
data/COMMITTERS.md CHANGED
@@ -4,7 +4,7 @@ Committing changes to Strings
4
4
  We would like to make it easier for community members to contribute to strings
5
5
  using pull requests, even if it makes the task of reviewing and committing
6
6
  these changes a little harder. Pull requests are only ever based on a single
7
- branch. As a result contributors should target their changes at the master branch.
7
+ branch. As a result contributors should target their changes at the main branch.
8
8
  This makes the process of contributing a little easier for the contributor since
9
9
  they don't need to concern themselves with the question, "What branch do I base my changes
10
10
  on?" This is already called out in the [CONTRIBUTING.md](http://goo.gl/XRH2J).
@@ -17,7 +17,7 @@ effort to make sure the end users must opt-in to new behavior that is
17
17
  incompatible with previous behavior. We employ the use of [feature
18
18
  flags](http://stackoverflow.com/questions/7707383/what-is-a-feature-flag) as
19
19
  the primary way to achieve this user opt-in behavior. Finally, it is the
20
- responsibility of the committer to make sure the `master` branch
20
+ responsibility of the committer to make sure the `main` branch
21
21
  is clean and working at all times. Clean means that dead code is not
22
22
  allowed, everything needs to be usable in some manner at all points in time.
23
23
 
@@ -45,9 +45,9 @@ making the decision what base branch to merge the change set into.
45
45
 
46
46
  **base branch** - A branch in Git that contains an active history of changes
47
47
  and will eventually be released using semantic version guidelines. The branch
48
- named `master` will always exist as a base branch.
48
+ named `main` will always exist as a base branch.
49
49
 
50
- **master branch** - The branch where new functionality that and bug fixes are
50
+ **main branch** - The branch where new functionality that and bug fixes are
51
51
  merged.
52
52
 
53
53
  **security** - Where critical security fixes are merged. These change sets
@@ -70,7 +70,7 @@ This section provides a guide to help a committer decide the specific base
70
70
  branch that a change set should be merged into.
71
71
 
72
72
  The latest minor release of a major release is the only base branch that should
73
- be patched. These patches will be merged into `master` if they contain new
73
+ be patched. These patches will be merged into `main` if they contain new
74
74
  functionality and if they fix a critical bug. Older minor releases in a major release
75
75
  do not get patched.
76
76
 
@@ -87,7 +87,7 @@ security branch as the base branch. Please send all security related
87
87
  information or patches to security@puppet.com as per our [Security
88
88
  Policy](https://puppet.com/security/).
89
89
 
90
- The CI systems are configured to run against `master`. Over time, this branch
90
+ The CI systems are configured to run against `main`. Over time, this branch
91
91
  will refer to different versions, but its name will remain fixed to avoid having
92
92
  to update CI jobs and tasks as new versions are released.
93
93
 
@@ -108,7 +108,7 @@ branch:
108
108
  documentation being kept up to date?
109
109
  * Does the change set include clean code? (software code that is formatted
110
110
  correctly and in an organized manner so that another coder can easily read
111
- or modify it.) HINT: `git diff master --check`
111
+ or modify it.) HINT: `git diff main --check`
112
112
  * Does the change set conform to the contributing guide?
113
113
 
114
114
  Commit citizen guidelines:
@@ -118,13 +118,13 @@ This section aims to provide guidelines for being a good commit citizen by
118
118
  paying attention to our automated build tools.
119
119
 
120
120
  * Don’t push on a broken build. (A broken build is defined as a failing job
121
- in [Puppet Strings](https://jenkins.puppetlabs.com/job/platform_puppet-strings_unit-ruby_master/)
121
+ in [Puppet Strings](https://travis-ci.com/github/puppetlabs/puppet-strings)
122
122
  page.)
123
123
  * Watch the build until your changes have gone through green
124
124
  * Update the ticket status and target version. The target version field in
125
125
  our issue tracker should be updated to be the next release of Puppet. For
126
126
  example, if the most recent release of Puppet is 3.1.1 and you merge a
127
- backwards compatible change set into master, then the target version should
127
+ backwards compatible change set into main, then the target version should
128
128
  be 3.2.0 in the issue tracker.)
129
129
  * Ensure the pull request is closed (Hint: amend your merge commit to contain
130
130
  the string `closes #123` where 123 is the pull request number and github
@@ -135,7 +135,7 @@ Example Procedure
135
135
 
136
136
  This section helps a committer rebase and merge a contribution into the base branch.
137
137
 
138
- Suppose a contributor submits a pull request based on master. The change set
138
+ Suppose a contributor submits a pull request based on main. The change set
139
139
  fixes a bug reported against strings 0.1.0 which is the most recently released
140
140
  version of strings.
141
141
 
@@ -147,20 +147,20 @@ branch to track the remote branch.
147
147
  Branch jeffmccune-pdoc-34_fix_foo_error set up to track remote branch pdoc-34-fix_foo_error from jeffmccune.
148
148
  Switched to a new branch 'jeffmccune-pdoc-34_fix_foo_error'
149
149
 
150
- It's possible that more changes have been merged into master since the pull
150
+ It's possible that more changes have been merged into main since the pull
151
151
  request was submitted. In this case it may be necessary to rebase the branch
152
152
  that contains the changes:
153
153
 
154
- $ git rebase upstream/master
154
+ $ git rebase upstream/main
155
155
 
156
156
  After the branch has been checked out and rebased, the committer should ensure that
157
157
  the code review check list has been completed.
158
158
 
159
159
  Now that we have a topic branch containing the change set based on the most recent
160
- `master` branch, the committer merges in:
160
+ `main` branch, the committer merges in:
161
161
 
162
- $ git checkout master
163
- Switched to branch 'master'
162
+ $ git checkout main
163
+ Switched to branch 'main'
164
164
  $ git merge --no-ff --log jeffmccune-pdoc-34_fix_foo_error
165
165
  Merge made by the 'recursive' strategy.
166
166
  foo | 0
@@ -173,12 +173,12 @@ preserve the usefulness of `git branch --contains`. If there are any merge
173
173
  conflicts, they are to be resolved in the merge commit itself and not by
174
174
  re-writing (rebasing) the patches for one base branch, but not another.
175
175
 
176
- Once the change set has been merged into `master`, the committer pushes.
176
+ Once the change set has been merged into `main`, the committer pushes.
177
177
  Please note, the checklist should be complete at this point. It's helpful to make
178
178
  sure your local branches are up to date to avoid one of the branches failing to fast
179
179
  forward while the other succeeds.
180
180
 
181
- $ git push origin master:master
181
+ $ git push origin main:main
182
182
 
183
183
  That's it! The committer then updates the pull request, updates the issue in
184
184
  our issue tracker, and keeps an eye on the [build
data/CONTRIBUTING.md CHANGED
@@ -23,7 +23,7 @@ Before you submit your issue, take a minute to...
23
23
  reported.
24
24
 
25
25
  2. **Check if the issue has been fixed** — try to reproduce it using the
26
- latest `master` or release tag.
26
+ latest `main` or release tag.
27
27
 
28
28
  A good bug report shouldn't leave others needing to chase you up for more
29
29
  information. Please try to be as **detailed as possible** in your issue. What is
@@ -48,12 +48,12 @@ Example:
48
48
  ## Making Changes
49
49
 
50
50
  * Create a topic branch from where you want to base your work.
51
- * This is usually the master branch.
51
+ * This is usually the main branch.
52
52
  * Only target release branches if you are certain your fix must be on that
53
53
  branch.
54
- * To quickly create a topic branch based on master; `git checkout -b
55
- fix/master/my_contribution master`. Please avoid working directly on the
56
- `master` branch.
54
+ * To quickly create a topic branch based on main; `git checkout -b
55
+ fix/main/my_contribution main`. Please avoid working directly on the
56
+ `main` branch.
57
57
  * Make commits of logical units.
58
58
  * Check for unnecessary whitespace with `git diff --check` before committing.
59
59
  * Make sure your commit messages are in the proper format.
@@ -109,7 +109,7 @@ a ticket number.
109
109
 
110
110
  ## Cutting a release
111
111
 
112
- To cut a new release, from a current `master` checkout:
112
+ To cut a new release, from a current `main` checkout:
113
113
 
114
114
  * Start the release branch with `git checkout -b release-prep`
115
115
  * Update `lib/puppet-strings/version.rb` to the new version
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  Puppet Strings
2
2
  ==============
3
- [![Build Status](https://travis-ci.org/puppetlabs/puppet-strings.png?branch=master)](https://travis-ci.org/puppetlabs/puppet-strings) [![Gem Version](https://badge.fury.io/rb/puppet-strings.svg)](https://badge.fury.io/rb/puppet-strings)
3
+ [![Build Status](https://travis-ci.org/puppetlabs/puppet-strings.png?branch=main)](https://travis-ci.org/puppetlabs/puppet-strings) [![Gem Version](https://badge.fury.io/rb/puppet-strings.svg)](https://badge.fury.io/rb/puppet-strings)
4
4
 
5
5
  Puppet Strings generates documentation for Puppet code and extensions written in Puppet and Ruby. Strings processes code and YARD-style code comments to create documentation in HTML, Markdown, or JSON formats.
6
6
 
@@ -62,7 +62,7 @@ See the [Puppet Strings documentation](https://puppet.com/docs/puppet/latest/pup
62
62
 
63
63
  Here are a few other good resources for getting started with documentation:
64
64
 
65
- * [Module README Template](https://docs.puppet.com/puppet/latest/reference/modules_documentation.html)
65
+ * [Module README Template](https://puppet.com/docs/puppet/latest/puppet_strings.html)
66
66
  * [YARD Getting Started Guide](http://www.rubydoc.info/gems/yard/file/docs/GettingStarted.md)
67
67
  * [YARD Tags Overview](http://www.rubydoc.info/gems/yard/file/docs/Tags.md)
68
68
 
@@ -70,7 +70,7 @@ Here are a few other good resources for getting started with documentation:
70
70
 
71
71
  We love contributions from the community!
72
72
 
73
- If you'd like to contribute to `puppet-strings`, check out [CONTRIBUTING.md](https://github.com/puppetlabs/puppet-strings/blob/master/CONTRIBUTING.md) to get information on the contribution process.
73
+ If you'd like to contribute to `puppet-strings`, check out [CONTRIBUTING.md](https://github.com/puppetlabs/puppet-strings/blob/main/CONTRIBUTING.md) to get information on the contribution process.
74
74
 
75
75
  ### Running Specs
76
76
 
@@ -98,14 +98,14 @@ An example of running the acceptance tests locally with Docker:
98
98
  3. Provision a docker container, in this case CentOS 7
99
99
 
100
100
  ``` text
101
- $ bundle exec rake litmus:provision[docker, centos:7]
101
+ $ bundle exec rake 'litmus:provision[docker, centos:7]'
102
102
  ```
103
103
 
104
104
  4. Install test items; Puppet Agent, our test module, and the puppet-strings gem built from this source code
105
105
 
106
106
  ``` text
107
- $ bundle exec rake litmus:install_agent[puppet6]
108
- $ bundle exec rake litmus:install_module_fixtures
107
+ $ bundle exec rake 'litmus:install_agent[puppet6]'
108
+ $ bundle exec rake 'litmus:install_modules_from_directory[./spec/fixtures/acceptance/modules]'
109
109
  $ bundle exec rake litmus:install_gems
110
110
  ```
111
111
 
@@ -141,9 +141,9 @@ Bug fixes and ongoing development will occur in minor releases for the current m
141
141
 
142
142
  [repo]: https://github.com/puppetlabs/puppet-strings
143
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
144
+ [LICENSE]: https://github.com/puppetlabs/puppet-strings/blob/main/LICENSE
145
+ [changelog]: https://github.com/puppetlabs/puppet-strings/blob/main/CHANGELOG.md
146
+ [contributing]: https://github.com/puppetlabs/puppet-strings/blob/main/CONTRIBUTING.md
147
+ [committers]: https://github.com/puppetlabs/puppet-strings/blob/main/COMMITTERS.md
148
148
  [Puppet community Slack]: https://slack.puppet.com
149
149
 
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'puppet-strings'
4
+ require 'tempfile'
5
+
6
+ namespace :strings do
7
+ namespace :validate do
8
+ desc 'Validate the reference is up to date'
9
+ task :reference, [:patterns, :debug, :backtrace] do |t, args|
10
+ filename = 'REFERENCE.md'
11
+
12
+ unless File.exist?(filename)
13
+ STDERR.puts "#{filename} does not exist"
14
+ exit 1
15
+ end
16
+
17
+ patterns = args[:patterns]
18
+ patterns = patterns.split if patterns
19
+ patterns ||= PuppetStrings::DEFAULT_SEARCH_PATTERNS
20
+
21
+ generated = Tempfile.create do |file|
22
+ options = {
23
+ debug: args[:debug] == 'true',
24
+ backtrace: args[:backtrace] == 'true',
25
+ json: false,
26
+ markdown: true,
27
+ path: file,
28
+ }
29
+ PuppetStrings.generate(patterns, options)
30
+
31
+ file.read
32
+ end
33
+
34
+ existing = File.read(filename)
35
+
36
+ if generated != existing
37
+ STDERR.puts "#{filename} is outdated"
38
+ exit 1
39
+ end
40
+ end
41
+ end
42
+ end
@@ -8,5 +8,6 @@ module PuppetStrings
8
8
  module Tasks
9
9
  require 'puppet-strings/tasks/generate.rb'
10
10
  require 'puppet-strings/tasks/gh_pages.rb'
11
+ require 'puppet-strings/tasks/validate.rb'
11
12
  end
12
13
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PuppetStrings
4
- VERSION = '2.6.0'
4
+ VERSION = '2.9.0'
5
5
  end
@@ -148,11 +148,12 @@ class PuppetStrings::Yard::CodeObjects::Type < PuppetStrings::Yard::CodeObjects:
148
148
  end
149
149
 
150
150
  def parameters
151
+ @parameters ||= [] # guard against not filled parameters
151
152
  # just return params if there are no providers
152
153
  return @parameters if providers.empty?
153
154
 
154
155
  # return existing params if we have already added provider
155
- return @parameters if @parameters.any? { |p| p.name == 'provider' }
156
+ return @parameters if @parameters&.any? { |p| p.name == 'provider' }
156
157
 
157
158
  provider_param = Parameter.new(
158
159
  'provider',
@@ -160,6 +161,7 @@ class PuppetStrings::Yard::CodeObjects::Type < PuppetStrings::Yard::CodeObjects:
160
161
  "to specify this --- Puppet will usually discover the appropriate provider for your platform."
161
162
  )
162
163
 
164
+ @parameters ||= []
163
165
  @parameters << provider_param
164
166
  end
165
167
 
@@ -5,7 +5,7 @@ require 'puppet-strings/yard/handlers/ruby/type_base'
5
5
  require 'puppet-strings/yard/code_objects'
6
6
  require 'puppet-strings/yard/util'
7
7
 
8
- # Implements the handler for Puppet resource type newparam/newproperty calls written in Ruby.
8
+ # Implements the handler for Puppet resource type newparam/newproperty/ensurable calls written in Ruby.
9
9
  class PuppetStrings::Yard::Handlers::Ruby::TypeExtrasHandler < PuppetStrings::Yard::Handlers::Ruby::TypeBase
10
10
  # The default docstring when ensurable is used without given a docstring.
11
11
  DEFAULT_ENSURABLE_DOCSTRING = 'The basic property that the resource should be in.'
@@ -13,6 +13,7 @@ class PuppetStrings::Yard::Handlers::Ruby::TypeExtrasHandler < PuppetStrings::Ya
13
13
  namespace_only
14
14
  handles method_call(:newparam)
15
15
  handles method_call(:newproperty)
16
+ handles method_call(:ensurable)
16
17
 
17
18
  process do
18
19
 
@@ -38,9 +39,15 @@ class PuppetStrings::Yard::Handlers::Ruby::TypeExtrasHandler < PuppetStrings::Ya
38
39
  method1_name = statement[0].children.drop(1).find{ |c| c.type == :ident }.source
39
40
  return unless ['Type', 'Puppet::Type'].include?(module_name) && method1_name == 'type'
40
41
 
42
+ # ensurable is syntatic sugar for newproperty
41
43
  typename = get_name(statement[0], 'Puppet::Type.type')
42
- method2_name = caller_method
43
- propertyname = get_name(statement, "Puppet::Type.type().#{method2_name}")
44
+ if caller_method == 'ensurable'
45
+ method2_name = 'newproperty'
46
+ propertyname = 'ensure'
47
+ else
48
+ method2_name = caller_method
49
+ propertyname = get_name(statement, "Puppet::Type.type().#{method2_name}")
50
+ end
44
51
 
45
52
  typeobject = get_type_yard_object(typename)
46
53
 
@@ -22,10 +22,12 @@ class PuppetStrings::Yard::Parsers::Puppet::Parser < YARD::Parser::Base
22
22
  # @return [void]
23
23
  def parse
24
24
  begin
25
- Puppet[:tasks] = true if Puppet.settings.include?(:tasks)
26
- if Puppet::Util::Package.versioncmp(Puppet.version, "5.0.0") < 0 && @file.to_s.match(/^plans\//)
27
- log.warn "Skipping #{@file}: Puppet Plans require Puppet 5 or greater."
28
- return
25
+ if @file.to_s.match(/^plans|\/plans\//)
26
+ if Puppet::Util::Package.versioncmp(Puppet.version, "5.0.0") < 0
27
+ log.warn "Skipping #{@file}: Puppet Plans require Puppet 5 or greater."
28
+ return
29
+ end
30
+ Puppet[:tasks] = true if Puppet.settings.include?(:tasks)
29
31
  end
30
32
  @statements ||= (@visitor.visit(::Puppet::Pops::Parser::Parser.new.parse_string(source)) || []).compact
31
33
  rescue ::Puppet::ParseError => e
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.6.0
4
+ version: 2.9.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: 2021-01-18 00:00:00.000000000 Z
11
+ date: 2021-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: yard
@@ -85,6 +85,7 @@ files:
85
85
  - lib/puppet-strings/tasks.rb
86
86
  - lib/puppet-strings/tasks/generate.rb
87
87
  - lib/puppet-strings/tasks/gh_pages.rb
88
+ - lib/puppet-strings/tasks/validate.rb
88
89
  - lib/puppet-strings/version.rb
89
90
  - lib/puppet-strings/yard.rb
90
91
  - lib/puppet-strings/yard/code_objects.rb
@@ -227,7 +228,7 @@ homepage: https://github.com/puppetlabs/puppet-strings
227
228
  licenses:
228
229
  - Apache-2.0
229
230
  metadata: {}
230
- post_install_message:
231
+ post_install_message:
231
232
  rdoc_options: []
232
233
  require_paths:
233
234
  - lib
@@ -243,8 +244,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
243
244
  version: '0'
244
245
  requirements:
245
246
  - puppet, >= 5.0.0
246
- rubygems_version: 3.2.5
247
- signing_key:
247
+ rubygems_version: 3.1.6
248
+ signing_key:
248
249
  specification_version: 4
249
250
  summary: Puppet documentation via YARD
250
251
  test_files: []