Commit Graph

42 Commits

Author SHA1 Message Date
Ewoud Kohl van Wijngaarden 9728d1004a
(PDOC-224) Handle --emit-json(-stdout) again 2018-03-01 18:28:48 +01:00
Eric Putnam 1316975826
(PDOC-184) revised cli
`puppet generate` behavior remains unchanged
`puppet generate --format markdown` now defaults to writing to
REFERENCE.md and will accept an override from --out
`puppet generate --format json` defaults to printing to stdout but will
accept the --out param
2018-02-20 12:26:05 -08:00
Eric Putnam 3635fe95f0
rubocop sucks 2018-02-07 15:24:48 -08:00
Eric Putnam 7c06ed77c4
(PDOC-184) block pointless output and re-add options
This makes sure the markdown doesn't include section headers that have no content. e.g. '## Classes' does not get put in if there are no classes. Also, we should deprecate --emit-json and --emit-json-stdout instead of just killing them.
2018-02-07 15:18:43 -08:00
Eric Putnam 1374b67da0
(PDOC-184) generate markdown
This change does a few things:
1. Fixes up new api handler to return the stuff we want
2. Adds all the logic to parse YARD registries into markdown
3. Adds templates for markdown
4. Changes Face cli to use a --format option that can be used for either
markdown or json
2018-02-07 14:04:19 -08:00
Peter Huene 7897c70a52
(maint) RuboCop fixes.
This commit fixes a few RuboCop related failures.
2016-09-15 17:15:54 -07:00
Peter Huene ea9dd0c846
(PDOC-63) Delete the old implementation.
This commit deletes the old implementation to assist in cleaner code reviews of
the upcoming reimplementation.

This commit also moves YARD to version 0.9.5 and lays down a bare bones
implementation of Puppet Strings that currently does nothing.
2016-09-15 13:54:18 -07:00
Peter Huene 56f266db4b
(maint) Rename puppetlab-strings to puppet-strings where appropriate.
This commit changes the source and documentation to reference this project as
`puppet-strings` rather than `puppetlabs-strings`.

This makes the source and project match the gem name.
2016-09-14 13:42:28 -07:00
Ian Kronquist 0e1dbb17be (PDOC-23) Document JSON structure format 2015-10-16 15:50:04 -07:00
David Danzilio aac19e67b7 (PDOC-28) Make puppet strings available as a gem 2015-09-16 13:00:00 -04: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 798cd5b816 (PDOC-35) Add a directive for puppet parameters
* Print yard documentation statistics for providers
* Define a directive which takes a type and a name
2015-09-09 14:35:23 -07:00
Ian Kronquist f7165d6634 (maint) Don't print extraneous "true".
Suppress it by printing an empty string instead.
2015-08-04 15:34:13 -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
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
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
Hailee Kenney 999daa9c4c (PDOC-8) Fix present rubocop offenses
Since we want to run rubocop in travis when pull requests are
submitted, fix a few pre-existing rubocop offenses.
2014-10-08 11:36:21 -07:00
Hailee Kenney fa8af6693d (maint) Fix incorrectly resolved merge conflict
Due to a merge conflict that was not properly resolved, a method
which did not exist was being called in the server action, causing
the action to fail. Remove the unneeded method call so that the
server action will work as intended.
2014-10-01 11:32:12 -07:00
Hailee Kenney f0da72b2b7 (PDOC-3) Switch to one line class declarations
Prior to this commit, many of the classes in this project were declared
in two lines. The first line would put them in the context of the module
they belonged to, and the second line would declare the class and deal with
inheritance. In order to make the code more readable and to allow
require statements to be moved to the top level, turn all class declarations
into one line statements.
2014-09-30 13:55:11 -07:00
Hailee Kenney df648a246f (PDOC-3) Use require instead of require_relative
Prior to this commit, the puppet strings project was using require_relative
to include other classes and modules. Due to some ambiguity and the fact
that the strings project shares some naming conventions with YARD, the
use of require_relative sometimes made it unclear what was being
included and where it was coming from. Now require is being used and although
this requires the full path, it makes it very clear where things are coming
from.
2014-09-30 13:55:11 -07:00
Hailee Kenney 4c53f049e1 (PDOC-3) Change actions from module to class
Refactor the actions module so that it is a class. This is important
because it allows us to keep `Puppet[]` calls out of the library and
have them in the face itself. Additionally, move a few things around
(like `check_required_features` since it makes require statements
cleaner) and clean up some comments.
2014-09-30 13:55:11 -07:00
Hailee Kenney 94ff0a4445 (PDOC-3) Add method headers for new libraries
Add some comments for the new methods that have been introduced
to ensure that the code is readable and well documented.
2014-09-30 13:55:10 -07:00
Hailee Kenney 58fef9e8f6 (PDOC-3) Refactor face and remove modules action
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.
2014-09-30 13:55:10 -07:00
Peter Souter 5304b4f2c1 Add -q option to suppress warnings for server 2014-09-23 00:54:28 +01:00
Hailee Kenney dabcdf7f06 (PDOC-3) Add puppetlabs directory
In order to keep with conventions around directory structure, add
a puppetlabs directory and rename modules accordingly.
2014-09-16 09:07:59 -07:00
Hailee Kenney ec0e26e339 (PDOC-3) Rename face to strings instead of yardoc
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`.
2014-09-11 09:57:19 -07:00
Hailee Kenney 195374d2a7 (PDOC-5) Add spec testing for face component
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.
2014-09-03 14:27:48 -07:00
Charlie Sharpsteen 6e1e9b3e24 Require Puppet >= 3.6.0
Mostly due to breaking changes in how the `puppet module list` Face works.
2014-06-09 21:20:56 -07:00
Charlie Sharpsteen cb45a80928 Parse module lib directories along with manifests
The `puppet yardoc` face now parses any files matching `lib/**/*.rb` when
operating on modules.
2014-06-02 21:57:03 -07:00
Charlie Sharpsteen fd3a08bfc2 Map Puppet debugging flags to YARD options
This patch configures YARD to run in debug mode if Puppet flags such as
`--debug` or `--trace` are used.
2014-06-02 19:40:00 -07:00
Charlie Sharpsteen afb053c03b Add a server action to the yardoc face
This commit adds the `puppet yardoc server` action which is designed to
mimic `yard server --gems`. This action generates YARD indicies by invoking
`puppet yardoc modules` and then configures `YARD::CLI::Server` to serve the
resulting documentation.
2014-06-01 18:07:52 -07:00
Charlie Sharpsteen e2a9e40f01 Add a modules action to the yardoc face
This commit adds the `puppet yardoc modules` action which is designed to
process Puppet Modules in the same way `yard gems` processes Ruby Gems. This
action walks the list of modules generated by `puppet module list` and
generates a YARD index (.yardoc directory) in each module root. This index
contains all the data required to generate documentation using other YARD
tools.
2014-06-01 18:03:21 -07:00
Charlie Sharpsteen 043fb34721 Add docstrings to yardoc face 2014-05-31 23:24:27 -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 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 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 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 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