Commit Graph

21 Commits

Author SHA1 Message Date
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 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
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 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
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
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
Ian Kronquist 641cba8c2d (maint) Improve message when type error is raised
Addresses @hlindberg's comment after PR #35 was closed.
Use the error message from the exception which is actually exactly what I
wanted to say anyway.
2015-07-16 16:20:49 -07:00
Ian Kronquist 6137e94a25 (PDOC-30) Fix Markdown parsing lists parsing
The transformer comment matching regex matched all whitespace after a comment.
Lines which were effectively "blank" and just had a comment would be erased.
Markdown lists need to end with a blank line. This messed up markdown
formatting.

The culprit is the regex /^\s*#\s/ which matches all of the comment ' #\n',
however we want to leave the newline alone for markdown to parse.
We replace the regex with /^\s*#[ \t]/ which will only match tabs or spaces
after the hash and leave our beloved newline alone.
2015-07-16 11:50:52 -07:00
Ian Kronquist 37d5d08271 (PDOC-19) Fix merge mistakes
* An empty file got added back in the chaos. Delete it again.
* One of the comments was out of date.
2015-07-15 16:35:26 -07:00
Ian Kronquist c4b1d0d10d (PDOC-19) Output type info in generated html 2015-07-15 16:34:08 -07:00
Ian Kronquist 4653a5f9f0 (PDOC-21) Typecheck documented parameters
The documented parameter types should be compared with the actual types when
possible.
2015-07-15 11:58:36 -07:00
Ian Kronquist 081bbfe790 (PDOC-37) Parse 4x function ast type and params
The previous iteration eagerly grabbed all parameters when any puppet function
was created. We did not retrieve type information and would grab parameters
from any helper functions!
* Parse the Ruby AST for dispatch blocks which specify type information. Parse
  the commands and arguments in those blocks.
* If there are no dispatch blocks, parse the AST for a ruby function with the
  same name as the puppet function being created.
2015-07-13 15:42:26 -07:00
Ian Kronquist 463d4e0a1f (PDOC-37) Attach params to Puppet 4.x code object
Traverse the ruby AST to get method arguments and attach them to the code
object.
* Fixes spurious warnings issued by yard.
* Obviates the need for ugly regex code in the templates to retrieve
  parameters from the source code.
2015-07-06 10:18:48 -07:00
Ian Kronquist 49171c92b9 (PDOC-37) Warn if parameter names don't match docs
Print the name of the parameter, the file, and the line number to stderr if the
parameter name does not match the name specified in the docs.
In order for this to be useful we need to present the user with the file name
and line number of the relevant parameters. This information needs to be
extracted from the code object and passed to the extract_param_details method.
2015-07-06 10:18:48 -07:00
Hailee Kenney 685ebf54eb (PDOC-25) Fix mangled puppet namespaces
Prior to this commit, puppet namespaces would be totally mangled when
processed by YARD since YARD is looking for Ruby namespaces where the
first letter of each segment must be uppercase.

In order to fix this, patch the relevant regular expression constants
in YARD so that they will accept segments that begin with uppercase
and lowercase letters.

An upstream pull request has been accepted into YARD to add another
regex constant which is necessary to complete this patch. However until
the next version of the YARD gem is released, we must include a temporary
hack to fix the problematic method in question (as it is not yet using
the added variable). Once the new version is released, the conditional
statement in code_ext/yard.rb can be removed entirely and all we will
need to do is patch the two regex constants.
2015-03-12 16:51:00 -07:00
Hailee Kenney 849c731511 (PDOC-27) Make fix compatible with Ruby 2x
Prior to this commit, the fix for the 3x function issue was trying
to create an empty hash by calling Hash[ [[]] ] which in Ruby 1.9.3
produced and empty hash. However this is not the case in Ruby 2.0 and
up. Therefor, fix up the code so that it does not rely on Hash[ [[]] ]
creating and empty hash.
2015-02-17 11:28:26 -08:00
Hailee Kenney 5257ca4bed (PDOC-27) Don't require options for 3x functions
Prior to this commit, the 3x function handler assumed that at
least two arguments (the name and one or more additional arguments)
were passed into newfunction when creating a 3x function. However
that is not actually required, the only argument needed is the name.

Update the 3x function handler so that it will not throw and exception
if only one argument is given.
2015-02-12 14:22:53 -08:00
Hailee Kenney e5691d23c7 (PDOC-26) Rename Puppetx to PuppetX
Due to the changes in PUP-3900 which renamed Puppetx to PuppetX
and puppetx to puppet_x, strings was failing since the namespace
had not been updated in strings. In order to be compatible with this
change, update strings by renaming the namespace to match.

In order to ensure strings is still compatible with earlier versions
of puppet that don't include the namespace change, declare our own
PuppetX module. This way, if it is an older version and the namespace
is called Puppetx, the necessary PuppetX namespace will be created.
2015-02-06 14:08:42 -08:00