9
9
< meta name ="viewport " content ="width=device-width, initial-scale=1, minimum-scale=1 " />
10
10
< meta name ="generator " content ="pdoc 0.9.2 " />
11
11
< title > continuous_delivery_scripts.generate_docs API documentation</ title >
12
- < meta name ="description " content ="Generates documentation using Pdoc . " />
12
+ < meta name ="description " content ="Generates documentation. " />
13
13
< link rel ="preload stylesheet " as ="style " href ="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/sanitize.min.css " integrity ="sha256-PK9q560IAAa6WVRRh76LtCaI8pjTJ2z11v0miyNNjrs= " crossorigin >
14
14
< link rel ="preload stylesheet " as ="style " href ="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/typography.min.css " integrity ="sha256-7l/o7C8jubJiy74VsKTidCy1yBkRtiUGbVkYBylBqUg= " crossorigin >
15
15
< link rel ="stylesheet preload " as ="style " href ="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/styles/github.min.css " crossorigin >
26
26
< h1 class ="title "> Module < code > continuous_delivery_scripts.generate_docs</ code > </ h1 >
27
27
</ header >
28
28
< section id ="section-intro ">
29
- < p > Generates documentation using Pdoc .</ p >
29
+ < p > Generates documentation.</ p >
30
30
< details class ="source ">
31
31
< summary >
32
32
< span > Expand source code</ span >
33
33
</ summary >
34
34
< pre > < code class ="python "> #
35
- # Copyright (C) 2020 Arm Mbed . All rights reserved.
35
+ # Copyright (C) 2020 Arm. All rights reserved.
36
36
# SPDX-License-Identifier: Apache-2.0
37
37
#
38
- """Generates documentation using Pdoc."""
38
+ """Generates documentation."""
39
+ import argparse
40
+ import logging
39
41
import os
40
42
import shutil
41
43
import sys
42
-
43
- import argparse
44
- import logging
45
44
from pathlib import Path
46
- from subprocess import check_call
47
- from typing import List
48
45
46
+ from continuous_delivery_scripts.language_specifics import get_language_specifics
49
47
from continuous_delivery_scripts.utils.configuration import configuration, ConfigurationVariable
50
- from continuous_delivery_scripts.utils.filesystem_helpers import TemporaryDirectory
51
48
from continuous_delivery_scripts.utils.logging import log_exception
52
49
53
50
logger = logging.getLogger(__name__)
@@ -59,40 +56,11 @@ <h1 class="title">Module <code>continuous_delivery_scripts.generate_docs</code><
59
56
shutil.rmtree(str(output_directory))
60
57
61
58
62
- def _generate_pdoc_command_list(output_directory: Path, module: str) -> List[str]:
63
- return [
64
- "pdoc",
65
- "--html",
66
- f"{module}",
67
- "--output-dir",
68
- f"{str(output_directory)}",
69
- "--force",
70
- "--config",
71
- "show_type_annotations=True",
72
- ]
73
-
74
-
75
59
def generate_documentation(output_directory: Path, module_to_document: str) -> None:
76
- """Ensures the documentation is in the correct location.
77
-
78
- Pdoc nests its docs output in a folder with the module's name.
79
- This process removes this unwanted folder.
80
- """
60
+ """Generates the documentation."""
81
61
_clear_previous_docs(output_directory)
82
62
os.makedirs(str(output_directory), exist_ok=True)
83
- with TemporaryDirectory() as temp_dir:
84
- _call_pdoc(temp_dir, module_to_document)
85
- docs_contents_dir = temp_dir.joinpath(module_to_document)
86
- if docs_contents_dir.exists() and docs_contents_dir.is_dir():
87
- for element in docs_contents_dir.iterdir():
88
- shutil.move(str(element), str(output_directory))
89
-
90
-
91
- def _call_pdoc(output_directory: Path, module: str) -> None:
92
- """Calls Pdoc for generating the docs."""
93
- logger.info("Creating Pdoc documentation.")
94
- command_list = _generate_pdoc_command_list(output_directory, module)
95
- check_call(command_list)
63
+ get_language_specifics().generate_code_documentation(output_directory, module_to_document)
96
64
97
65
98
66
def generate_docs(output_directory: Path, module: str) -> int:
@@ -153,27 +121,16 @@ <h2 class="section-title" id="header-functions">Functions</h2>
153
121
< span > def < span class ="ident "> generate_documentation</ span > </ span > (< span > output_directory: pathlib.Path, module_to_document: str) ‑> NoneType</ span >
154
122
</ code > </ dt >
155
123
< dd >
156
- < div class ="desc "> < p > Ensures the documentation is in the correct location.</ p >
157
- < p > Pdoc nests its docs output in a folder with the module's name.
158
- This process removes this unwanted folder.</ p > </ div >
124
+ < div class ="desc "> < p > Generates the documentation.</ p > </ div >
159
125
< details class ="source ">
160
126
< summary >
161
127
< span > Expand source code</ span >
162
128
</ summary >
163
129
< pre > < code class ="python "> def generate_documentation(output_directory: Path, module_to_document: str) -> None:
164
- """Ensures the documentation is in the correct location.
165
-
166
- Pdoc nests its docs output in a folder with the module's name.
167
- This process removes this unwanted folder.
168
- """
130
+ """Generates the documentation."""
169
131
_clear_previous_docs(output_directory)
170
132
os.makedirs(str(output_directory), exist_ok=True)
171
- with TemporaryDirectory() as temp_dir:
172
- _call_pdoc(temp_dir, module_to_document)
173
- docs_contents_dir = temp_dir.joinpath(module_to_document)
174
- if docs_contents_dir.exists() and docs_contents_dir.is_dir():
175
- for element in docs_contents_dir.iterdir():
176
- shutil.move(str(element), str(output_directory))</ code > </ pre >
133
+ get_language_specifics().generate_code_documentation(output_directory, module_to_document)</ code > </ pre >
177
134
</ details >
178
135
</ dd >
179
136
< dt id ="continuous_delivery_scripts.generate_docs.main "> < code class ="name flex ">
0 commit comments