Commit Graph

527 Commits

Author SHA1 Message Date
Charlie Sharpsteen 043fb34721 Add docstrings to yardoc face 2014-05-31 23:24:27 -07:00
Charlie Sharpsteen 353b48bb1a Add README.md 2014-05-30 12:23:10 -07:00
Charlie Sharpsteen d5d977eced Add feature check for backports under Ruby 1.8.7 2014-05-30 09:59:55 -07:00
Charlie Sharpsteen 9cd4fd14a9 Extend doc generation to defined types
Puppet Yardoc now generates documentation for defined types in addition to host
classes. The actual change was fairly small, however this patch is quite large
as most of the host class bits were re-architected to inherit from defined
types. Host classes are basically the same as defined types with the addition
of inheritance. Pops also models Host Class using a similar inheritance
relationship.
2014-05-30 09:28:25 -07:00
Charlie Sharpsteen d0d943436e Add parameter summary to hostclass html docs
Format cribbed from YARD method and attribute summary blocks. Still some work
to do, but initial results don't look that bad.
2014-05-30 09:08:20 -07:00
Charlie Sharpsteen 005a8521bd Extract class parameters from parser output
Re-worked the YARD transformer and handlers to attach parameters to the
resulting code objects. Some architectural debt was incurred in the interests
of producing a working prototype quickly.
2014-05-28 23:53:12 -07:00
Charlie Sharpsteen e98761100d Fix plugin loading from YARD
This patch fixes an error related to `Puppet::Util` being missing when YARD
loads `puppetx/yardoc/yard/plugin`.
2014-05-28 00:07:15 -07:00
Charlie Sharpsteen d6a4791c30 Fix signature of HostClassObject#inheritance_tree
The `YARD::Registry` expects all subclasses of `NamespaceObject` to accept one
argument when `inheritance_tree` is called.
2014-05-27 20:52:59 -07:00
Charlie Sharpsteen d226d08ddb List subclasses for each host class
Basically a straight port of the logic from the YARD template for Ruby classes.
2014-05-27 19:45:02 -07:00
Charlie Sharpsteen 787fca8ebc Implement inheritance tree for host classes
Documentation pages for host classes now show the full inheritance tree instead
of just the immediate parent.
2014-05-27 19:34:12 -07:00
Charlie Sharpsteen d8bc2f3dce Display inheritance relationships for host classes 2014-05-26 22:36:22 -07:00
Charlie Sharpsteen a051319b34 Clobber YARD namespace proxies
When creating an object, YARD will split the object name using `::` and
recursively create proxy namespaces for each component. Unfortunately this
process is optimized for Ruby and somewhat mangles Puppet code as Puppet class
names are not capitalized.

For now, dispense with this behavior by implementing `HostClassObject.new`.
2014-05-26 17:55:43 -07:00
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 5d5013b39d Add Bundler artifacts to .gitignore 2014-05-25 19:11:32 -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
Charlie Sharpsteen a9408c792b Initial commit
Added skeleton from `puppet module generate` minus bits related to manifests.
2014-05-16 10:57:24 -07:00