1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
"""New, better, entry point."""
import argparse
import pathlib
import os
from .cache import Cache
from .gather import get_module, get_modules, ModuleEntry
from .output import setup_index, setup_module
def __main() -> None:
parser = argparse.ArgumentParser(
prog='puppet-doc configure',
description='Sets up puppet doc')
parser.add_argument('--env', action='store', default='/etc/puppetlabs/code/modules',
help='''
Path to a puppet `modules` directory.
''')
# If deploying to http://example.com/~user/muppet then this should
# be set to `~/user/muppet`
parser.add_argument('--path-base', action='store', default='', help='''
Prefix to web path the pages will be displayed under.
''')
parser.add_argument('modules', nargs='*', type=pathlib.Path, help='''
Any number of specific modules to generate documentation for.
Mutually exclusive with --env.
''')
args = parser.parse_args()
env = args.env
cache = Cache('/home/hugo/.cache/puppet-doc')
modules: list[ModuleEntry]
if args.modules != []:
modules = [get_module(cache, mod)
for mod in args.modules]
else:
modules = get_modules(cache, env)
setup_index('output', modules, path_base=args.path_base)
for module in modules:
# print(module)
setup_module('output', module, path_base=args.path_base)
os.system('make -C static-src --silent install-full PREFIX=$PWD/output')
os.system("cp -r static/* output/static/")
if __name__ == '__main__':
__main()
|