Commit Graph

213 Commits

Author SHA1 Message Date
Charlie Sharpsteen 1b275a4926 Re-work yardoc options
The `puppet yardoc` command now consumes an optional list of manifest files to
document. If no files are passed, a default glob of `manifests/**/*.pp` will be
used.
2014-05-26 12:02:59 -07:00
Charlie Sharpsteen e3d2602cba Move Puppet classes into a custom namespace
Instead of documenting Puppet classes using `ClassObject`, use a custom
subclass of `NamespaceObject`. This is done because Puppet classes are not Ruby
classes and will have components that don't fit into the model offered by
`ClassObject`.

This commit also adds a couple of monkey patches to integrate the new
`:hostclass` into YARD tooling and the beginnings of some custom templating.
2014-05-25 22:59:46 -07:00
Charlie Sharpsteen 35e67f1187 Delegate processing to YARD::CLI::Yardoc
Loading `Puppetx::Yardoc::YARD::Plugin` registers the subsystems for Puppet
documentation with YARD. At this point, execution can be handed off to the
`YARD::CLI::Yardoc` tool.
2014-05-25 19:14:52 -07:00
Charlie Sharpsteen 0eb6ec1158 Support Ruby 1.8.7 using backports
The YARD plugin is currently architected using `require_relative` so that it
can be loaded outside of Puppet. Unfortunately, `require_relative` first
appeared in Ruby 1.9.1.

Achieve compatibility using the Backports gem.
2014-05-24 16:49:54 -07:00
Charlie Sharpsteen b4e2ed0e5c Re-work require statements
Use `require_relative` for all components under Puppetx. This makes it possible
to load `pupetx/yardoc/yard/plugin` outside of Puppet as a YARD plugin.

Also fix the `yardoc` face so that Puppetx bits are loaded _after_ feature
checks.
2014-05-24 16:46:37 -07:00
Charlie Sharpsteen 545a8a0c5e Add YARD plugin
A simple file that registers the parser and handlers with YARD.
2014-05-22 23:46:07 -07:00
Charlie Sharpsteen c56bc426be Add simple handlers
Add a base handler class and a handler that processes `HostClassDefinition`
instances.
2014-05-22 23:45:08 -07:00
Charlie Sharpsteen 9ef57b594e Trim comment characters from docstrings
A very naive attempt. Simple removes any leading whitespace, the comment
character and then one space.
2014-05-22 23:42:10 -07:00
Charlie Sharpsteen 66af766dba Add YARDStatement class
The `YARDStatement` class is an adaptor that composes a `Pops::Model` instance
along with applicable `Pops::Adapter` and presents a familiar interface for
`YARD::Handler` objects to work with.
2014-05-22 22:44:15 -07:00
Charlie Sharpsteen c8d318b161 Re-architect around a YARD parser
Start building a YARD parser. Parsing and comment extraction has been moved out
of the yardoc face and into the new `Puppetx::Yardoc::YARD::PuppetParser`
class. The old `Commentor` class from the Util module has been renamed to
`Puppetx::Yardoc::Pops::YARDTransformer`.

`puppet yardoc` is still capable of extracting docstrings for node, class and
type definitions from a single manifest file.
2014-05-22 22:23:34 -07:00
Charlie Sharpsteen f53cbed1bb Add rudimentary comment extractor
With this patch, the `yardoc` face will parse a manifest file and then extract
any comments associated with each node, class and type definition.
2014-05-21 22:14:53 -07:00
Charlie Sharpsteen 3ad750d103 Add feature guards for necessary requirements
Add `Puppet.feature` guards for the `yard` and `rgen` libraries.
2014-05-19 22:24:03 -07:00
Charlie Sharpsteen 3d71143614 Add skeleton of yardoc face
Currently just reads in a path to a `.pp` file and runs it through a Pops
parser.
2014-05-16 10:57:24 -07:00