Skip to content

Commit 4d7ef13

Browse files
authored
additional doc generation fixes (#122)
motivation: better doc generation changes: * dont remove older docs when pushing new ones * add version inforamtion and source links
1 parent 4aad45c commit 4d7ef13

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

scripts/generate_docs.sh

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,12 @@ fi
5151
if ! command -v jazzy > /dev/null; then
5252
gem install jazzy --no-ri --no-rdoc
5353
fi
54-
module_switcher="docs/$version/README.md"
54+
55+
jazzy_dir="$root_path/.build/jazzy"
56+
rm -rf "$jazzy_dir"
57+
mkdir -p "$jazzy_dir"
58+
59+
module_switcher="$jazzy_dir/README.md"
5560
jazzy_args=(--clean
5661
--author 'SwiftLog team'
5762
--readme "$module_switcher"
@@ -68,15 +73,12 @@ SwiftLog is a Swift logging API package.
6873
To get started with SwiftLog, [`import Logging`](../Logging/index.html). The
6974
most important type is [`Logger`](https://apple.github.io/swift-log/docs/current/Logging/Structs/Logger.html)
7075
which you can use to emit log messages.
71-
7276
EOF
7377

74-
jazzy_dir="$root_path/.build/jazzy"
75-
rm -rf "$jazzy_dir"
76-
mkdir -p "$jazzy_dir"
77-
7878
for module in "${modules[@]}"; do
79-
args=("${jazzy_args[@]}" --output "$jazzy_dir/docs/$version/$module" --docset-path "$jazzy_dir/docset/$version/$module" --module "$module")
79+
args=("${jazzy_args[@]}" --output "$jazzy_dir/docs/$version/$module" --docset-path "$jazzy_dir/docset/$version/$module"
80+
--module "$module" --module-version $version
81+
--root-url "https://apple.github.io/swift-log/docs/$version/$module/")
8082
if [[ -f "$root_path/.build/sourcekitten/$module.json" ]]; then
8183
args+=(--sourcekitten-sourcefile "$root_path/.build/sourcekitten/$module.json")
8284
fi
@@ -89,8 +91,9 @@ if [[ $PUSH == true ]]; then
8991
GIT_AUTHOR=$(git --no-pager show -s --format='%an <%ae>' HEAD)
9092
git fetch origin +gh-pages:gh-pages
9193
git checkout gh-pages
92-
rm -rf "docs"
93-
cp -r "$jazzy_dir/docs" .
94+
rm -rf "docs/$version"
95+
rm -rf "docs/current"
96+
cp -r "$jazzy_dir/docs/$version" docs/
9497
cp -r "docs/$version" docs/current
9598
git add --all docs
9699
echo '<html><head><meta http-equiv="refresh" content="0; url=docs/current/Logging/index.html" /></head></html>' > index.html

0 commit comments

Comments
 (0)