Skip to content

Commit 78dfbbe

Browse files
committed
Toolchain: Adjust oasisctl generator for new docs structure and improve output
1 parent d8b0e6a commit 78dfbbe

File tree

2 files changed

+25
-19
lines changed

2 files changed

+25
-19
lines changed

toolchain/scripts/generators/oasisctl.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
'tandc': 'Terms & Conditions',
3737
'arangodb': 'ArangoDB',
3838
'cpusizes': 'CPU Sizes',
39-
'nodesizes': 'Node Sizes'
39+
'nodesizes': 'Node Sizes',
40+
'scheduled-root-password-rotation': 'Scheduled Root Password Rotation'
4041
}
4142

4243

@@ -115,7 +116,12 @@ def create_filename(filename):
115116
def rewrite_content(data, section, filename, weight):
116117
title = ""
117118
content = ""
118-
flags = {"inFrontMatter": False, "endFrontMatter": False, "inHeader": False, "firstHeaderContent": False}
119+
flags = {
120+
"inFrontMatter": False,
121+
"endFrontMatter": False,
122+
"inHeader": False,
123+
"firstHeaderContent": False,
124+
}
119125

120126
for i, line in enumerate(data):
121127

@@ -128,24 +134,24 @@ def rewrite_content(data, section, filename, weight):
128134

129135
if flags["inFrontMatter"] and not flags["endFrontMatter"]:
130136
if line.startswith("description: "):
131-
if filename.endswith("/options.md"):
132-
content = content + "description: Command-line client tool for managing the Arango Managed Platform (AMP)\n"
137+
#if filename.endswith("/options.md"):
138+
# content = content + "description: Command-line client tool for managing AMP\n"
133139
continue
134140

135141
if line.startswith("layout: "):
136142
continue
137143

138144
if line.startswith("title: "):
139145
if filename.endswith("/options.md"):
140-
content = content + f"title: Arango Managed Platform (AMP) Shell oasisctl\nmenuTitle: Options\nweight: {weight}\n"
146+
content = content + f"title: The `oasisctl` command\nmenuTitle: Options\nweight: {weight}\n"
141147
continue
142148

143149
menuTitle = ""
144150
title = line.rstrip().replace("title: ", "")
145-
for word in title.split(" "):
151+
for word in title.split(" ")[1:]:
146152
menuTitle = menuTitle + f" {TITLE_CASE.get(word.lower(), word)}"
147153

148-
content = content + f"title:{menuTitle}\nmenuTitle:{menuTitle.replace('Oasisctl ', '')}\nweight: {weight}\n"
154+
content = content + f"title:{menuTitle} with `oasisctl`\nmenuTitle:{menuTitle}\nweight: {weight}\n"
149155
continue
150156

151157
if line.startswith("###### Auto generated"):
@@ -169,7 +175,8 @@ def rewrite_content(data, section, filename, weight):
169175
continue
170176

171177
if line.startswith("## "):
172-
content = content + line
178+
# The command as a headline, e.g. ## oasisctl add group
179+
#content = content + line
173180
continue
174181

175182
if line == "---\n":

toolchain/scripts/toolchain.sh

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ function main() {
114114
process_server "$server"
115115
done
116116

117+
## Independent of ArangoDB versions/servers
118+
if [[ $GENERATORS == *"oasisctl"* ]]; then
119+
generate_oasisctl
120+
fi
121+
117122
run_arangoproxy_and_site
118123

119124
## Start arangoproxy and site containers to build examples and site
@@ -434,10 +439,6 @@ function generators_from_source() {
434439
if [[ $GENERATORS == *"metrics"* ]]; then
435440
generate_metrics "$version"
436441
fi
437-
438-
if [[ $GENERATORS == *"oasisctl"* ]]; then
439-
generate_oasisctl "$version"
440-
fi
441442
}
442443

443444

@@ -575,8 +576,6 @@ function generate_metrics() {
575576
function generate_oasisctl() {
576577
echo "<li><strong>OasisCTL</strong>" >> /home/summary.md
577578
578-
version=$1
579-
580579
log "[generate_oasisctl] Generate OasisCTL docs"
581580
582581
if [ ! -f /tmp/oasisctl.zip ]; then
@@ -587,8 +586,8 @@ function generate_oasisctl() {
587586
mkdir -p /tmp/oasisctl
588587
mkdir -p /tmp/preserve
589588
590-
cp ../../site/content/$version/arangograph/oasisctl/_index.md /tmp/preserve/oasisctl.md > /dev/null
591-
rm -r ../../site/content/$version/arangograph/oasisctl/* > /dev/null
589+
cp ../../site/content/amp/oasisctl/_index.md /tmp/preserve/oasisctl.md > /dev/null
590+
rm -r ../../site/content/amp/oasisctl/* > /dev/null
592591
593592
log "[generate_oasisctl] oasisctl generate-docs --link-file-ext .html --replace-underscore-with - --output-dir /tmp/oasisctl)"
594593
res=$(oasisctl generate-docs --link-file-ext .html --replace-underscore-with - --output-dir /tmp/oasisctl)
@@ -597,14 +596,14 @@ function generate_oasisctl() {
597596
echo "<error code=8><strong> ERROR: </strong>$res</error>" >> /home/summary.md
598597
fi
599598
600-
log "[generate_oasisctl] "$PYTHON_EXECUTABLE" generators/oasisctl.py --src /tmp/oasisctl --dst ../../site/content/$version/arangograph/oasisctl/"
601-
res=$(("$PYTHON_EXECUTABLE" generators/oasisctl.py --src /tmp/oasisctl --dst ../../site/content/$version/arangograph/oasisctl/) 2>&1 )
599+
log "[generate_oasisctl] "$PYTHON_EXECUTABLE" generators/oasisctl.py --src /tmp/oasisctl --dst ../../site/content/amp/oasisctl/"
600+
res=$(("$PYTHON_EXECUTABLE" generators/oasisctl.py --src /tmp/oasisctl --dst ../../site/content/amp/oasisctl/) 2>&1 )
602601
if [ $? -ne 0 ]; then
603602
log "[generate_oasisctl] [ERROR] Error from oasisctl.py: $res"
604603
echo "<error code=8><strong> ERROR: Error: </strong>$res</error></li>" >> /home/summary.md
605604
fi
606605
607-
cp /tmp/preserve/oasisctl.md ../../site/content/$version/arangograph/oasisctl/_index.md
606+
cp /tmp/preserve/oasisctl.md ../../site/content/amp/oasisctl/_index.md
608607
609608
echo "&#x2713;" >> /home/summary.md
610609
echo "</li>" >> /home/summary.md

0 commit comments

Comments
 (0)