Generate plugin rst (#28901)

Generate rst docs for plugins 

Based on rst generated for modules. But generated plugin
docs go into docs/docsite/rst/plugins/$PLUGIN_TYPE/plugin_name.rst
( docs/docsite/rst/plugins/connection/ssh.py for ex)

* move plugins docs to rst/*_plugins/ subdirs for namespace
* Only gen support pages for modules for now.
* Add generated plugin docs to gitignore* add list_*_plugins templates
* support MODULES/PLUGINS filters for make htmldocs

   Add a 'PLUGINS=ssh' filter env var like MODULES to filter plugins to build docs for.

* fixup 'historical' version_added, skip plugins/loader.py
* Fix plugins_by_support ref link to new plugins/*/ location
* use :ref: for common_return_values, allow empty version_added
* warnings on missing doc info
* add a prefix to _random_choice
  It was colliding with the target for random_choice plugin
This commit is contained in:
Adrian Likins
2017-09-19 11:14:27 -04:00
committed by GitHub
parent 76aaaf127b
commit da15cf1f54
13 changed files with 268 additions and 58 deletions

View File

@@ -11,6 +11,16 @@ else
CPUS ?= $(shell nproc)
endif
MODULE_ARGS=
ifdef MODULES
MODULE_ARGS = -l $(MODULES)
endif
PLUGIN_ARGS=
ifdef PLUGINS
PLUGIN_ARGS = -l $(PLUGINS)
endif
assertrst:
ifndef rst
$(error specify document or pattern with rst=somefile.rst)
@@ -20,7 +30,7 @@ all: docs
docs: clean htmldocs
generate_rst: testing keywords modules staticmin cli config
generate_rst: testing keywords modules plugins staticmin cli config
htmldocs: generate_rst
CPUS=$(CPUS) $(MAKE) -f Makefile.sphinx html
@@ -48,6 +58,8 @@ clean:
-rm rst/list_of_*.rst
-rm rst/*_by_category.rst
-rm rst/*_module.rst
-rm rst/*_plugin.rst
-rm -rf rst/plugins/*
-rm rst/*_maintained.rst
-rm rst/playbooks_directives.rst
-rm rst/playbooks_keywords.rst
@@ -67,12 +79,10 @@ config:
PYTHONPATH=../../lib $(CONFIG_DUMPER) --template-file=../templates/config.rst.j2 --output-dir=rst/ -d ../../lib/ansible/config/base.yml
modules: $(FORMATTER) ../templates/plugin.rst.j2
# Limit building of module documentation if requested.
ifdef MODULES
PYTHONPATH=../../lib $(FORMATTER) -t rst --template-dir=../templates --module-dir=../../lib/ansible/modules -o rst/ -l $(MODULES)
else
PYTHONPATH=../../lib $(FORMATTER) -t rst --template-dir=../templates --module-dir=../../lib/ansible/modules -o rst/
endif
PYTHONPATH=../../lib $(FORMATTER) -t rst --template-dir=../templates --module-dir=../../lib/ansible/modules -o rst/ $(MODULE_ARGS)
plugins: $(FORMATTER) ../templates/plugin.rst.j2
PYTHONPATH=../../lib $(FORMATTER) -t rst --plugin-type plugins --template-dir=../templates --module-dir=../../lib/ansible/plugins -o rst/ $(PLUGIN_ARGS)
testing:
$(TESTING_FORMATTER)

View File

@@ -2,7 +2,7 @@
#
# You can set these variables from the command line.
SPHINXOPTS = -j $(CPUS)
SPHINXOPTS = -j $(CPUS) -n -w rst_warnings
SPHINXBUILD = sphinx-build
SPHINXPROJ = sdfsdf
SOURCEDIR = rst
@@ -17,4 +17,4 @@ help:
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile.sphinx
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

View File

@@ -33,6 +33,7 @@ Ansible, Inc. releases a new major release of Ansible approximately every two mo
modules_by_category
vault
command_line_tools
plugins_by_category
guides
dev_guide/index
tower

View File

@@ -3,8 +3,6 @@ Introduction To Ad-Hoc Commands
.. contents:: Topics
.. highlight:: bash
The following examples show how to use `/usr/bin/ansible` for running
ad hoc tasks.

View File

@@ -3,7 +3,6 @@ Configuration file
.. contents:: Topics
.. highlight:: bash
Certain settings in Ansible are adjustable via a configuration file. The stock configuration should be sufficient
for most users, but there may be reasons you would want to change them.

View File

@@ -408,7 +408,7 @@ Negative numbers are not supported. This works as follows::
state: present
with_sequence: count=4
.. _random_choice:
.. _playbooks_loops_random_choice:
Random Choices
``````````````