Commit Graph

16 Commits

Author SHA1 Message Date
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 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 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
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 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 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 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 8b3cdd3a51 (PDOC-37) Add additional tests for parameter names
* Test positive cases (warnings AREN'T printed when they shouldn't be)
* Test puppet functions which use dispatches
2015-07-08 16:09:36 -07:00
Ian Kronquist d37e071ab7 (PDOC-37) Test errors are output properly
Also comment out a statement which we frequently use for debugging which
snuck in by accident.
2015-07-06 10:18:48 -07:00
Hailee Kenney 862b090221 (PDOC-25) Add tests to ensure namespaces are correct
Prior to this commit, there were no tests to check if namespaces
were being properly generated (which was why we did not catch the
bug earlier). Add a test for defined type and host class handlers
to ensure that namespaces are properly generated in code objects.
2015-03-13 10:48:29 -07:00
Hailee Kenney 0a3c37373c (maint) Update Gemfile to use rspec 2.14.0
Prior to this commit, the Gemfile for strings did not specify which
version of rspec to use. When it started using rspec 3, the tests
that relied upon the rspec-html-matchers gem began to fail, likely
because that gem is not yet compatible with the new version of rspec.

Update the Gemfile so that we explicitly use an older version of
rspec to prevent tests from failing. We will have to either wait
for rspec-html-matchers to catch up or find a new way of testing
the HTML output before we can update to rspec 3.
2015-02-13 15:53:22 -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