Skip to content
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

Add rake doc task to generate documentation from inline comments #748

Closed
jeffmccune opened this issue Jul 14, 2017 · 4 comments
Closed

Add rake doc task to generate documentation from inline comments #748

jeffmccune opened this issue Jul 14, 2017 · 4 comments
Assignees

Comments

@jeffmccune
Copy link
Collaborator

Working with the types and providers, there is little documentation for the class and instance methods. This isn't a huge problem, much of it is self-explanatory, however it would make maintenance of the module much more accessible to have YARD documentation for the types and providers.

As an example, I tend to reach for this cheatsheet when adding code comments.

@jeffmccune
Copy link
Collaborator Author

For types and providers, this is less useful than I hoped. Puppet::Type.newtype() obscures any inline documentation from YARD because it's nested in a passed block.

@ghoneycutt
Copy link
Collaborator

@ghoneycutt ghoneycutt reopened this Jul 14, 2017
@jeffmccune
Copy link
Collaborator Author

What about https://github.com/puppetlabs/puppet-strings ?

Great idea! Exactly what I was looking for.

@jeffmccune jeffmccune self-assigned this Jul 18, 2017
@jeffmccune jeffmccune changed the title Add YARD to Gemfile, rake tasks Add rake doc task to generate documentation from inline comments Jul 18, 2017
@jeffmccune
Copy link
Collaborator Author

puppet-strings is great, and I'm going to put up a PR adding the rake tasks to generate documentation.

The only gotcha is that helper methods inside of a type or provider block are still not parsed. I believe this is a result of the meta-programming involved in Puppet::Type.newtype(:sensu_check) { ... }.

To handle my original need to document a helper method, the method should be placed into a pure Ruby class and included inside the closure passed to Puppet::Type.newtype. This will allow Yard (via puppet strings) to parse the PuppetX namespace like it normally does now.

I'll add a second issue to record the need to update all of the inline documentation comments to YARD syntax. This will be pretty straight forward and mechanical with some vim macros, but it needs to happen after #682 and related changes are merged into master.

jeffmccune added a commit to jeffmccune/sensu-puppet that referenced this issue Jul 18, 2017
Build the documentation with `bundle exec rake puppet:strings`

The documentation is generated in every matrix cell for Travis.

RedCarpet is used to support Github Flavored Markdown.

The change to sensu_redis_config.rb is to avoid a bug in YARD, throwing
ArgumentError trying to parse the affected node in the syntax tree.  This patch
changes the code to be compatible with YARD.

Resolves sensu#748
@jeffmccune jeffmccune changed the title Add rake doc task to generate documentation from inline comments Add rake puppet:strings task to generate documentation from inline comments Jul 18, 2017
@jeffmccune jeffmccune changed the title Add rake puppet:strings task to generate documentation from inline comments Add rake doc task to generate documentation from inline comments Jul 18, 2017
jeffmccune added a commit to jeffmccune/sensu-puppet that referenced this issue Jul 18, 2017
Build the documentation with `bundle exec rake puppet:strings`

The documentation is generated in every matrix cell for Travis.

RedCarpet is used to support Github Flavored Markdown.

The change to sensu_redis_config.rb is to avoid a bug in YARD, throwing
ArgumentError trying to parse the affected node in the syntax tree.  This patch
changes the code to be compatible with YARD.

Resolves sensu#748
ghoneycutt added a commit that referenced this issue Jul 19, 2017
(#748) Add puppet-strings gem and dependencies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants