Skip to content

Commit 70d52d2

Browse files
author
Clément Le Provost
committed
[doc] Generate the two flavors of the documentation (online and offline)
- Online flavor goes to the root. - Offline flavor goes into an `offline` subdirectory. [ci skip]
1 parent fe4ef1d commit 70d52d2

File tree

7 files changed

+101
-10
lines changed

7 files changed

+101
-10
lines changed

.jazzy.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,21 @@ output: build/doc
44
docset_path: ../docset
55
hide_documentation_coverage: true
66
skip_undocumented: true
7+
# Avoid putting the current date into the docs (this makes the diff quite noisy).
8+
# TODO: Jazzy does not support putting the Cocoapods version so far.
9+
copyright: "© Copyright 2016 [Algolia](https://www.algolia.com/). All rights reserved."
10+
readme: doc/include/reference.md
11+
custom_categories:
12+
- name: API Client
13+
children:
14+
- Client
15+
- Index
16+
- Query
17+
- BrowseIterator
18+
19+
- name: Auxiliary types
20+
children:
21+
- GeoRect
22+
- IndexQuery
23+
- LatLng
24+
- LibraryVersion

doc/include/reference-offline.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
3+
# Algolia Search Offline API Client for Swift
4+
5+
This is the reference documentation for the **Algolia Search Offline API Client for Swift**. You can always browse the latest version online at [Algolia Community](https://community.algolia.com/algoliasearch-client-swift/offline/).
6+
7+
**Note:** The Offline API Client is an offline-enabled version, and a superset, of the regular [API Client](../index.html).
8+
9+
**Note:** This documentation is automatically generated from sources. For an overview of how Algolia works, detailed setup and usage instructions, please refer to our [Documentation](https://www.algolia.com/doc), in particular to the [Swift API Client](https://www.algolia.com/doc/api-client/swift/) documentation.

doc/include/reference.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
3+
# Algolia Search API Client for Swift
4+
5+
This is the reference documentation for the **Algolia Search API Client for Swift**. You can always browse the latest version online at [Algolia Community](https://community.algolia.com/algoliasearch-client-swift/).
6+
7+
**Note:** This documentation is automatically generated from sources. For an overview of how Algolia works, detailed setup and usage instructions, please refer to our [Documentation](https://www.algolia.com/doc), in particular to the [Swift API Client](https://www.algolia.com/doc/api-client/swift/) documentation.

doc/maintenance.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,14 @@ keep versioning aligned (there is only one version number for both flavors).
6969

7070
- Edit the **release notes**: in GitHub, edit the tag and copy-paste the Change Log section for this release.
7171

72+
- Update the **reference documentation**:
73+
74+
- Generate the documentation: `tools/make-doc.sh`
75+
76+
- Review it: `cd build/doc && git diff`
77+
78+
- Publish it: `git add . && git commit && git push`
79+
7280
- Update the **external documentation** if necessary:
7381

7482
- [Guides](https://www.algolia.com/doc/guides)

doc/reference.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

offline.jazzy.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@ xcodebuild_arguments:
55
- AlgoliaSearch.xcworkspace
66
- -scheme
77
- AlgoliaSearch-Offline-iOS
8-
output: build/doc
8+
output: build/doc/offline
99
# Avoid putting the DocSet within the HTML docs.
1010
# WARNING: The path is relative to the output directory.
11-
docset_path: ../docset
11+
docset_path: ../../docset-offline
1212
hide_documentation_coverage: true
1313
skip_undocumented: true
14-
readme: doc/reference.md
14+
# Avoid putting the current date into the docs (this makes the diff quite noisy).
15+
# TODO: Jazzy does not support putting the Cocoapods version so far.
16+
copyright: "© Copyright 2016 [Algolia](https://www.algolia.com/). All rights reserved."
17+
readme: doc/include/reference-offline.md
1518
custom_categories:
1619
- name: API Client
1720
children:

tools/make-doc.sh

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/usr/bin/env ksh
2+
3+
set -e # fail on first error
4+
5+
# Reflection.
6+
SELF_ROOT=$(cd $(dirname "$0") && pwd)
7+
PROJECT_ROOT=$(cd "$SELF_ROOT"/.. && pwd)
8+
9+
GIT_REPO_NAME="algolia/algoliasearch-helper-swift"
10+
BRANCH_NAME="gh-pages"
11+
DST_DIR="$PROJECT_ROOT/build/doc"
12+
13+
# Prepare the destination directory
14+
# ---------------------------------
15+
# If the destination directory exists, make sure that it's a Git checkout of the `gh-pages` branch.
16+
if [[ -d "$DST_DIR" ]]; then
17+
branch_name=$(cd "$DST_DIR" && git rev-parse --abbrev-ref HEAD)
18+
if [[ "$branch_name" != "$BRANCH_NAME" ]]; then
19+
echo "ERROR: Directory '$DST_DIR' is not a checkout of the '$BRANCH_NAME' branch!" 1>&2
20+
exit 1
21+
fi
22+
pwd=$(pwd)
23+
# Clean the Git checkout.
24+
echo "Git checkout found; cleaning"
25+
cd "$DST_DIR" && git clean -f
26+
cd "$pwd"
27+
# Otherwise, create it.
28+
else
29+
echo "No Git checkout found; cloning"
30+
mkdir -p $(dirname "$DST_DIR")
31+
git clone [email protected]:$GIT_REPO_NAME -b "$BRANCH_NAME" --single-branch "$DST_DIR"
32+
fi
33+
34+
# Make the documentation
35+
# ----------------------
36+
# Clean the destination directory.
37+
# NOTE: We don't use Jazzy's `--clean` option because it deletes the destination directory; we want to preserve the
38+
# Git checkout.
39+
echo "Cleaning destination directory"
40+
rm -rf "$DST_DIR"/*
41+
42+
# Generate the documentations with [Jazzy](https://github.com/realm/jazzy).
43+
cd "$PROJECT_ROOT"
44+
# Online flavor -> root directory.
45+
echo "# Generating online flavor"
46+
jazzy --config .jazzy.yaml
47+
# Offline flavor -> `offline` subdirectory.
48+
echo "# Generating offline flavor"
49+
jazzy --config offline.jazzy.yaml
50+
51+
cp "$PROJECT_ROOT/LICENSE" "$DST_DIR/LICENSE.md"
52+
53+
echo 'Done. Git diff then add and commit.'

0 commit comments

Comments
 (0)