Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions etc/docs-main.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ The MongoDB Swift driver contains two modules:
- [MongoSwift](../MongoSwift/index.html), containing an asynchronous API and a BSON library
- [MongoSwiftSync](../MongoSwiftSync/index.html), containing a synchronous wrapper of the API in `MongoSwift`

See [here](https://mongodb.github.io/mongo-swift-driver/docs) for documentation of other versions of the driver.

The driver relies on our [official Swift BSON library](https://github.com/mongodb/swift-bson), with API documentation available [here](https://mongodb.github.io/swift-bson).
3 changes: 2 additions & 1 deletion etc/generate-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@ jazzy_args=(--clean
--module-version "${version}")

# Generate MongoSwift docs
sourcekitten doc --spm --module-name MongoSwift > mongoswift-docs.json
Copy link
Contributor Author

@patrickfreed patrickfreed Feb 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was required to make the script work on Linux.

see: https://github.com/realm/jazzy#linux

args=("${jazzy_args[@]}" --output "docs-temp/MongoSwift" --module "MongoSwift" --config ".jazzy.yml"
--sourcekitten-sourcefile mongoswift-docs.json
--root-url "https://mongodb.github.io/mongo-swift-driver/docs/MongoSwift/")
jazzy "${args[@]}"

# Generate MongoSwiftSync docs

# we have to do some extra work to get re-exported symbols to show up
sourcekitten doc --spm --module-name MongoSwift > mongoswift-docs.json
python3 etc/filter_sourcekitten_output.py

sourcekitten doc --spm --module-name MongoSwiftSync > mongoswiftsync-docs.json
Expand Down
9 changes: 6 additions & 3 deletions etc/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ version=${1}
# commit/push docs to the gh-pages branch
git checkout gh-pages

rm -rf docs/*
mv docs-temp/* docs/
rm -d docs-temp
rm -r docs/current
cp -r docs-temp docs/current
mv docs-temp docs/${version}

# build up documentation index
python3 ./etc/update-index.py

git add docs/
git commit -m "${version} docs"
Expand Down
17 changes: 17 additions & 0 deletions etc/update-index.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import os
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really loathe bash scripting (and I can't write it either) so I just made another python script.


first=True
with open('./docs/index.md', 'w') as f:
f.write('# MongoSwift Documentation Index\n')

for dir in sorted(os.listdir('./docs'), reverse=True):
if not dir[0].isdigit():
continue

version_str = dir
if first:
version_str += ' (current)'
dir = 'current'
first = False

f.write('- [{}]({}/MongoSwift/index.html)\n'.format(version_str, dir))