Skip to content

(GH-225) Document functions in Puppet Datatypes #235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 15, 2020

Conversation

glennsarti
Copy link
Contributor

@glennsarti glennsarti commented May 30, 2020

Fixes #225

Previously the puppet datatype handler only documented attributes, not functions
for example [1]. This commit updates the data type handler to read in the
function information and then allow that to be used by puppet-strings in its
JSON, Markdown and HTML renderers. This commit also adds tests for many
different scenarios and all three rendering types.

[1] https://github.com/puppetlabs/puppet/blob/3e03e734dda415272ec156b03ed9f021ba243228/lib/puppet/datatypes/error.rb#L13-L15


  • Actually read functions in datatypes
  • unit tests for handler
  • Add output support (HTML pending)
  • Test with multiple interface definitions
  • Tests for JSON output
  • Tests for markdown output
  • Tests for HTML output?

@glennsarti glennsarti changed the title (wip) Document functions in Puppet Datatypes #226 {WIP}(GH-225) Document functions in Puppet Datatypes May 30, 2020
@glennsarti glennsarti force-pushed the gh225-datatype-functions branch from 54db100 to 2a41599 Compare May 30, 2020 11:39
Previously the puppet datatype handler only documented attributes, not functions
for example [1].  This commit updates the data type handler to read in the
function information and then allow that to be used by puppet-strings in its
JSON, Markdown and HTML renderers.  This commit also adds tests for many
different scenarios and all three rendering types.

[1] https://github.com/puppetlabs/puppet/blob/3e03e734dda415272ec156b03ed9f021ba243228/lib/puppet/datatypes/error.rb#L13-L15
@glennsarti glennsarti force-pushed the gh225-datatype-functions branch from 2a41599 to 1900b26 Compare May 30, 2020 12:21
@glennsarti glennsarti changed the title {WIP}(GH-225) Document functions in Puppet Datatypes (GH-225) Document functions in Puppet Datatypes May 30, 2020
@glennsarti
Copy link
Contributor Author

Example HTML output

image

@glennsarti
Copy link
Contributor Author

@binford2k @scotje Can I get a review (and merge) on this?

Copy link
Contributor

@eputnam eputnam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the only thing i saw that might be worth changing is meth and meths to method and methods #methamphetamines. otherwise this is dope and always love seeing tests!

@glennsarti
Copy link
Contributor Author

glennsarti commented Jun 12, 2020

Unfortunately methods is a method name on Object so you can't use it :-( Thus YARD uses meth and meths

[1] pry(main)> t-editor-services [add-tests-for-puppetfile ≡]> be pry
[5] pry(main)> $x = '12345'
=> "12345"
[6] pry(main)> $x.methods
=> [:shellsplit,
 :encode,
 :include?,
 :%,
 :*,
 :+,
 :to_c,
 :count,
 :partition,
 :sum,

@eputnam
Copy link
Contributor

eputnam commented Jun 12, 2020

oh duh, sorry. as you were.

Updates the new markdown unit tests for data type functions and removes
old vestigial markdown output fixtures.
Copy link
Contributor

@scotje scotje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good @glennsarti! I updated the markdown unit specs to match the new regex based specs (and deleted the old exact-match fixtures so they aren't confusing in the future).

@scotje scotje merged commit a76dd4c into puppetlabs:master Jun 15, 2020
@scotje scotje added the feature label Jul 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Document functions in Puppet Datatypes
3 participants