Puppet defined types would print the string representation of the ruby object,
and not representation you would see in puppet. This is the difference between
`Puppet::Pops::Types::PStringType` and `String`.
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.
* 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
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
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.
* 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.
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.
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.
Prior to this commit, some of the unit tests for strings relied on
the rspec-html-matchers gem, which does not seem to get along with
rspec 3. This meant that we had to tie our tests to rspec 2 which
has become too inconvenient.
In order to remove the gem, use simple string matching instead.
Update the Gemfile so that it no longer requires the matchers and
no longer has rspec tied to 2.7.
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.
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.
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.
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.
Prior to this commit, the test module used in testing was using
a Modulefile rather than metadata.json. Switch to metadata.json
instead since Modulefile is deprecated and was causing a deprecation
warning during acceptance testing.
In order to help ensure that the strings module is not broken
during development, add a full system integration test which can
run at regular intervals to ensure that the module is working as
expected.
The test installs the string module as well as a test module which
contains the different types of puppet and ruby code that the strings
module can document. It then runs strings and ensures that the HTML
generated is correct.
Additionally, make some changes to the Gemfile to allow strings to
be run as a gem even if it isn't installed in the modulepath. Also
make a few changes to the unit tests to make them compatible with
the version of rspec required by Beaker.
Refactor the code in the strings face and extract much of the functionality
into a separate library in order to make the code more readable and
sustainable. Additionally, remove the `modules` action from the face
since it does not have a clear use case currently. However since the `server`
action depends on it, and it may be helpful to add other features in the future,
extract the functionality previously contained in `modules` into a helper
method.
Prior to this commit, several rspec tests were using `decribe "string"'
instead of `describe constant`. Update the tests to use the constant instead.
Additionally, rename the puppet function tests to reflect the renaming of the
handlers.
Prior to this commit, the handlers and code objects which dealt with
puppet functions were referred to as `FutureParserFunctions` and
`ParseFunctions`. This naming convention will not make very much
sense going forward when the future parser becomes the primary
parser. Therefor, rename `FutureParserFunctions` to `Puppet4xFunctions`
and `ParserFunctions` to `Puppet3xFunctions`.
Since we don't want the name of the tool to reflect the fact that
it is using yard internally (this is an implementation detail), rename
the face to `strings`. Now when one wishes to generate documentation,
`puppet strings` will be used rather than `puppet yardoc`.
In order to make the code more readable, separate the tests into
different files for each handler. Additionally, extract the helper
methods into a separate module which may be included as needed.
Update the tests around the host class handler so that they test
several different examples as opposed to just one. Additionally,
refactor the tests so that they are more detailed when it comes to
checking if the Registry is in the correct state after code has been
parsed.
Rework the tests around the 3x function handler. Make them more
verbose by having them them test against multiple examples and by making
the checking of the Registry more details.
Like the 4x function handler tests, the tests around the defined
type handler were not very specific and didn't use multiple examples.
Update the tests so that they do more than just ensure that the right
objects were added to the Registry and cover a few different cases
instead of just one.
Update the spec tests which cover the Puppet 4x function handler
to be more specific and cover different test cases. Prior to this commit,
they would simply check that the right objects had been added to the
Registry for one example. Now, they examine multiple examples and ensure that
the code objects not only exist but that the details about them are what we
would expect for each specific scenario.
Add tests to ensure that the face (puppet yardoc) works from end to
end. In other words, ensure that when given a module, puppet yardoc can
successfully evaluate the .pp and .rb files present in the module and
produce the expected HTML.
Add tests for the remaining two Puppet-specific handlers that were
not tested in the previous commit. Specifically, add tests for the
3.x function handler and the host class handler.
Begin to test the YARD handlers written for the puppet language.
Add basic tests for the defined type and puppet 4 function
handlers. In addition, make changes to the spec helper to make it
easier to work with YARD Registries for testing purposes.
Prior to this commit there was no testing around the pops component.
Since most of the API in the pops component is private, there aren't
very many things to test, so add just a few test cases.
Additionally rename a previous spec file and make some changes to
the Gemfile.
Add spec tests for Puppet face component, mainly around error checking.
Due to the use of `puppet module list`, the behavior of the `modules`
and `server` actions are not very feasible to test via spec testing.
Additionally, make a few minor changes to the gem file, and make a
small change in `check_required_features` to reflect the fact that
this module will no longer support anything earlier than Ruby 1.9.