aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2023-06-17 03:17:59 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2023-06-17 03:17:59 +0200
commite8a6ee0540cc6d8601c336f44fa4c9f88a68ab21 (patch)
tree4951cb87d4bb5ce2da690b06c0bc072f370b27ba
parentAdd --path-base command line argument. (diff)
downloadmuppet-strings-e8a6ee0540cc6d8601c336f44fa4c9f88a68ab21.tar.gz
muppet-strings-e8a6ee0540cc6d8601c336f44fa4c9f88a68ab21.tar.xz
Minor cleanup.
-rw-r--r--muppet/__main__.py3
-rw-r--r--muppet/output.py20
2 files changed, 20 insertions, 3 deletions
diff --git a/muppet/__main__.py b/muppet/__main__.py
index 65ba1ae..943f9ae 100644
--- a/muppet/__main__.py
+++ b/muppet/__main__.py
@@ -2,6 +2,7 @@
import argparse
import pathlib
+import os
from .cache import Cache
from .gather import get_module, get_modules, ModuleEntry
@@ -46,6 +47,8 @@ def __main() -> None:
# print(module)
setup_module('output', module, path_base=args.path_base)
+ os.system("cp -r static output")
+
if __name__ == '__main__':
__main()
diff --git a/muppet/output.py b/muppet/output.py
index 59dc6a1..5c2e549 100644
--- a/muppet/output.py
+++ b/muppet/output.py
@@ -39,7 +39,16 @@ jinja = Environment(
def setup_index(base: str, modules: list[ModuleEntry], *, path_base: str) -> None:
- """Create the main index.html file."""
+ """
+ Create the main index.html file.
+
+ :param base:
+ Path to output directory.
+ :param modules:
+ Modules to include in the index.
+ :param path_base:
+ Web path where this module will be deployed
+ """
template = jinja.get_template('index.html')
with open(os.path.join(base, 'index.html'), 'w') as f:
f.write(template.render(modules=modules,
@@ -218,6 +227,13 @@ def setup_module(base: str, module: ModuleEntry, *, path_base: str) -> None:
Create all output files for a puppet module.
Will generate a directory under base for the module.
+
+ :param base:
+ Path to output directory.
+ :param modules:
+ Modules to document.
+ :param path_base:
+ Web path where this module will be deployed
"""
path = os.path.join(base, module.name)
pathlib.Path(path).mkdir(exist_ok=True)
@@ -270,8 +286,6 @@ def setup_module(base: str, module: ModuleEntry, *, path_base: str) -> None:
f.write(template.render(content=format_type_alias(type_alias),
path_base=path_base))
- os.system("cp -r static output")
-
# data['data_type_aliases']
# data['defined_types']
# data['resource_types']