Commit Graph

222 Commits

Author SHA1 Message Date
Ian Kronquist 7814eeaf3c (PDOC-54) Providers & Types w/same name conflict
If a provider and a type with the same name conflict strings will overwrite the
documentation of one of them with the other. That is if both a provider and a
type are named apt_key, strings will write the type to doc/apt_key.html and the
provider to doc/apt_key.html. The fix is to write the provider to
doc/apt_key_provider.html and the type to doc/apt_key_type.html.
2015-09-16 16:47:59 -07:00
Ian Kronquist 8aab1ea0a3 (maint) Remove debug statement on unusual path 2015-09-16 14:43:27 -07:00
Hailee Kenney 3c885cf550 Merge pull request #59 from iankronquist/puppet-type-list-linebreak-pdoc-35
(PDOC-35) Format generated html properly
2015-09-15 15:39:36 -07:00
Hailee Kenney 7c109b231b Merge pull request #60 from iankronquist/types-and-providers-fixes
Types and providers fixes
2015-09-15 15:38:47 -07:00
Ian Kronquist 7f4b81e77b (PDOC-53) Handle directives with no types
Parameter directives with no types will have `tag.type` set to nil. We cannot
append nil to an array, so instead, place it in the array and flatten the
array. If the property is empty the second entry in the array will be nil, as
we expect. If the `tag.type` is an array of types we will have and array with
the form:
	[tag.text, type1, type2, type3, ...]
2015-09-15 09:57:46 -07:00
Ian Kronquist 3a2f70026e (PDOC-52) Fix section on Type directives
This confusion persists from a very old attempt at implementing support for
types and providers.
2015-09-15 09:56:49 -07:00
Ian Kronquist d2c178b59c (PDOC-52) Register docstring after object
In a Puppet type if the user documents a parameter with the directive, then
Yard will read the parameter and think there is an empty docstring there. This
will overwrite the docstring we extracted.
The fix is simple -- overwrite our docstring with theirs, if our docstring
exists at all.
2015-09-15 09:55:50 -07:00
Ian Kronquist cbc39d758a (maint) Fix README formatting
It was bugging me that the subheader wasn't on its own line.
2015-09-14 12:06:26 -07:00
Ian Kronquist 1b421939d4 (PDOC-35) Format generated html properly
Shaigy Nixon on Jira:
"Just a trivial thing. Looks like one line break is missing from the type's
output html between the property and the allowed values for parameter. Rest all
looks great."
https://tickets.puppetlabs.com/browse/PDOC-35?focusedCommentId=215400&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-215400

As an aside, I would really like to rewrite this method to be a real erb
template and not this nonsense.
2015-09-14 12:03:43 -07:00
Hailee Kenney 782fee5d0b Merge pull request #57 from iankronquist/improve-warnings-pdoc-49
(PDOC-49) Improve warnings
2015-09-11 14:50:04 -07:00
Ian Kronquist e26cb69d36 (PDOC-49) Improve warnings
1. Long warning should be broken onto multiple lines.
2. Warnings should begin with `[warn]:`
2015-09-11 14:30:14 -07:00
Ian Kronquist b00a6cc587 Merge pull request #56 from ferventcoder/ticket/master/PDOC-35-documentation-fixes
(PDOC-35) Clarify types and providers example
2015-09-10 10:54:40 -07:00
Rob Reynolds 0883beadeb (PDOC-35) Clarify types and providers example
- Clarify how desc/doc strings are automatically extracted
- Clarify in the example where my_parameter comes from
- add subheadings to Writing Compatible Documentation
2015-09-10 10:47:12 -05:00
Hailee Kenney 811df7d84d Merge pull request #47 from iankronquist/types-and-providers-docs
(PDOC-35) Document documenting puppet providers
2015-09-09 15:38:07 -07:00
Hailee Kenney 623011fd4a Merge pull request #46 from iankronquist/defined-types-and-providers-pdoc-35
(PDOC-35) Support types and providers
2015-09-09 15:33:33 -07:00
Ian Kronquist 1991475b4c (PDOC-35) Fix formatting from Nick's suggestions
* Float several namevars/ensurables to top of list
* Fix minor code style issues
2015-09-09 15:27:50 -07:00
Ian Kronquist 0206c78ee0 (PDOC-35) Document types & providers separately
* Dunno, I just plowed through a bunch of features
* Expect puppet provider in stats output
* Fetch default values for Type params and props
* Detect allowed values
* Add allowed values to test
* htmlify scrubbed text
* Add features to Type html output
* Add infrastructure for types
* Add methods for generating lists, etc.
* Add provider code object
* Add provider handler
* Generate list for puppet provider dropdown
* Add puppet provider template
* Add provider details to puppet type template
* Get description properly for types
2015-09-09 14:35:45 -07:00
Ian Kronquist 798cd5b816 (PDOC-35) Add a directive for puppet parameters
* Print yard documentation statistics for providers
* Define a directive which takes a type and a name
2015-09-09 14:35:23 -07:00
Ian Kronquist 676364bd17 (PDOC-35) First pass at documenting providers
Adding a provider page and menu
* Add categories to html search bar
* Require provider handler and object classes
* Fetch provider code objects from registry
* Add function to generate the provider list
* Fetch providers from registry in monkey patches
* Add provider templates
* Add provider code object
* Add provider handler
* Add erb file to populate the provider list
* Don't emit type information for providers in html
* Add tests for provider handler

Refactor heredoc:
* Remove heredoc annotations
* Move heredoc functions into a heredoc helper
* Add heredoc helper class
2015-09-09 14:35:02 -07:00
Henrik Lindberg d6c8bc507c Merge pull request #50 from iankronquist/choke-yard-warnings
(PDOC-38) Prevent warnings from being issued twice
2015-09-07 05:28:34 -07:00
Henrik Lindberg eeeb89f565 Merge pull request #53 from iankronquist/fix-defined-function-crash
(PDOC-45) Puppet 4x functions handle unusual names
2015-09-07 05:25:16 -07:00
Ian Kronquist 11e016e81e (PDOC-38) Prevent warnings from being issued twice
Since we threw away all of Yard's warnings we are no longer checking that the
parameter names match for Ruby methods. Thus we need to override Yard's
method_details template with our own to trigger our warning function. However,
there's a catch. If this ruby method is in a Puppet 4x function, we don't want
our warning function to trigger because the user has already been warned. Look
in the registry to see if there is already a Puppet 4x function with the same
name registered.

Also, print errors to stderr instead of using log.warn.
2015-09-04 14:45:08 -07:00
Ian Kronquist c4a1a10c67 (PDOC-45) Test Puppet 4x functions don't throw
Parsing puppet 4x functions with symbols for their names like :'defined' should
not raise ParseErrorWithIssue, or anything for that matter.
2015-09-01 15:42:37 -07:00
Ian Kronquist 84a215d599 (PDOC-45) Puppet 4x functions handle unusual names
`lib/puppet/functions/defined.rb` has some unusual syntax:

	Puppet::Functions.create_function(:'defined', ....

It runs, so apparently this is legal.
2015-09-01 15:31:13 -07:00
Ian Kronquist 346832a5f8 Merge pull request #51 from roidelapluie/master
(MAINT) Add a space between a parameter name type and its description
2015-08-31 09:48:44 -07:00
Julien Pivotto 005a3112c9 (MAINT) Add a space between a parameter name type and its description
Before this commit:

    packages (Array[String])- A list of packages to be installed

With this commit:

    packages (Array[String]) - A list of packages to be installed
2015-08-31 12:27:28 +02:00
Ian Kronquist f052675088 (PDOC-38) Add parameter mismatch warnings for 4.x 2015-08-21 10:36:31 -07:00
Ian Kronquist fe2420bc01 (PDOC-38) Monkey patch Yard's logger
Redirect Yard command line warnings to a log file called `.yardwarns`.
Yard warnings may be irrelevant, spurious, or may not conform with our
styling and UX design. They are also printed on stdout by default.
2015-08-21 10:36:31 -07:00
Hailee Kenney 2a11a85787 Merge pull request #49 from iankronquist/duplicate-warnings
(PDOC-21) Duplicate warnings
2015-08-19 10:58:01 -07:00
Ian Kronquist f5c4c4c861 (PDOC-21) Test for duplicate hostclass warnings
* Add testing file based off shaigy's tests.
* Refactor using_module into a helper class.
* Expect that the warnings printed to stdout are *exactly* what I want to see
  and nothing else.
2015-08-19 10:50:03 -07:00
Ian Kronquist bd8d159016 (PDOC-21) Fix duplicate warnings for hostclasses
Host classes inherit behavior from defined types. I didn't realize this when I
was first implementing this functionality.
2015-08-19 10:47:32 -07:00
Hailee Kenney aebdda4acd Merge pull request #48 from iankronquist/double-hostclass-params/PDOC-21
(PDOC-21) Only create HostClass parameters once
2015-08-12 10:31:46 -07:00
Ian Kronquist badd019364 (PDOC-21) Only create HostClass parameters once
You can pass a block to the constructor of the hostclass. For some reason Yard
is yielding the block twice. Our code is not yielding the block because we only
use yield in one place which is unrelated. I don't think this is intended
behavior on yard's part, it certainly seems odd, but we can dodge the question
and not have to wait for an upstream patch by extracting the logic from the
block and running it after the object has been initialized.
2015-08-12 10:18:31 -07:00
Ian Kronquist 9b8777c1b4 (PDOC-35) Document documenting puppet providers
Add instructions on how to use the `@!puppet.provider.param` directive to
document parameters which are created via metaprogramming.
2015-08-11 11:53:01 -07:00
Hailee Kenney 05f489fcee Merge pull request #45 from iankronquist/extraneous-true
(maint) Don't print extraneous "true".
2015-08-04 16:09:17 -07:00
Ian Kronquist f7165d6634 (maint) Don't print extraneous "true".
Suppress it by printing an empty string instead.
2015-08-04 15:34:13 -07:00
Hailee Kenney c33f911f09 Merge pull request #44 from iankronquist/defined-types-mismatched-types
(PDOC-21) Check mismatched types in defined types
2015-08-03 15:49:29 -07:00
Ian Kronquist c7af917c35 (PDOC-21) Check mismatched types in defined types
Check that the types for defined types match those specified in the
documentation. This is already being done for classes.
2015-08-03 14:12:32 -07:00
Hailee Kenney b1b27a33d3 Merge pull request #41 from iankronquist/nested-classes/pdoc-35
Nested classes/pdoc 35
2015-07-30 14:07:10 -07:00
Kylo Ginsberg a9781d65bd Merge pull request #43 from iankronquist/yard-install-instructions/pdoc-33
(PDOC-33) Inform reader how to install yard gem
2015-07-29 13:17:56 -07:00
Ian Kronquist 088b1b3521 (PDOC-33) Inform reader how to install yard gem
The easiest cross platform way to install the yard gem is actually with puppet
itself. We still need to cover the puppet 3.x vs 4.x cases though.
2015-07-29 12:43:33 -07:00
Ian Kronquist 457ec86a2b (PDOC-35) Test strings works with nested classes 2015-07-28 14:56:14 -07:00
Hailee Kenney e9167b11e6 Merge pull request #42 from iankronquist/forgot-defined-types
Forgot defined types
2015-07-28 13:35:00 -07:00
Ian Kronquist 9083023b33 (maint) Fix typo in emitted html 2015-07-28 13:27:28 -07:00
Ian Kronquist 2d2c03bc33 (PDOC-19) Parse type information for defined types
I forgot to include the code which extracts the type information for the code
object in the defined types handler. Without this we do not extract type
information from defined types so warnings cannot be emitted and types in the
documentation are listed as Unknown.
2015-07-28 13:27:28 -07:00
Hailee Kenney abf3b786c5 Merge pull request #39 from iankronquist/readme-update/PDOC-33
(PDOC-33) Inform reader how to install yard gem
2015-07-22 10:11:17 -07:00
Ian Kronquist 4dc6bc429a (PDOC-35) Dispatch handlers in correct order
Subclasses have their superclass as part of their namespace and objects in the
subclass's namespace must be registered first.
Reverse the list of parsed objects so
that the classes will be handled and registered in the correct order.
2015-07-21 15:15:30 -07:00
Hailee Kenney 0d8c4e75fe Merge pull request #37 from iankronquist/markdown-madness/PDOC-30
(PDOC-30) Fix Markdown parsing lists parsing
2015-07-20 16:56:51 -07:00
Hailee Kenney 36a5e12edc (maint) Require puppet version >= 3.7 for typing
Prior to this commit, the metadata for strings required a puppet
version of 3.6.0 or greater. However, now that we are deriving
parameter type information, we need 3.7.0 or greater because parameter
typing was not included in previous versions of the parser.

Update the metadata to reflect this change in version requirement.
2015-07-20 16:49:33 -07:00
Ian Kronquist 5a63c9832e (PDOC-33) Inform reader how to install yard gem
Also includes a variety of other README updates and modernizations.
2015-07-17 10:59:21 -07:00