Skip to content

(PDOC-184) generate markdown#156

Merged
hunner merged 12 commits intopuppetlabs:masterfrom
eputnam:pdoc184
Feb 20, 2018
Merged

(PDOC-184) generate markdown#156
hunner merged 12 commits intopuppetlabs:masterfrom
eputnam:pdoc184

Conversation

@eputnam
Copy link
Copy Markdown
Contributor

@eputnam eputnam commented Feb 7, 2018

This change does a few things:

  1. Fixes up new api handler to return the stuff we want
  2. Adds all the logic to parse YARD registries into markdown
  3. Adds templates for markdown
  4. Changes Face cli to use a --format option that can be used for either
    markdown or json

@eputnam eputnam changed the title (PDOC-184) generate markdown (PDOC-184) WIP generate markdown Feb 7, 2018
This change does a few things:
1. Fixes up new api handler to return the stuff we want
2. Adds all the logic to parse YARD registries into markdown
3. Adds templates for markdown
4. Changes Face cli to use a --format option that can be used for either
markdown or json
@eputnam eputnam changed the title (PDOC-184) WIP generate markdown (PDOC-184) generate markdown Feb 7, 2018
Copy link
Copy Markdown
Contributor

@jbondpdx jbondpdx left a comment

Choose a reason for hiding this comment

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

It's so beautiful it makes me want to weep.

Comment thread lib/puppet/face/strings.rb Outdated
generate_options[:path] = options[:out] if options[:out]
generate_options[:stdout] = options[:stdout]
format = options[:format] || ""
if format.casecmp 'markdown'
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

casecmp doesn't do what i thought it did

@eputnam
Copy link
Copy Markdown
Contributor Author

eputnam commented Feb 7, 2018

need to add --emit-json stuff back in and deprecate

done.

This makes sure the markdown doesn't include section headers that have no content. e.g. '## Classes' does not get put in if there are no classes. Also, we should deprecate --emit-json and --emit-json-stdout instead of just killing them.
This implements the author tag. We also claim to support the 'raise' and 'option' tags, but I don't know that we need to. This also consolidates some code in base.rb and adds docs
@eputnam
Copy link
Copy Markdown
Contributor Author

eputnam commented Feb 8, 2018

need to implement option and raise tags, remove author tag

This implements the two remaining tags and removes the author tag. Had to do some deeper plumbing because options per function signature were not being passed along from YARD
describe 'rendering markdown to a file' do
it 'should output the expected markdown content' do
Tempfile.open('md') do |file|
File.open('/Users/eric.putnam/src/puppet-strings/md.md', 'w') do |file|
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Was this intentional?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

nope, thank you!

@codecov-io
Copy link
Copy Markdown

codecov-io commented Feb 16, 2018

Codecov Report

Merging #156 into master will decrease coverage by 2.55%.
The diff coverage is 82.3%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #156      +/-   ##
==========================================
- Coverage   68.12%   65.57%   -2.56%     
==========================================
  Files          46       57      +11     
  Lines        1481     1717     +236     
==========================================
+ Hits         1009     1126     +117     
- Misses        472      591     +119
Impacted Files Coverage Δ
lib/puppet/face/strings.rb 0% <0%> (ø) ⬆️
lib/puppet-strings.rb 16.21% <10.52%> (+1.93%) ⬆️
lib/puppet-strings/markdown/defined_types.rb 100% <100%> (ø)
lib/puppet-strings/markdown/puppet_class.rb 100% <100%> (ø)
lib/puppet-strings/markdown/resource_types.rb 100% <100%> (ø)
...puppet-strings/yard/handlers/ruby/rsapi_handler.rb 81.42% <100%> (-8.58%) ⬇️
lib/puppet-strings/markdown.rb 100% <100%> (ø)
lib/puppet-strings/markdown/table_of_contents.rb 100% <100%> (ø)
lib/puppet-strings/markdown/resource_type.rb 100% <100%> (ø)
lib/puppet-strings/markdown/functions.rb 100% <100%> (ø)
... and 31 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 840dfca...cc7ffae. Read the comment docs.

@eputnam eputnam force-pushed the pdoc184 branch 2 times, most recently from 464793c to 361d207 Compare February 20, 2018 20:23
`puppet generate` behavior remains unchanged
`puppet generate --format markdown` now defaults to writing to
REFERENCE.md and will accept an override from --out
`puppet generate --format json` defaults to printing to stdout but will
accept the --out param
@hunner hunner merged commit cc7ffae into puppetlabs:master Feb 20, 2018
hunner added a commit that referenced this pull request Feb 20, 2018
(PDOC-184) generate markdown
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.

5 participants