Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

antsibull-docs: process routing metadata #238

Merged
merged 18 commits into from
Feb 17, 2021
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions antsibull/cli/doc_commands/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from ...logging import log
from ...vendored.json_utils import _filter_non_json_lines
from ...venv import FakeVenvRunner
from ...write_docs import write_rst
from ...write_docs import write_plugin_rst


mlog = log.fields(mod=__name__)
Expand Down Expand Up @@ -103,7 +103,7 @@ def generate_docs() -> int:
plugin_tmpl = env.get_template('plugin.rst.j2')
error_tmpl = env.get_template('plugin-error.rst.j2')

asyncio_run(write_rst(
asyncio_run(write_plugin_rst(
'.'.join([namespace, collection]), AnsibleCollectionMetadata.empty(), plugin, plugin_type,
plugin_info, errors, plugin_tmpl, error_tmpl, '',
path_override=output_path))
Expand Down
20 changes: 20 additions & 0 deletions antsibull/cli/doc_commands/stable.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,18 @@
from ...dependency_files import DepsFile
from ...docs_parsing.parsing import get_ansible_plugin_info
from ...docs_parsing.fqcn import get_fqcn_parts
from ...docs_parsing.routing import (
find_stubs,
load_all_collection_routing,
remove_redirect_duplicates,
)
from ...galaxy import CollectionDownloader
from ...logging import log
from ...schemas.docs import DOCS_SCHEMAS
from ...venv import VenvRunner, FakeVenvRunner
from ...write_docs import (
output_all_plugin_rst,
output_all_plugin_stub_rst,
output_collection_index,
output_indexes,
output_plugin_indexes,
Expand Down Expand Up @@ -275,6 +281,11 @@ def generate_docs_for_all_collections(venv: t.Union[VenvRunner, FakeVenvRunner],
# flog.fields(
# collection_metadata=collection_metadata).debug('Collection metadata')

# Load collection routing information
collection_routing = asyncio_run(load_all_collection_routing(collection_metadata))
flog.notice('Finished loading collection routing information')
# flog.fields(collection_routing=collection_routing).debug('Collection routing infos')

"""
# Turn these into some sort of decorator that will choose to dump or load the values
# if a command line arg is specified.
Expand All @@ -287,6 +298,10 @@ def generate_docs_for_all_collections(venv: t.Union[VenvRunner, FakeVenvRunner],
plugin_info = json.load(f)
"""

remove_redirect_duplicates(plugin_info, collection_routing)
stubs_info = find_stubs(plugin_info, collection_routing)
# flog.fields(stubs_info=stubs_info).debug('Stubs info')

plugin_info, nonfatal_errors = asyncio_run(normalize_all_plugin_info(plugin_info))
flog.fields(errors=len(nonfatal_errors)).notice('Finished data validation')
augment_docs(plugin_info)
Expand Down Expand Up @@ -328,6 +343,11 @@ def generate_docs_for_all_collections(venv: t.Union[VenvRunner, FakeVenvRunner],
squash_hierarchy=squash_hierarchy))
flog.notice('Finished writing indexes')

asyncio_run(output_all_plugin_stub_rst(stubs_info, dest_dir,
collection_metadata=collection_metadata,
squash_hierarchy=squash_hierarchy))
flog.debug('Finished writing plugin subs')

asyncio_run(output_all_plugin_rst(collection_to_plugin_info, plugin_info,
nonfatal_errors, dest_dir,
collection_metadata=collection_metadata,
Expand Down
Loading