(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.
This commit is contained in:
parent
33788ce247
commit
56f266db4b
|
@ -2,7 +2,7 @@ AllCops:
|
||||||
Exclude:
|
Exclude:
|
||||||
# Ignore HTML related things
|
# Ignore HTML related things
|
||||||
- '**/*.erb'
|
- '**/*.erb'
|
||||||
- 'lib/puppetx/puppetlabs/strings/yard/templates/**/*'
|
- 'lib/puppetx/puppet/strings/yard/templates/**/*'
|
||||||
|
|
||||||
Lint/ConditionPosition:
|
Lint/ConditionPosition:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
--exclude lib/puppetx/puppetlabs/strings/yard/templates/
|
--exclude lib/puppetx/puppet/strings/yard/templates/
|
||||||
--exclude lib/puppetx/puppetlabs/strings/yard/code_objects/host_class_object.rb
|
--exclude lib/puppetx/puppet/strings/yard/code_objects/host_class_object.rb
|
||||||
|
|
|
@ -9,8 +9,8 @@ All related tickets can be found under the [PDOC][PDOC JIRA] JIRA project with t
|
||||||
###Features
|
###Features
|
||||||
- Support for JSON output **(PDOC-23)**
|
- Support for JSON output **(PDOC-23)**
|
||||||
- Strings now has the ability to produce a JSON representation of a given puppet module
|
- Strings now has the ability to produce a JSON representation of a given puppet module
|
||||||
- The details of the JSON schema can be found [here](https://github.com/puppetlabs/puppetlabs-strings/blob/master/json_dom.md)
|
- The details of the JSON schema can be found [here](https://github.com/puppetlabs/puppet-strings/blob/master/json_dom.md)
|
||||||
- For details on how to generate JSON, see the [README](https://github.com/puppetlabs/puppetlabs-strings/blob/master/README.md#running-puppet-strings)
|
- For details on how to generate JSON, see the [README](https://github.com/puppetlabs/puppet-strings/blob/master/README.md#running-puppet-strings)
|
||||||
- Migrate to ruby gems as a distribution method **(PDOC-28)**
|
- Migrate to ruby gems as a distribution method **(PDOC-28)**
|
||||||
- This is the last release of strings that will be available as a puppet module
|
- This is the last release of strings that will be available as a puppet module
|
||||||
- The 0.4.0 release will be released concurrently as a ruby gem
|
- The 0.4.0 release will be released concurrently as a ruby gem
|
||||||
|
|
|
@ -53,9 +53,9 @@ merged.
|
||||||
**security** - Where critical security fixes are merged. These change sets
|
**security** - Where critical security fixes are merged. These change sets
|
||||||
will then be merged into release branches independently from one another. (i.e.
|
will then be merged into release branches independently from one another. (i.e.
|
||||||
no merging up). Please do not submit pull requests against the security branch
|
no merging up). Please do not submit pull requests against the security branch
|
||||||
and instead report all security related issues to security@puppetlabs.com as
|
and instead report all security related issues to security@puppet.com as
|
||||||
per our security policy published at
|
per our security policy published at
|
||||||
[https://puppetlabs.com/security/](https://puppetlabs.com/security/).
|
[https://puppet.com/security/](https://puppet.com/security/).
|
||||||
|
|
||||||
Committer Guide
|
Committer Guide
|
||||||
====
|
====
|
||||||
|
@ -84,8 +84,8 @@ applied to earlier minor releases of a major release, but the patches should
|
||||||
first be merged into the `security` branch. Security patches should be merged
|
first be merged into the `security` branch. Security patches should be merged
|
||||||
by Puppet Labs staff members. Pull requests should not be submitted with the
|
by Puppet Labs staff members. Pull requests should not be submitted with the
|
||||||
security branch as the base branch. Please send all security related
|
security branch as the base branch. Please send all security related
|
||||||
information or patches to security@puppetlabs.com as per our [Security
|
information or patches to security@puppet.com as per our [Security
|
||||||
Policy](https://puppetlabs.com/security/).
|
Policy](https://puppet.com/security/).
|
||||||
|
|
||||||
The CI systems are configured to run against `master`. Over time, this branch
|
The CI systems are configured to run against `master`. Over time, this branch
|
||||||
will refer to different versions, but its name will remain fixed to avoid having
|
will refer to different versions, but its name will remain fixed to avoid having
|
||||||
|
@ -118,7 +118,7 @@ This section aims to provide guidelines for being a good commit citizen by
|
||||||
paying attention to our automated build tools.
|
paying attention to our automated build tools.
|
||||||
|
|
||||||
* Don’t push on a broken build. (A broken build is defined as a failing job
|
* Don’t push on a broken build. (A broken build is defined as a failing job
|
||||||
in the [Puppet FOSS](https://jenkins.puppetlabs.com/view/Puppet%20FOSS/)
|
in [Puppet Strings](https://jenkins.puppetlabs.com/job/platform_puppet-strings_unit-ruby_master/)
|
||||||
page.)
|
page.)
|
||||||
* Watch the build until your changes have gone through green
|
* Watch the build until your changes have gone through green
|
||||||
* Update the ticket status and target version. The target version field in
|
* Update the ticket status and target version. The target version field in
|
||||||
|
@ -143,7 +143,7 @@ First, the committer pulls down the branch using the `hub` gem. This tool
|
||||||
automates the process of adding the remote repository and creating a local
|
automates the process of adding the remote repository and creating a local
|
||||||
branch to track the remote branch.
|
branch to track the remote branch.
|
||||||
|
|
||||||
$ hub checkout https://github.com/puppetlabs/puppetlabs-strings/pull/123
|
$ hub checkout https://github.com/puppetlabs/puppet-strings/pull/123
|
||||||
Branch jeffmccune-pdoc-34_fix_foo_error set up to track remote branch pdoc-34-fix_foo_error from jeffmccune.
|
Branch jeffmccune-pdoc-34_fix_foo_error set up to track remote branch pdoc-34-fix_foo_error from jeffmccune.
|
||||||
Switched to a new branch 'jeffmccune-pdoc-34_fix_foo_error'
|
Switched to a new branch 'jeffmccune-pdoc-34_fix_foo_error'
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ Please note, the checklist should be complete at this point. It's helpful to mak
|
||||||
sure your local branches are up to date to avoid one of the branches failing to fast
|
sure your local branches are up to date to avoid one of the branches failing to fast
|
||||||
forward while the other succeeds.
|
forward while the other succeeds.
|
||||||
|
|
||||||
$ git push puppetlabs master:master
|
$ git push origin master:master
|
||||||
|
|
||||||
That's it! The committer then updates the pull request, updates the issue in
|
That's it! The committer then updates the pull request, updates the issue in
|
||||||
our issue tracker, and keeps an eye on the [build
|
our issue tracker, and keeps an eye on the [build
|
||||||
|
|
|
@ -68,7 +68,7 @@ a ticket number.
|
||||||
|
|
||||||
## Submitting Changes
|
## Submitting Changes
|
||||||
|
|
||||||
* Sign the [Contributor License Agreement](http://links.puppetlabs.com/cla).
|
* Sign the [Contributor License Agreement](http://links.puppet.com/cla).
|
||||||
* Push your changes to a topic branch in your fork of the repository.
|
* Push your changes to a topic branch in your fork of the repository.
|
||||||
* Submit a pull request to the repository in the puppetlabs organization.
|
* Submit a pull request to the repository in the puppetlabs organization.
|
||||||
* Update your Jira ticket to mark that you have submitted code and are ready for it to be reviewed (Status: Ready for Merge).
|
* Update your Jira ticket to mark that you have submitted code and are ready for it to be reviewed (Status: Ready for Merge).
|
||||||
|
@ -81,9 +81,9 @@ a ticket number.
|
||||||
|
|
||||||
# Additional Resources
|
# Additional Resources
|
||||||
|
|
||||||
* [More information on contributing](http://links.puppetlabs.com/contribute-to-puppet)
|
* [More information on contributing](http://links.puppet.com/contribute-to-puppet)
|
||||||
* [Bug tracker (Jira)](http://tickets.puppetlabs.com)
|
* [Bug tracker (Jira)](http://tickets.puppetlabs.com)
|
||||||
* [Contributor License Agreement](http://links.puppetlabs.com/cla)
|
* [Contributor License Agreement](http://links.puppet.com/cla)
|
||||||
* [General GitHub documentation](http://help.github.com/)
|
* [General GitHub documentation](http://help.github.com/)
|
||||||
* [GitHub pull request documentation](http://help.github.com/send-pull-requests/)
|
* [GitHub pull request documentation](http://help.github.com/send-pull-requests/)
|
||||||
* #puppet-dev IRC channel on freenode.org
|
* #puppet-dev IRC channel on freenode.org
|
||||||
|
|
22
README.md
22
README.md
|
@ -1,6 +1,6 @@
|
||||||
Puppet Strings
|
Puppet Strings
|
||||||
=============
|
=============
|
||||||
[![Build Status](https://travis-ci.org/puppetlabs/puppetlabs-strings.png?branch=master)](https://travis-ci.org/puppetlabs/puppetlabs-strings) [![Gem Version](https://badge.fury.io/rb/puppet-strings.svg)](https://badge.fury.io/rb/puppet-strings)
|
[![Build Status](https://travis-ci.org/puppetlabs/puppet-strings.png?branch=master)](https://travis-ci.org/puppetlabs/puppet-strings) [![Gem Version](https://badge.fury.io/rb/puppet-strings.svg)](https://badge.fury.io/rb/puppet-strings)
|
||||||
|
|
||||||
A Puppet Face and plugin built on the [YARD Documentation Tool](http://yardoc.org/) and the Puppet 4 Parser. It is uses YARD and the Puppet Parser to generate HTML documentation about Puppet code and Puppet extensions written in Ruby. It will eventually replace the `puppet doc` command once feature parity has been achieved.
|
A Puppet Face and plugin built on the [YARD Documentation Tool](http://yardoc.org/) and the Puppet 4 Parser. It is uses YARD and the Puppet Parser to generate HTML documentation about Puppet code and Puppet extensions written in Ruby. It will eventually replace the `puppet doc` command once feature parity has been achieved.
|
||||||
|
|
||||||
|
@ -13,12 +13,12 @@ A Puppet Face and plugin built on the [YARD Documentation Tool](http://yardoc.or
|
||||||
| *Change log* | [CHANGELOG.md][changelog] |
|
| *Change log* | [CHANGELOG.md][changelog] |
|
||||||
| *Contributing* | [CONTRIBUTING.md][contributing] and [COMMITTERS.md][committers]|
|
| *Contributing* | [CONTRIBUTING.md][contributing] and [COMMITTERS.md][committers]|
|
||||||
|
|
||||||
[repo]: https://github.com/puppetlabs/puppetlabs-strings
|
[repo]: https://github.com/puppetlabs/puppet-strings
|
||||||
[JIRA]: https://tickets.puppetlabs.com/browse/PDOC
|
[JIRA]: https://tickets.puppetlabs.com/browse/PDOC
|
||||||
[LICENSE]: https://github.com/puppetlabs/puppetlabs-strings/blob/master/LICENSE
|
[LICENSE]: https://github.com/puppetlabs/puppet-strings/blob/master/LICENSE
|
||||||
[changelog]: https://github.com/puppetlabs/puppetlabs-strings/blob/master/CHANGELOG.md
|
[changelog]: https://github.com/puppetlabs/puppet-strings/blob/master/CHANGELOG.md
|
||||||
[contributing]: https://github.com/puppetlabs/puppetlabs-strings/blob/master/CONTRIBUTING.md
|
[contributing]: https://github.com/puppetlabs/puppet-strings/blob/master/CONTRIBUTING.md
|
||||||
[committers]: https://github.com/puppetlabs/puppetlabs-strings/blob/master/COMMITTERS.md
|
[committers]: https://github.com/puppetlabs/puppet-strings/blob/master/COMMITTERS.md
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
------------
|
------------
|
||||||
|
@ -46,8 +46,6 @@ $ puppet resource package yard provider=gem
|
||||||
|
|
||||||
Installing Strings Itself
|
Installing Strings Itself
|
||||||
-------------------------
|
-------------------------
|
||||||
**PLEASE NOTE** that Strings was previously distributed via the puppetlabs-strings module. This is no longer the preferred method of installation as the module will not longer receive updates. So even though there is still a module on the Puppet Forge, please use the RubyGem.
|
|
||||||
|
|
||||||
Strings can be installed using the [puppet-strings RubyGem](https://rubygems.org/gems/puppet-strings). To ensure it is installed in right place, it is best to install it using Puppet.
|
Strings can be installed using the [puppet-strings RubyGem](https://rubygems.org/gems/puppet-strings). To ensure it is installed in right place, it is best to install it using Puppet.
|
||||||
|
|
||||||
For Puppet 4.x:
|
For Puppet 4.x:
|
||||||
|
@ -91,7 +89,7 @@ It can also print the JSON to stdout:
|
||||||
$ puppet strings yardoc some_manifest.pp --emit-json-stdout
|
$ puppet strings yardoc some_manifest.pp --emit-json-stdout
|
||||||
```
|
```
|
||||||
|
|
||||||
The schema for the JSON which Strings emits is [well documented](https://github.com/puppetlabs/puppetlabs-strings/blob/master/json_dom.md).
|
The schema for the JSON which Strings emits is [well documented](https://github.com/puppetlabs/puppet-strings/blob/master/json_dom.md).
|
||||||
|
|
||||||
Processing is delegated to the `yardoc` tool so some options listed in `yard help doc` are available. However, Puppet Faces do not support passing arbitrary options through a face so these options must be specified in a `.yardopts` file.
|
Processing is delegated to the `yardoc` tool so some options listed in `yard help doc` are available. However, Puppet Faces do not support passing arbitrary options through a face so these options must be specified in a `.yardopts` file.
|
||||||
|
|
||||||
|
@ -184,7 +182,7 @@ end
|
||||||
|
|
||||||
Here are a few other good resources for getting started with documentation:
|
Here are a few other good resources for getting started with documentation:
|
||||||
|
|
||||||
* [Module README Template](https://docs.puppetlabs.com/puppet/latest/reference/modules_documentation.html)
|
* [Module README Template](https://docs.puppet.com/puppet/latest/reference/modules_documentation.html)
|
||||||
* [YARD Getting Started Guide](http://www.rubydoc.info/gems/yard/file/docs/GettingStarted.md)
|
* [YARD Getting Started Guide](http://www.rubydoc.info/gems/yard/file/docs/GettingStarted.md)
|
||||||
* [YARD Tags Overview](http://www.rubydoc.info/gems/yard/file/docs/Tags.md)
|
* [YARD Tags Overview](http://www.rubydoc.info/gems/yard/file/docs/Tags.md)
|
||||||
|
|
||||||
|
@ -196,7 +194,7 @@ This module is also available as a Gem and makes three rake tasks (`strings:gene
|
||||||
In addition to generating the usual 'doc' directory of HTML documentation, the `strings:generate` rake task will also drop a strings.json file containing a JSON representation of the module into the directory the rake task was run from.
|
In addition to generating the usual 'doc' directory of HTML documentation, the `strings:generate` rake task will also drop a strings.json file containing a JSON representation of the module into the directory the rake task was run from.
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
gem 'puppet-strings', :git => 'https://github.com/puppetlabs/puppetlabs-strings.git'
|
gem 'puppet-strings', :git => 'https://github.com/puppetlabs/puppet-strings.git'
|
||||||
```
|
```
|
||||||
|
|
||||||
To use the rake tasks, `require puppet-strings/rake_tasks` in your `Rakefile`:
|
To use the rake tasks, `require puppet-strings/rake_tasks` in your `Rakefile`:
|
||||||
|
@ -231,7 +229,7 @@ This task aims to keep the `gh-pages` branch up to date with the current code an
|
||||||
Developing and Contributing
|
Developing and Contributing
|
||||||
-----
|
-----
|
||||||
|
|
||||||
We love contributions from the community! If you'd like to contribute to the strings module, check out [CONTRIBUTING.md](https://github.com/puppetlabs/puppetlabs-strings/blob/master/CONTRIBUTING.md) to get information on the contribution process.
|
We love contributions from the community! If you'd like to contribute to the strings module, check out [CONTRIBUTING.md](https://github.com/puppetlabs/puppet-strings/blob/master/CONTRIBUTING.md) to get information on the contribution process.
|
||||||
|
|
||||||
Running Specs
|
Running Specs
|
||||||
-----
|
-----
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
require 'rake'
|
require 'rake'
|
||||||
require 'rake/tasklib'
|
require 'rake/tasklib'
|
||||||
require 'puppet/face'
|
require 'puppet/face'
|
||||||
require 'puppet_x/puppetlabs/strings/util'
|
require 'puppet_x/puppet/strings/util'
|
||||||
|
|
||||||
namespace :strings do
|
namespace :strings do
|
||||||
desc 'Generate Puppet documentation with YARD.'
|
desc 'Generate Puppet documentation with YARD.'
|
||||||
task :generate do
|
task :generate do
|
||||||
PuppetX::PuppetLabs::Strings::Util.generate([
|
PuppetX::Puppet::Strings::Util.generate([
|
||||||
{emit_json: 'strings.json'}
|
{emit_json: 'strings.json'}
|
||||||
])
|
])
|
||||||
end
|
end
|
||||||
|
|
||||||
desc 'Serve YARD documentation for modules.'
|
desc 'Serve YARD documentation for modules.'
|
||||||
task :serve do
|
task :serve do
|
||||||
PuppetX::PuppetLabs::Strings::Util.serve
|
PuppetX::Puppet::Strings::Util.serve
|
||||||
end
|
end
|
||||||
|
|
||||||
namespace :gh_pages do
|
namespace :gh_pages do
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rake'
|
require 'rake'
|
||||||
require 'rake/tasklib'
|
require 'rake/tasklib'
|
||||||
require 'puppet_x/puppetlabs/strings/util'
|
require 'puppet_x/puppet/strings/util'
|
||||||
|
|
||||||
module PuppetStrings
|
module PuppetStrings
|
||||||
module RakeTasks
|
module RakeTasks
|
||||||
|
@ -8,7 +8,7 @@ module PuppetStrings
|
||||||
#
|
#
|
||||||
# @attr [String] name the name of the rake task.
|
# @attr [String] name the name of the rake task.
|
||||||
# @attr [Array<String>] module_resourcefiles globs used to specify which files to document.
|
# @attr [Array<String>] module_resourcefiles globs used to specify which files to document.
|
||||||
# Defaults to {PuppetX::PuppetLabs::Strings::Util::MODULE_SOURCEFILES}
|
# Defaults to {PuppetX::Puppet::Strings::Util::MODULE_SOURCEFILES}
|
||||||
# @attr [Array<String>] excludes a list of paths or patterns of files and directories to ignore.
|
# @attr [Array<String>] excludes a list of paths or patterns of files and directories to ignore.
|
||||||
# @attr [Array<String>, nil] paths list of paths to generate documentation for.
|
# @attr [Array<String>, nil] paths list of paths to generate documentation for.
|
||||||
# If this value is nil, uses the default paths for puppet strings.
|
# If this value is nil, uses the default paths for puppet strings.
|
||||||
|
@ -26,7 +26,7 @@ module PuppetStrings
|
||||||
# mimic the current default behaviour.
|
# mimic the current default behaviour.
|
||||||
def initialize(*args, &task_block)
|
def initialize(*args, &task_block)
|
||||||
@name = args.shift || 'strings:generate'
|
@name = args.shift || 'strings:generate'
|
||||||
@module_sourcefiles = PuppetX::PuppetLabs::Strings::Util::MODULE_SOURCEFILES
|
@module_sourcefiles = PuppetX::Puppet::Strings::Util::MODULE_SOURCEFILES
|
||||||
@paths = nil
|
@paths = nil
|
||||||
@options = {emit_json: 'strings.json'}
|
@options = {emit_json: 'strings.json'}
|
||||||
@excludes = []
|
@excludes = []
|
||||||
|
@ -52,7 +52,7 @@ module PuppetStrings
|
||||||
private
|
private
|
||||||
|
|
||||||
# Converts all attributes and options to an arguments array that can be passed
|
# Converts all attributes and options to an arguments array that can be passed
|
||||||
# through to {PuppetX::PuppetLabs::Strings::Util #generate}.
|
# through to {PuppetX::Puppet::Strings::Util #generate}.
|
||||||
#
|
#
|
||||||
# If paths is not nil, we expand them with the module_sourcefiles patterns.
|
# If paths is not nil, we expand them with the module_sourcefiles patterns.
|
||||||
def generate_task_args
|
def generate_task_args
|
||||||
|
@ -78,10 +78,10 @@ module PuppetStrings
|
||||||
prefix_paths.map {|path| patterns.map {|p| "#{path}/**/#{p}" } }.flatten
|
prefix_paths.map {|path| patterns.map {|p| "#{path}/**/#{p}" } }.flatten
|
||||||
end
|
end
|
||||||
|
|
||||||
# call {PuppetX::PuppetLabs::Strings::Util #generate}
|
# call {PuppetX::Puppet::Strings::Util #generate}
|
||||||
# @param [Array<String, Hash>] args Arguments. Last element should be a Hash.
|
# @param [Array<String, Hash>] args Arguments. Last element should be a Hash.
|
||||||
def execute_task(args)
|
def execute_task(args)
|
||||||
PuppetX::PuppetLabs::Strings::Util.generate(args)
|
PuppetX::Puppet::Strings::Util.generate(args)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
require 'puppet/face'
|
require 'puppet/face'
|
||||||
require 'puppet_x/puppetlabs/strings/yard/tags/directives'
|
require 'puppet_x/puppet/strings/yard/tags/directives'
|
||||||
|
|
||||||
Puppet::Face.define(:strings, '0.0.1') do
|
Puppet::Face.define(:strings, '0.0.1') do
|
||||||
summary "Generate Puppet documentation with YARD."
|
summary "Generate Puppet documentation with YARD."
|
||||||
|
@ -34,9 +34,9 @@ Puppet::Face.define(:strings, '0.0.1') do
|
||||||
|
|
||||||
when_invoked do |*args|
|
when_invoked do |*args|
|
||||||
check_required_features
|
check_required_features
|
||||||
require 'puppet_x/puppetlabs/strings/util'
|
require 'puppet_x/puppet/strings/util'
|
||||||
|
|
||||||
PuppetX::PuppetLabs::Strings::Util.generate(args)
|
PuppetX::Puppet::Strings::Util.generate(args)
|
||||||
|
|
||||||
# Puppet prints the return value of the action. The return value of this
|
# Puppet prints the return value of the action. The return value of this
|
||||||
# action is that of the yardoc_actions invocation, which is the boolean
|
# action is that of the yardoc_actions invocation, which is the boolean
|
||||||
|
@ -56,9 +56,9 @@ Puppet::Face.define(:strings, '0.0.1') do
|
||||||
|
|
||||||
when_invoked do |*args|
|
when_invoked do |*args|
|
||||||
check_required_features
|
check_required_features
|
||||||
require 'puppet_x/puppetlabs/strings/util'
|
require 'puppet_x/puppet/strings/util'
|
||||||
|
|
||||||
PuppetX::PuppetLabs::Strings::Util.serve(args)
|
PuppetX::Puppet::Strings::Util.serve(args)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
require 'puppet'
|
||||||
|
require 'puppet/pops'
|
||||||
|
require 'puppet/util/docs'
|
||||||
|
require 'yard'
|
||||||
|
|
||||||
|
module PuppetX
|
||||||
|
end
|
||||||
|
|
||||||
|
# Nothing to see here except forward declarations.
|
||||||
|
module PuppetX::Puppet
|
||||||
|
module Strings
|
||||||
|
# This submodule contains bits that operate on the Pops module produced by
|
||||||
|
# the Future parser.
|
||||||
|
module Pops
|
||||||
|
require 'puppet_x/puppet/strings/pops/yard_statement'
|
||||||
|
require 'puppet_x/puppet/strings/pops/yard_transformer'
|
||||||
|
end
|
||||||
|
|
||||||
|
# This submodule contains bits that interface with the YARD plugin system.
|
||||||
|
module YARD
|
||||||
|
require 'puppet_x/puppet/strings/yard/monkey_patches'
|
||||||
|
require 'puppet_x/puppet/strings/yard/parser'
|
||||||
|
|
||||||
|
module Tags
|
||||||
|
require 'puppet_x/puppet/strings/yard/tags/directives'
|
||||||
|
end
|
||||||
|
|
||||||
|
# This submodule contains code objects which are used to represent relevant
|
||||||
|
# aspects of puppet code in YARD's Registry
|
||||||
|
module CodeObjects
|
||||||
|
require 'puppet_x/puppet/strings/yard/code_objects/puppet_namespace_object'
|
||||||
|
require 'puppet_x/puppet/strings/yard/code_objects/method_object'
|
||||||
|
require 'puppet_x/puppet/strings/yard/code_objects/defined_type_object'
|
||||||
|
require 'puppet_x/puppet/strings/yard/code_objects/host_class_object'
|
||||||
|
require 'puppet_x/puppet/strings/yard/code_objects/type_object'
|
||||||
|
require 'puppet_x/puppet/strings/yard/code_objects/provider_object'
|
||||||
|
end
|
||||||
|
|
||||||
|
# This submodule contains handlers which are used to extract relevant data about
|
||||||
|
# puppet code from the ASTs produced by the Ruby and Puppet parsers
|
||||||
|
module Handlers
|
||||||
|
# This utility library contains some tools for working with Puppet docstrings
|
||||||
|
require 'puppet_x/puppet/strings/yard/handlers/base'
|
||||||
|
require 'puppet_x/puppet/strings/yard/handlers/defined_type_handler'
|
||||||
|
require 'puppet_x/puppet/strings/yard/handlers/host_class_handler'
|
||||||
|
require 'puppet_x/puppet/strings/yard/handlers/puppet_3x_function_handler'
|
||||||
|
require 'puppet_x/puppet/strings/yard/handlers/puppet_4x_function_handler'
|
||||||
|
require 'puppet_x/puppet/strings/yard/handlers/type_handler'
|
||||||
|
require 'puppet_x/puppet/strings/yard/handlers/provider_handler'
|
||||||
|
end
|
||||||
|
|
||||||
|
::YARD::Parser::SourceParser.register_parser_type(:puppet,
|
||||||
|
PuppetX::Puppet::Strings::YARD::PuppetParser,
|
||||||
|
['pp'])
|
||||||
|
::YARD::Handlers::Processor.register_handler_namespace(:puppet,
|
||||||
|
PuppetX::Puppet::Strings::YARD::Handlers)
|
||||||
|
|
||||||
|
# FIXME: Might not be the best idea to have the template code on the Ruby
|
||||||
|
# LOAD_PATH as the contents of this directory really aren't library code.
|
||||||
|
::YARD::Templates::Engine.register_template_path(
|
||||||
|
File.join(File.dirname(__FILE__), 'strings', 'yard', 'templates'))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,6 +1,6 @@
|
||||||
require 'puppet_x/puppetlabs/strings'
|
require 'puppet_x/puppet/strings'
|
||||||
|
|
||||||
class PuppetX::PuppetLabs::Strings::Actions
|
class PuppetX::Puppet::Strings::Actions
|
||||||
|
|
||||||
# Creates a new instance of the Actions class by determining
|
# Creates a new instance of the Actions class by determining
|
||||||
# whether or not debug and backtrace arguments should be sent
|
# whether or not debug and backtrace arguments should be sent
|
|
@ -6,7 +6,7 @@ require 'ostruct'
|
||||||
# FIXME: Inhertiting from OpenStruct is a bit of a hack. It allows attributes
|
# FIXME: Inhertiting from OpenStruct is a bit of a hack. It allows attributes
|
||||||
# to be declared as needed but in the long run understandibility of the code
|
# to be declared as needed but in the long run understandibility of the code
|
||||||
# would be improved by having a concrete model.
|
# would be improved by having a concrete model.
|
||||||
class PuppetX::PuppetLabs::Strings::Pops::YARDStatement < OpenStruct
|
class PuppetX::Puppet::Strings::Pops::YARDStatement < OpenStruct
|
||||||
attr_reader :pops_obj, :comments
|
attr_reader :pops_obj, :comments
|
||||||
|
|
||||||
def initialize(pops_obj)
|
def initialize(pops_obj)
|
|
@ -4,7 +4,7 @@
|
||||||
#
|
#
|
||||||
# @note Currently, this class only extracts node, host class and type
|
# @note Currently, this class only extracts node, host class and type
|
||||||
# definitions.
|
# definitions.
|
||||||
class PuppetX::PuppetLabs::Strings::Pops::YARDTransformer
|
class PuppetX::Puppet::Strings::Pops::YARDTransformer
|
||||||
def initialize
|
def initialize
|
||||||
@transform_visitor = Puppet::Pops::Visitor.new(self, 'transform')
|
@transform_visitor = Puppet::Pops::Visitor.new(self, 'transform')
|
||||||
end
|
end
|
||||||
|
@ -26,7 +26,7 @@ class PuppetX::PuppetLabs::Strings::Pops::YARDTransformer
|
||||||
# Extract comments from type definitions and class definitions. Wrap them
|
# Extract comments from type definitions and class definitions. Wrap them
|
||||||
# into YARDStatement objects that provide an interface for YARD handlers.
|
# into YARDStatement objects that provide an interface for YARD handlers.
|
||||||
def transform_NamedDefinition(o)
|
def transform_NamedDefinition(o)
|
||||||
obj = PuppetX::PuppetLabs::Strings::Pops::YARDStatement.new(o)
|
obj = PuppetX::Puppet::Strings::Pops::YARDStatement.new(o)
|
||||||
obj.parameters = o.parameters.map do |p|
|
obj.parameters = o.parameters.map do |p|
|
||||||
param_tuple = [transform(p)]
|
param_tuple = [transform(p)]
|
||||||
param_tuple << ( p.value.nil? ? nil : transform(p.value) )
|
param_tuple << ( p.value.nil? ? nil : transform(p.value) )
|
||||||
|
@ -37,7 +37,7 @@ class PuppetX::PuppetLabs::Strings::Pops::YARDTransformer
|
||||||
|
|
||||||
# Catch-all visitor.
|
# Catch-all visitor.
|
||||||
def transform_Positioned(o)
|
def transform_Positioned(o)
|
||||||
PuppetX::PuppetLabs::Strings::Pops::YARDStatement.new(o)
|
PuppetX::Puppet::Strings::Pops::YARDStatement.new(o)
|
||||||
end
|
end
|
||||||
|
|
||||||
# nil in... nil out!
|
# nil in... nil out!
|
|
@ -1,10 +1,10 @@
|
||||||
require 'puppet_x/puppetlabs/strings/actions'
|
require 'puppet_x/puppet/strings/actions'
|
||||||
|
|
||||||
module PuppetX::PuppetLabs::Strings::Util
|
module PuppetX::Puppet::Strings::Util
|
||||||
MODULE_SOURCEFILES = ['manifests/**/*.pp', 'lib/**/*.rb']
|
MODULE_SOURCEFILES = ['manifests/**/*.pp', 'lib/**/*.rb']
|
||||||
|
|
||||||
def self.generate(args = [])
|
def self.generate(args = [])
|
||||||
yardoc_actions = PuppetX::PuppetLabs::Strings::Actions.new(Puppet[:debug], Puppet[:trace])
|
yardoc_actions = PuppetX::Puppet::Strings::Actions.new(Puppet[:debug], Puppet[:trace])
|
||||||
|
|
||||||
# The last element of the argument array should be the options hash.
|
# The last element of the argument array should be the options hash.
|
||||||
# We don't have any options yet, so for now just pop the hash off and
|
# We don't have any options yet, so for now just pop the hash off and
|
||||||
|
@ -32,13 +32,13 @@ module PuppetX::PuppetLabs::Strings::Util
|
||||||
#class YARD::Logger; def progress(*args); end; end
|
#class YARD::Logger; def progress(*args); end; end
|
||||||
YARD::Tags::Library.define_directive("puppet.type.param",
|
YARD::Tags::Library.define_directive("puppet.type.param",
|
||||||
:with_types_and_name,
|
:with_types_and_name,
|
||||||
PuppetX::PuppetLabs::Strings::YARD::Tags::PuppetTypeParameterDirective)
|
PuppetX::Puppet::Strings::YARD::Tags::PuppetTypeParameterDirective)
|
||||||
|
|
||||||
yardoc_actions.generate_documentation(*yard_args)
|
yardoc_actions.generate_documentation(*yard_args)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.serve(args = [])
|
def self.serve(args = [])
|
||||||
server_actions = PuppetX::PuppetLabs::Strings::Actions.new(Puppet[:debug], Puppet[:trace])
|
server_actions = PuppetX::Puppet::Strings::Actions.new(Puppet[:debug], Puppet[:trace])
|
||||||
|
|
||||||
args.pop
|
args.pop
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'json'
|
require 'json'
|
||||||
|
|
||||||
class PuppetX::PuppetLabs::Strings::YARD::CodeObjects::DefinedTypeObject < PuppetX::PuppetLabs::Strings::YARD::CodeObjects::PuppetNamespaceObject
|
class PuppetX::Puppet::Strings::YARD::CodeObjects::DefinedTypeObject < PuppetX::Puppet::Strings::YARD::CodeObjects::PuppetNamespaceObject
|
||||||
# A list of parameters attached to this class.
|
# A list of parameters attached to this class.
|
||||||
# @return [Array<Array(String, String)>]
|
# @return [Array<Array(String, String)>]
|
||||||
attr_accessor :parameters
|
attr_accessor :parameters
|
|
@ -1,4 +1,4 @@
|
||||||
class PuppetX::PuppetLabs::Strings::YARD::CodeObjects::HostClassObject < PuppetX::PuppetLabs::Strings::YARD::CodeObjects::DefinedTypeObject
|
class PuppetX::Puppet::Strings::YARD::CodeObjects::HostClassObject < PuppetX::Puppet::Strings::YARD::CodeObjects::DefinedTypeObject
|
||||||
# The {HostClassObject} that this class inherits from, if any.
|
# The {HostClassObject} that this class inherits from, if any.
|
||||||
# @return [HostClassObject, Proxy, nil]
|
# @return [HostClassObject, Proxy, nil]
|
||||||
attr_accessor :parent_class
|
attr_accessor :parent_class
|
||||||
|
@ -6,7 +6,7 @@ class PuppetX::PuppetLabs::Strings::YARD::CodeObjects::HostClassObject < PuppetX
|
||||||
# NOTE: `include_mods` is never used as it makes no sense for Puppet, but
|
# NOTE: `include_mods` is never used as it makes no sense for Puppet, but
|
||||||
# this is called by `YARD::Registry` and it will pass a parameter.
|
# this is called by `YARD::Registry` and it will pass a parameter.
|
||||||
def inheritance_tree(include_mods = false)
|
def inheritance_tree(include_mods = false)
|
||||||
if parent_class.is_a?(PuppetX::PuppetLabs::Strings::YARD::CodeObjects::HostClassObject)
|
if parent_class.is_a?(PuppetX::Puppet::Strings::YARD::CodeObjects::HostClassObject)
|
||||||
# Cool. We got a host class. Return self + parent inheritance tree.
|
# Cool. We got a host class. Return self + parent inheritance tree.
|
||||||
[self] + parent_class.inheritance_tree
|
[self] + parent_class.inheritance_tree
|
||||||
elsif parent_class.is_a?(YARD::CodeObjects::Proxy)
|
elsif parent_class.is_a?(YARD::CodeObjects::Proxy)
|
|
@ -1,4 +1,4 @@
|
||||||
class PuppetX::PuppetLabs::Strings::YARD::CodeObjects::ProviderObject < PuppetX::PuppetLabs::Strings::YARD::CodeObjects::PuppetNamespaceObject
|
class PuppetX::Puppet::Strings::YARD::CodeObjects::ProviderObject < PuppetX::Puppet::Strings::YARD::CodeObjects::PuppetNamespaceObject
|
||||||
# A list of parameters attached to this class.
|
# A list of parameters attached to this class.
|
||||||
# @return [Array<Array(String, String)>]
|
# @return [Array<Array(String, String)>]
|
||||||
attr_accessor :parameters
|
attr_accessor :parameters
|
|
@ -1,4 +1,4 @@
|
||||||
class PuppetX::PuppetLabs::Strings::YARD::CodeObjects::PuppetNamespaceObject < YARD::CodeObjects::NamespaceObject
|
class PuppetX::Puppet::Strings::YARD::CodeObjects::PuppetNamespaceObject < YARD::CodeObjects::NamespaceObject
|
||||||
|
|
||||||
attr_accessor :type_info
|
attr_accessor :type_info
|
||||||
# NOTE: `YARD::Registry#resolve` requires a method with this signature to
|
# NOTE: `YARD::Registry#resolve` requires a method with this signature to
|
|
@ -1,4 +1,4 @@
|
||||||
class PuppetX::PuppetLabs::Strings::YARD::CodeObjects::TypeObject < PuppetX::PuppetLabs::Strings::YARD::CodeObjects::PuppetNamespaceObject
|
class PuppetX::Puppet::Strings::YARD::CodeObjects::TypeObject < PuppetX::Puppet::Strings::YARD::CodeObjects::PuppetNamespaceObject
|
||||||
# A list of parameters attached to this class.
|
# A list of parameters attached to this class.
|
||||||
# @return [Array<Array(String, String)>]
|
# @return [Array<Array(String, String)>]
|
||||||
attr_accessor :parameters
|
attr_accessor :parameters
|
|
@ -1,6 +1,5 @@
|
||||||
require 'yard'
|
require 'yard'
|
||||||
|
require 'puppet_x/puppet/strings'
|
||||||
require 'puppet_x/puppetlabs/strings'
|
|
||||||
|
|
||||||
# Patch the regular expression used to match namespaces
|
# Patch the regular expression used to match namespaces
|
||||||
# so it will allow namespace segments that begin with
|
# so it will allow namespace segments that begin with
|
|
@ -1,10 +1,10 @@
|
||||||
require 'puppet_x/puppetlabs/strings/yard/core_ext/yard'
|
require 'puppet_x/puppet/strings/yard/core_ext/yard'
|
||||||
|
|
||||||
class PuppetX::PuppetLabs::Strings::YARD::Handlers::Base < ::YARD::Handlers::Base
|
class PuppetX::Puppet::Strings::YARD::Handlers::Base < ::YARD::Handlers::Base
|
||||||
# Easy access to Pops model objects for handler matching.
|
# Easy access to Pops model objects for handler matching.
|
||||||
include Puppet::Pops::Model
|
include Puppet::Pops::Model
|
||||||
# Easy access to custom code objects from which documentation is generated.
|
# Easy access to custom code objects from which documentation is generated.
|
||||||
include PuppetX::PuppetLabs::Strings::YARD::CodeObjects
|
include PuppetX::Puppet::Strings::YARD::CodeObjects
|
||||||
|
|
||||||
def self.handles?(statement)
|
def self.handles?(statement)
|
||||||
handlers.any? {|h| h == statement.type}
|
handlers.any? {|h| h == statement.type}
|
|
@ -1,4 +1,4 @@
|
||||||
class PuppetX::PuppetLabs::Strings::YARD::Handlers::DefinedTypeHandler < PuppetX::PuppetLabs::Strings::YARD::Handlers:: Base
|
class PuppetX::Puppet::Strings::YARD::Handlers::DefinedTypeHandler < PuppetX::Puppet::Strings::YARD::Handlers:: Base
|
||||||
handles ResourceTypeDefinition
|
handles ResourceTypeDefinition
|
||||||
|
|
||||||
process do
|
process do
|
|
@ -47,11 +47,13 @@ class HereDocHelper
|
||||||
# @param ele [YARD::Parser::Ruby::AstNode]
|
# @param ele [YARD::Parser::Ruby::AstNode]
|
||||||
# @return [String]
|
# @return [String]
|
||||||
def process_element(ele)
|
def process_element(ele)
|
||||||
ele = ele.jump(:ident, :string_content)
|
ele = ele.jump(:ident, :symbol, :string_content)
|
||||||
|
|
||||||
case ele.type
|
case ele.type
|
||||||
when :ident
|
when :ident
|
||||||
ele.source
|
ele.source
|
||||||
|
when :symbol
|
||||||
|
ele.source[1..-1]
|
||||||
when :string_content
|
when :string_content
|
||||||
source = ele.source
|
source = ele.source
|
||||||
if is_heredoc? source
|
if is_heredoc? source
|
|
@ -1,4 +1,4 @@
|
||||||
class PuppetX::PuppetLabs::Strings::YARD::Handlers::HostClassHandler < PuppetX::PuppetLabs::Strings::YARD::Handlers::Base
|
class PuppetX::Puppet::Strings::YARD::Handlers::HostClassHandler < PuppetX::Puppet::Strings::YARD::Handlers::Base
|
||||||
handles HostClassDefinition
|
handles HostClassDefinition
|
||||||
|
|
||||||
process do
|
process do
|
|
@ -1,8 +1,8 @@
|
||||||
# Handles `dispatch` calls within a future parser function declaration. For
|
# Handles `dispatch` calls within a future parser function declaration. For
|
||||||
# now, it just treats any docstring as an `@overlaod` tag and attaches the
|
# now, it just treats any docstring as an `@overlaod` tag and attaches the
|
||||||
# overload to the parent function.
|
# overload to the parent function.
|
||||||
class PuppetX::PuppetLabs::Strings::YARD::Handlers::PuppetProviderHandler < YARD::Handlers::Ruby::Base
|
class PuppetX::Puppet::Strings::YARD::Handlers::PuppetProviderHandler < YARD::Handlers::Ruby::Base
|
||||||
include PuppetX::PuppetLabs::Strings::YARD::CodeObjects
|
include PuppetX::Puppet::Strings::YARD::CodeObjects
|
||||||
|
|
||||||
handles :command_call, :call
|
handles :command_call, :call
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
require File.join(File.dirname(__FILE__),'./heredoc_helper')
|
require File.join(File.dirname(__FILE__),'./heredoc_helper')
|
||||||
|
|
||||||
class PuppetX::PuppetLabs::Strings::YARD::Handlers::Puppet3xFunctionHandler < YARD::Handlers::Ruby::Base
|
class PuppetX::Puppet::Strings::YARD::Handlers::Puppet3xFunctionHandler < YARD::Handlers::Ruby::Base
|
||||||
include PuppetX::PuppetLabs::Strings::YARD::CodeObjects
|
include PuppetX::Puppet::Strings::YARD::CodeObjects
|
||||||
|
|
||||||
handles method_call(:newfunction)
|
handles method_call(:newfunction)
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# Handles `dispatch` calls within a future parser function declaration. For
|
# Handles `dispatch` calls within a future parser function declaration. For
|
||||||
# now, it just treats any docstring as an `@overlaod` tag and attaches the
|
# now, it just treats any docstring as an `@overlaod` tag and attaches the
|
||||||
# overload to the parent function.
|
# overload to the parent function.
|
||||||
class PuppetX::PuppetLabs::Strings::YARD::Handlers::Puppet4xFunctionHandler < YARD::Handlers::Ruby::Base
|
class PuppetX::Puppet::Strings::YARD::Handlers::Puppet4xFunctionHandler < YARD::Handlers::Ruby::Base
|
||||||
include PuppetX::PuppetLabs::Strings::YARD::CodeObjects
|
include PuppetX::Puppet::Strings::YARD::CodeObjects
|
||||||
|
|
||||||
handles method_call(:dispatch)
|
handles method_call(:dispatch)
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ class PuppetX::PuppetLabs::Strings::YARD::Handlers::Puppet4xFunctionHandler < YA
|
||||||
end
|
end
|
||||||
|
|
||||||
class Puppet4xFunctionHandler < YARD::Handlers::Ruby::Base
|
class Puppet4xFunctionHandler < YARD::Handlers::Ruby::Base
|
||||||
include PuppetX::PuppetLabs::Strings::YARD::CodeObjects
|
include PuppetX::Puppet::Strings::YARD::CodeObjects
|
||||||
|
|
||||||
handles method_call(:create_function)
|
handles method_call(:create_function)
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# Handles `dispatch` calls within a future parser function declaration. For
|
# Handles `dispatch` calls within a future parser function declaration. For
|
||||||
# now, it just treats any docstring as an `@overlaod` tag and attaches the
|
# now, it just treats any docstring as an `@overlaod` tag and attaches the
|
||||||
# overload to the parent function.
|
# overload to the parent function.
|
||||||
class PuppetX::PuppetLabs::Strings::YARD::Handlers::PuppetTypeHandler < YARD::Handlers::Ruby::Base
|
class PuppetX::Puppet::Strings::YARD::Handlers::PuppetTypeHandler < YARD::Handlers::Ruby::Base
|
||||||
include PuppetX::PuppetLabs::Strings::YARD::CodeObjects
|
include PuppetX::Puppet::Strings::YARD::CodeObjects
|
||||||
|
|
||||||
handles :call
|
handles :call
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ class PuppetX::PuppetLabs::Strings::YARD::Handlers::PuppetTypeHandler < YARD::Ha
|
||||||
elsif is_feature? node
|
elsif is_feature? node
|
||||||
features << get_feature(node)
|
features << get_feature(node)
|
||||||
elsif is_a_func_call_named? 'ensurable', node
|
elsif is_a_func_call_named? 'ensurable', node
|
||||||
# Someone could call the ensurable method and create an ensure
|
# Someone could call the ensurable method and create an ensure
|
||||||
# property. If that happens, they it will be documented twice. Serves
|
# property. If that happens, they it will be documented twice. Serves
|
||||||
# them right.
|
# them right.
|
||||||
property_details << {:name => 'ensure',
|
property_details << {:name => 'ensure',
|
||||||
|
@ -157,7 +157,7 @@ class PuppetX::PuppetLabs::Strings::YARD::Handlers::PuppetTypeHandler < YARD::Ha
|
||||||
|
|
||||||
|
|
||||||
# See:
|
# See:
|
||||||
# https://docs.puppetlabs.com/guides/custom_types.html#namevar
|
# https://docs.puppet.com/guides/custom_types.html#namevar
|
||||||
# node should be a parameter
|
# node should be a parameter
|
||||||
def is_namevar? node, param_name, type_name
|
def is_namevar? node, param_name, type_name
|
||||||
# Option 1:
|
# Option 1:
|
|
@ -1,10 +1,10 @@
|
||||||
require 'yard'
|
require 'yard'
|
||||||
require 'puppet/pops'
|
require 'puppet/pops'
|
||||||
|
|
||||||
require 'puppet_x/puppetlabs/strings'
|
require 'puppet_x/puppet/strings'
|
||||||
require 'puppet_x/puppetlabs/strings//pops/yard_transformer'
|
require 'puppet_x/puppet/strings//pops/yard_transformer'
|
||||||
|
|
||||||
class PuppetX::PuppetLabs::Strings::YARD::PuppetParser < YARD::Parser::Base
|
class PuppetX::Puppet::Strings::YARD::PuppetParser < YARD::Parser::Base
|
||||||
attr_reader :file, :source
|
attr_reader :file, :source
|
||||||
|
|
||||||
def initialize(source, filename)
|
def initialize(source, filename)
|
||||||
|
@ -12,7 +12,7 @@ class PuppetX::PuppetLabs::Strings::YARD::PuppetParser < YARD::Parser::Base
|
||||||
@file = filename
|
@file = filename
|
||||||
|
|
||||||
@parser = Puppet::Pops::Parser::Parser.new()
|
@parser = Puppet::Pops::Parser::Parser.new()
|
||||||
@transformer = PuppetX::PuppetLabs::Strings::Pops::YARDTransformer.new()
|
@transformer = PuppetX::Puppet::Strings::Pops::YARDTransformer.new()
|
||||||
end
|
end
|
||||||
|
|
||||||
def parse
|
def parse
|
|
@ -61,7 +61,7 @@ def namespace_list(opts = {})
|
||||||
if namespace_types.include? child.type
|
if namespace_types.include? child.type
|
||||||
if child.namespace.is_a?(CodeObjects::Proxy)
|
if child.namespace.is_a?(CodeObjects::Proxy)
|
||||||
name = child.path
|
name = child.path
|
||||||
elsif child.is_a?(PuppetX::PuppetLabs::Strings::YARD::CodeObjects::TypeObject) || child.is_a?(PuppetX::PuppetLabs::Strings::YARD::CodeObjects::ProviderObject)
|
elsif child.is_a?(PuppetX::Puppet::Strings::YARD::CodeObjects::TypeObject) || child.is_a?(PuppetX::Puppet::Strings::YARD::CodeObjects::ProviderObject)
|
||||||
name = child.header_name
|
name = child.header_name
|
||||||
else
|
else
|
||||||
name = child.name
|
name = child.name
|
|
@ -5,7 +5,7 @@ require File.join(File.dirname(__FILE__),'../template_helper')
|
||||||
def init
|
def init
|
||||||
sections :header, [:method_signature, T('docstring'), :source]
|
sections :header, [:method_signature, T('docstring'), :source]
|
||||||
parents = YARD::Registry.all(:method).reject do |item|
|
parents = YARD::Registry.all(:method).reject do |item|
|
||||||
item.name == object.name and item.namespace === PuppetX::PuppetLabs::Strings::YARD::CodeObjects::PuppetNamespaceObject
|
item.name == object.name and item.namespace === PuppetX::Puppet::Strings::YARD::CodeObjects::PuppetNamespaceObject
|
||||||
end
|
end
|
||||||
if parents.length == 0
|
if parents.length == 0
|
||||||
@template_helper = TemplateHelper.new
|
@template_helper = TemplateHelper.new
|
|
@ -1,64 +0,0 @@
|
||||||
require 'puppet'
|
|
||||||
require 'puppet/pops'
|
|
||||||
require 'puppet/util/docs'
|
|
||||||
require 'yard'
|
|
||||||
|
|
||||||
module PuppetX
|
|
||||||
end
|
|
||||||
|
|
||||||
# Nothing to see here except forward declarations.
|
|
||||||
module PuppetX::PuppetLabs
|
|
||||||
module Strings
|
|
||||||
# This submodule contains bits that operate on the Pops module produced by
|
|
||||||
# the Future parser.
|
|
||||||
module Pops
|
|
||||||
require 'puppet_x/puppetlabs/strings/pops/yard_statement'
|
|
||||||
require 'puppet_x/puppetlabs/strings/pops/yard_transformer'
|
|
||||||
end
|
|
||||||
|
|
||||||
# This submodule contains bits that interface with the YARD plugin system.
|
|
||||||
module YARD
|
|
||||||
require 'puppet_x/puppetlabs/strings/yard/monkey_patches'
|
|
||||||
require 'puppet_x/puppetlabs/strings/yard/parser'
|
|
||||||
|
|
||||||
module Tags
|
|
||||||
require 'puppet_x/puppetlabs/strings/yard/tags/directives'
|
|
||||||
end
|
|
||||||
|
|
||||||
# This submodule contains code objects which are used to represent relevant
|
|
||||||
# aspects of puppet code in YARD's Registry
|
|
||||||
module CodeObjects
|
|
||||||
require 'puppet_x/puppetlabs/strings/yard/code_objects/puppet_namespace_object'
|
|
||||||
require 'puppet_x/puppetlabs/strings/yard/code_objects/method_object'
|
|
||||||
require 'puppet_x/puppetlabs/strings/yard/code_objects/defined_type_object'
|
|
||||||
require 'puppet_x/puppetlabs/strings/yard/code_objects/host_class_object'
|
|
||||||
require 'puppet_x/puppetlabs/strings/yard/code_objects/type_object'
|
|
||||||
require 'puppet_x/puppetlabs/strings/yard/code_objects/provider_object'
|
|
||||||
end
|
|
||||||
|
|
||||||
# This submodule contains handlers which are used to extract relevant data about
|
|
||||||
# puppet code from the ASTs produced by the Ruby and Puppet parsers
|
|
||||||
module Handlers
|
|
||||||
# This utility library contains some tools for working with Puppet docstrings
|
|
||||||
require 'puppet_x/puppetlabs/strings/yard/handlers/base'
|
|
||||||
require 'puppet_x/puppetlabs/strings/yard/handlers/defined_type_handler'
|
|
||||||
require 'puppet_x/puppetlabs/strings/yard/handlers/host_class_handler'
|
|
||||||
require 'puppet_x/puppetlabs/strings/yard/handlers/puppet_3x_function_handler'
|
|
||||||
require 'puppet_x/puppetlabs/strings/yard/handlers/puppet_4x_function_handler'
|
|
||||||
require 'puppet_x/puppetlabs/strings/yard/handlers/type_handler'
|
|
||||||
require 'puppet_x/puppetlabs/strings/yard/handlers/provider_handler'
|
|
||||||
end
|
|
||||||
|
|
||||||
::YARD::Parser::SourceParser.register_parser_type(:puppet,
|
|
||||||
PuppetX::PuppetLabs::Strings::YARD::PuppetParser,
|
|
||||||
['pp'])
|
|
||||||
::YARD::Handlers::Processor.register_handler_namespace(:puppet,
|
|
||||||
PuppetX::PuppetLabs::Strings::YARD::Handlers)
|
|
||||||
|
|
||||||
# FIXME: Might not be the best idea to have the template code on the Ruby
|
|
||||||
# LOAD_PATH as the contents of this directory really aren't library code.
|
|
||||||
::YARD::Templates::Engine.register_template_path(
|
|
||||||
File.join(File.dirname(__FILE__), 'strings', 'yard', 'templates'))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,9 +0,0 @@
|
||||||
require 'puppet_x/puppetlabs/strings/yard/core_ext/yard'
|
|
||||||
# Creates a new code object based on the directive
|
|
||||||
class PuppetX::PuppetLabs::Strings::YARD::Tags::PuppetTypeParameterDirective < YARD::Tags::Directive
|
|
||||||
def call
|
|
||||||
return if object.nil?
|
|
||||||
object.parameters << ([tag.text, tag.types].flatten)
|
|
||||||
object.parameter_details << {:name => tag.name, :desc => tag.text, :exists? => true, :puppet_type => true}
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,11 +1,11 @@
|
||||||
Gem::Specification.new do |s|
|
Gem::Specification.new do |s|
|
||||||
s.name = 'puppet-strings'
|
s.name = 'puppet-strings'
|
||||||
s.author = 'Puppet Labs'
|
s.author = 'Puppet Inc.'
|
||||||
s.version = '0.4.0'
|
s.version = '0.4.0'
|
||||||
s.license = 'Apache-2.0'
|
s.license = 'Apache-2.0'
|
||||||
s.summary = 'Puppet documentation via YARD'
|
s.summary = 'Puppet documentation via YARD'
|
||||||
s.email = 'info@puppetlabs.com'
|
s.email = 'info@puppet.com'
|
||||||
s.homepage = 'https://github.com/puppetlabs/puppetlabs-strings'
|
s.homepage = 'https://github.com/puppetlabs/puppet-strings'
|
||||||
s.description = s.summary
|
s.description = s.summary
|
||||||
|
|
||||||
s.extra_rdoc_files = [
|
s.extra_rdoc_files = [
|
||||||
|
|
|
@ -5,7 +5,7 @@ require 'mocha'
|
||||||
require 'puppet'
|
require 'puppet'
|
||||||
require 'rspec'
|
require 'rspec'
|
||||||
|
|
||||||
require 'puppet_x/puppetlabs/strings'
|
require 'puppet_x/puppet/strings'
|
||||||
|
|
||||||
RSpec.configure do |config|
|
RSpec.configure do |config|
|
||||||
config.mock_with :mocha
|
config.mock_with :mocha
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
require 'puppet_x/puppetlabs/strings/pops/yard_statement'
|
require 'puppet_x/puppet/strings/pops/yard_statement'
|
||||||
|
|
||||||
describe PuppetX::PuppetLabs::Strings::Pops do
|
describe PuppetX::Puppet::Strings::Pops do
|
||||||
let(:parser) {Puppet::Pops::Parser::Parser.new()}
|
let(:parser) {Puppet::Pops::Parser::Parser.new()}
|
||||||
|
|
||||||
describe "YARDstatement class" do
|
describe "YARDstatement class" do
|
||||||
let(:manifest) {"#hello world\nclass foo { }"}
|
let(:manifest) {"#hello world\nclass foo { }"}
|
||||||
let(:model) {parser.parse_string(manifest).current.definitions.first}
|
let(:model) {parser.parse_string(manifest).current.definitions.first}
|
||||||
let(:test_statement) {PuppetX::PuppetLabs::Strings::Pops::YARDStatement.new(model)}
|
let(:test_statement) {PuppetX::Puppet::Strings::Pops::YARDStatement.new(model)}
|
||||||
|
|
||||||
describe "when creating a new instance of YARDStatement" do
|
describe "when creating a new instance of YARDStatement" do
|
||||||
it "should extract comments from the source code" do
|
it "should extract comments from the source code" do
|
||||||
|
@ -19,13 +19,13 @@ describe PuppetX::PuppetLabs::Strings::Pops do
|
||||||
describe "YARDTransfomer class" do
|
describe "YARDTransfomer class" do
|
||||||
let(:manifest) {"#hello world\nclass foo($bar) { }"}
|
let(:manifest) {"#hello world\nclass foo($bar) { }"}
|
||||||
let(:manifest_default) {"#hello world\nclass foo($bar = 3) { }"}
|
let(:manifest_default) {"#hello world\nclass foo($bar = 3) { }"}
|
||||||
let(:transformer) {PuppetX::PuppetLabs::Strings::Pops::YARDTransformer.new}
|
let(:transformer) {PuppetX::Puppet::Strings::Pops::YARDTransformer.new}
|
||||||
|
|
||||||
describe "transform method" do
|
describe "transform method" do
|
||||||
it "should perform the correct transformation with parameter defaults" do
|
it "should perform the correct transformation with parameter defaults" do
|
||||||
model = parser.parse_string(manifest_default).current.definitions.first
|
model = parser.parse_string(manifest_default).current.definitions.first
|
||||||
statements = transformer.transform(model)
|
statements = transformer.transform(model)
|
||||||
expect(statements.parameters[0][0].class).to be(PuppetX::PuppetLabs::Strings::Pops::YARDStatement)
|
expect(statements.parameters[0][0].class).to be(PuppetX::Puppet::Strings::Pops::YARDStatement)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should perform the correct transofmration without parameter defaults" do
|
it "should perform the correct transofmration without parameter defaults" do
|
|
@ -1,9 +1,9 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
require 'puppet_x/puppetlabs/strings/yard/handlers/defined_type_handler'
|
require 'puppet_x/puppet/strings/yard/handlers/defined_type_handler'
|
||||||
require 'strings_spec/parsing'
|
require 'strings_spec/parsing'
|
||||||
|
|
||||||
|
|
||||||
describe PuppetX::PuppetLabs::Strings::YARD::Handlers::DefinedTypeHandler do
|
describe PuppetX::Puppet::Strings::YARD::Handlers::DefinedTypeHandler do
|
||||||
include StringsSpec::Parsing
|
include StringsSpec::Parsing
|
||||||
|
|
||||||
def the_definedtype()
|
def the_definedtype()
|
|
@ -1,10 +1,10 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
require 'lib/strings_spec/module_helper'
|
require 'lib/strings_spec/module_helper'
|
||||||
require 'puppet/face/strings'
|
require 'puppet/face/strings'
|
||||||
require 'puppet_x/puppetlabs/strings/yard/handlers/host_class_handler'
|
require 'puppet_x/puppet/strings/yard/handlers/host_class_handler'
|
||||||
require 'strings_spec/parsing'
|
require 'strings_spec/parsing'
|
||||||
|
|
||||||
describe PuppetX::PuppetLabs::Strings::YARD::Handlers::HostClassHandler do
|
describe PuppetX::Puppet::Strings::YARD::Handlers::HostClassHandler do
|
||||||
include StringsSpec::Parsing
|
include StringsSpec::Parsing
|
||||||
|
|
||||||
def the_hostclass()
|
def the_hostclass()
|
|
@ -1,8 +1,8 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
require 'puppet_x/puppetlabs/strings/yard/handlers/puppet_3x_function_handler'
|
require 'puppet_x/puppet/strings/yard/handlers/puppet_3x_function_handler'
|
||||||
require 'strings_spec/parsing'
|
require 'strings_spec/parsing'
|
||||||
|
|
||||||
describe PuppetX::PuppetLabs::Strings::YARD::Handlers::Puppet3xFunctionHandler do
|
describe PuppetX::Puppet::Strings::YARD::Handlers::Puppet3xFunctionHandler do
|
||||||
include StringsSpec::Parsing
|
include StringsSpec::Parsing
|
||||||
|
|
||||||
def the_method()
|
def the_method()
|
|
@ -1,10 +1,10 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
require 'lib/strings_spec/module_helper'
|
require 'lib/strings_spec/module_helper'
|
||||||
require 'puppet_x/puppetlabs/strings/yard/handlers/puppet_4x_function_handler'
|
require 'puppet_x/puppet/strings/yard/handlers/puppet_4x_function_handler'
|
||||||
require 'puppet/face/strings'
|
require 'puppet/face/strings'
|
||||||
require 'strings_spec/parsing'
|
require 'strings_spec/parsing'
|
||||||
|
|
||||||
describe PuppetX::PuppetLabs::Strings::YARD::Handlers::Puppet4xFunctionHandler do
|
describe PuppetX::Puppet::Strings::YARD::Handlers::Puppet4xFunctionHandler do
|
||||||
include StringsSpec::Parsing
|
include StringsSpec::Parsing
|
||||||
|
|
||||||
def the_method()
|
def the_method()
|
|
@ -1,6 +1,6 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
require 'puppet_x/puppetlabs/strings/yard/templates/default/template_helper'
|
require 'puppet_x/puppet/strings/yard/templates/default/template_helper'
|
||||||
require 'puppet_x/puppetlabs/strings/yard/code_objects/puppet_namespace_object'
|
require 'puppet_x/puppet/strings/yard/code_objects/puppet_namespace_object'
|
||||||
require 'strings_spec/parsing'
|
require 'strings_spec/parsing'
|
||||||
|
|
||||||
describe TemplateHelper do
|
describe TemplateHelper do
|
||||||
|
@ -11,7 +11,7 @@ describe TemplateHelper do
|
||||||
# nothing is printed
|
# nothing is printed
|
||||||
tag0 = YARD::Tags::Tag.new(:param, 'a_parameter')
|
tag0 = YARD::Tags::Tag.new(:param, 'a_parameter')
|
||||||
tag0.name = 'a_parameter'
|
tag0.name = 'a_parameter'
|
||||||
obj0 = PuppetX::PuppetLabs::Strings::YARD::CodeObjects::PuppetNamespaceObject.new(:root, 'Puppet3xFunctions')
|
obj0 = PuppetX::Puppet::Strings::YARD::CodeObjects::PuppetNamespaceObject.new(:root, 'Puppet3xFunctions')
|
||||||
obj0.add_tag tag0
|
obj0.add_tag tag0
|
||||||
obj0.parameters = [['a_parameter']]
|
obj0.parameters = [['a_parameter']]
|
||||||
expect { th.check_parameters_match_docs obj0 }.to output("").to_stderr_from_any_process
|
expect { th.check_parameters_match_docs obj0 }.to output("").to_stderr_from_any_process
|
||||||
|
@ -28,7 +28,7 @@ describe TemplateHelper do
|
||||||
# formed, print out the warning with no location data
|
# formed, print out the warning with no location data
|
||||||
tag1 = YARD::Tags::Tag.new(:param, 'aa_parameter')
|
tag1 = YARD::Tags::Tag.new(:param, 'aa_parameter')
|
||||||
tag1.name = 'aa_parameter'
|
tag1.name = 'aa_parameter'
|
||||||
obj1 = PuppetX::PuppetLabs::Strings::YARD::CodeObjects::PuppetNamespaceObject.new(:root, 'Puppet3xFunctions')
|
obj1 = PuppetX::Puppet::Strings::YARD::CodeObjects::PuppetNamespaceObject.new(:root, 'Puppet3xFunctions')
|
||||||
obj1.add_tag tag1
|
obj1.add_tag tag1
|
||||||
obj1.parameters = [['b_parameter']]
|
obj1.parameters = [['b_parameter']]
|
||||||
expect { th.check_parameters_match_docs obj1 }.to output("[warn]: The parameter aa_parameter is documented, but doesn't exist in\n your code. Sorry, the file and line number could not be determined.\n").to_stderr_from_any_process
|
expect { th.check_parameters_match_docs obj1 }.to output("[warn]: The parameter aa_parameter is documented, but doesn't exist in\n your code. Sorry, the file and line number could not be determined.\n").to_stderr_from_any_process
|
||||||
|
@ -45,7 +45,7 @@ describe TemplateHelper do
|
||||||
# formed, print out the warning with no location data
|
# formed, print out the warning with no location data
|
||||||
tag2 = YARD::Tags::Tag.new(:param, 'aaa_parameter')
|
tag2 = YARD::Tags::Tag.new(:param, 'aaa_parameter')
|
||||||
tag2.name = 'aaa_parameter'
|
tag2.name = 'aaa_parameter'
|
||||||
obj2 = PuppetX::PuppetLabs::Strings::YARD::CodeObjects::PuppetNamespaceObject.new(:root, 'Puppet3xFunctions')
|
obj2 = PuppetX::Puppet::Strings::YARD::CodeObjects::PuppetNamespaceObject.new(:root, 'Puppet3xFunctions')
|
||||||
obj2.files = [['some_file.pp', 42]]
|
obj2.files = [['some_file.pp', 42]]
|
||||||
obj2.add_tag tag2
|
obj2.add_tag tag2
|
||||||
obj2.parameters = [['b_parameter']]
|
obj2.parameters = [['b_parameter']]
|
||||||
|
@ -61,7 +61,7 @@ describe TemplateHelper do
|
||||||
" code. The arg1\n parameter is declared as types [\"Integer\"] in the " +
|
" code. The arg1\n parameter is declared as types [\"Integer\"] in the " +
|
||||||
"docstring,\n but the code specifies the types [\"Optional[String]\"]" +
|
"docstring,\n but the code specifies the types [\"Optional[String]\"]" +
|
||||||
"\n in the file test near line 0.\n"
|
"\n in the file test near line 0.\n"
|
||||||
object = PuppetX::PuppetLabs::Strings::YARD::CodeObjects::PuppetNamespaceObject.new(:root, 'Puppet4xFunctions')
|
object = PuppetX::Puppet::Strings::YARD::CodeObjects::PuppetNamespaceObject.new(:root, 'Puppet4xFunctions')
|
||||||
object.files = [['test', 0]]
|
object.files = [['test', 0]]
|
||||||
object.type_info = [{
|
object.type_info = [{
|
||||||
'arg0' => 'Variant[String,Array[String]]',
|
'arg0' => 'Variant[String,Array[String]]',
|
||||||
|
@ -82,7 +82,7 @@ describe TemplateHelper do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should not issue a warning if the parameter types do match the docstring in dispatch method" do
|
it "should not issue a warning if the parameter types do match the docstring in dispatch method" do
|
||||||
object = PuppetX::PuppetLabs::Strings::YARD::CodeObjects::PuppetNamespaceObject.new(:root, 'Puppet4xFunctions')
|
object = PuppetX::Puppet::Strings::YARD::CodeObjects::PuppetNamespaceObject.new(:root, 'Puppet4xFunctions')
|
||||||
object.files = [['test', 0]]
|
object.files = [['test', 0]]
|
||||||
object.type_info = [{
|
object.type_info = [{
|
||||||
'arg0' => 'Variant[String,Array[String]]',
|
'arg0' => 'Variant[String,Array[String]]',
|
||||||
|
@ -103,7 +103,7 @@ describe TemplateHelper do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should not issue a warning if the types in the docstring in dispatch method are assignable to parameter types" do
|
it "should not issue a warning if the types in the docstring in dispatch method are assignable to parameter types" do
|
||||||
object = PuppetX::PuppetLabs::Strings::YARD::CodeObjects::PuppetNamespaceObject.new(:root, 'Puppet4xFunctions')
|
object = PuppetX::Puppet::Strings::YARD::CodeObjects::PuppetNamespaceObject.new(:root, 'Puppet4xFunctions')
|
||||||
object.files = [['test', 0]]
|
object.files = [['test', 0]]
|
||||||
object.type_info = [{
|
object.type_info = [{
|
||||||
'arg0' => 'Variant[String,Array[String]]',
|
'arg0' => 'Variant[String,Array[String]]',
|
|
@ -1,9 +1,9 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
require 'puppet_x/puppetlabs/strings/yard/handlers/type_handler'
|
require 'puppet_x/puppet/strings/yard/handlers/type_handler'
|
||||||
require 'strings_spec/parsing'
|
require 'strings_spec/parsing'
|
||||||
|
|
||||||
|
|
||||||
describe PuppetX::PuppetLabs::Strings::YARD::Handlers::PuppetTypeHandler do
|
describe PuppetX::Puppet::Strings::YARD::Handlers::PuppetTypeHandler do
|
||||||
include StringsSpec::Parsing
|
include StringsSpec::Parsing
|
||||||
|
|
||||||
def the_type()
|
def the_type()
|
Loading…
Reference in New Issue