-
Notifications
You must be signed in to change notification settings - Fork 0
/
update_docs
executable file
·67 lines (49 loc) · 1.84 KB
/
update_docs
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
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/python3
import inspect
from typing import IO
def document_source_styles(file: IO[str] = None):
"""
Generate markdown documentation for source styles
"""
# - document source styles in an autogenerated markdown file based on
# class docstrings
from moncic.source import source
source_types = source.registry()
print("""# Source styles
This the documentation of source styles you can use with `monci ci -s <name>`.
""", file=file)
for name, source_cls in sorted(source_types.items()):
print(f"## {name}", file=file)
print(file=file)
print(inspect.getdoc(source_cls), file=file)
def document_build_styles(file: IO[str] = None):
"""
Generate markdown documentation for build styles
"""
# TODO: add inheritance info, and don't repeat inherited options
from moncic.build import Build
print("""# Build styles
This the documentation of the various ways Moncic-CI can build sources, and the
options that can be used to control them.
You can use these options with the `monci ci --option` command line arguments,
or in the [YAML configuration for CI builds](build-config.md).
""", file=file)
for cls in Build.list_build_classes():
print(f"## {cls.get_name()}", file=file)
print(file=file)
print(inspect.getdoc(cls), file=file)
print(file=file)
print("### Options", file=file)
print(file=file)
for name, doc in cls.list_build_options():
print(f"#### {name}", file=file)
print(file=file)
print(doc, file=file)
print(file=file)
def main():
with open("doc/source-styles.md", "wt") as fd:
document_source_styles(file=fd)
with open("doc/build-styles.md", "wt") as fd:
document_build_styles(file=fd)
if __name__ == "__main__":
main()