From 9a02a15285986cbe0cd29a0b5a2efeb1cc3fbaf9 Mon Sep 17 00:00:00 2001 From: Nadia Barbosa Date: Mon, 30 Sep 2019 15:21:48 -0700 Subject: [PATCH] Improve/update documentation generation process --- .gitignore | 1 + .gitmodules | 4 ++-- DEVELOPING.md | 2 +- README.md | 9 +++++++-- documentation/generate_docs.sh | 34 +++++++++++++++++++++++++++------- documentation/jazzy-theme | 1 + documentation/jazzy.yml | 4 ++-- 7 files changed, 41 insertions(+), 14 deletions(-) create mode 160000 documentation/jazzy-theme diff --git a/.gitignore b/.gitignore index 03fc080..3f53199 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ xcuserdata Pods *.xcworkspace *.xcuserstate +*documentation/api-docs/ diff --git a/.gitmodules b/.gitmodules index d6226c3..f167a14 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "jazzy-theme"] - path = annotations-framework-extension/documentation/jazzy-theme +[submodule "documentation/jazzy-theme"] + path = documentation/jazzy-theme url = https://github.com/mapbox/jazzy-theme.git diff --git a/DEVELOPING.md b/DEVELOPING.md index 4ae7d6f..43750eb 100644 --- a/DEVELOPING.md +++ b/DEVELOPING.md @@ -11,7 +11,7 @@ Generate the .xcworkspace for the framework extension by running `pod install`. This project is documented with [Jazzy](https://github.com/realm/jazzy) (v0.10.0). To generate documentation from code comments, run the following command from the root directory of this project: ``` -./annotations-framework-extension/documentation/generate_docs.sh +./documentation/generate_docs.sh ``` ## Testing diff --git a/README.md b/README.md index 4244fd6..8fc2196 100644 --- a/README.md +++ b/README.md @@ -13,16 +13,21 @@ To install the Mapbox Annotation Extension using CocoaPods: Create a Podfile with the following specification: +``` pod 'MapboxAnnotationExtension', '0.0.1-beta.1' -Run pod repo update && pod install and open the resulting Xcode workspace. +``` +Run `pod repo update && pod install` and open the resulting Xcode workspace. ### Using Carthage Alternatively, to install the Mapbox Annotation Extension using Carthage: Create a Cartfile with the following dependency: +``` github "mapbox/mapbox-annotation-extension" ~> 0.0.1-beta.1 -Run carthage update --platform iOS to build just the iOS dependencies. +``` + +Run `carthage update --platform iOS` to build just the iOS dependencies. ### Manual Installation diff --git a/documentation/generate_docs.sh b/documentation/generate_docs.sh index a1cff50..6c95bbf 100755 --- a/documentation/generate_docs.sh +++ b/documentation/generate_docs.sh @@ -4,11 +4,31 @@ set -e set -o pipefail set -u -echo "Generating docs..." -# platform/ios/jazzy.yml +function step { >&2 echo -e "\033[1m\033[36m* $@\033[0m"; } +function finish { >&2 echo -en "\033[0m"; } +trap finish EXIT + +step "Checking for Jazzy installation" +if [ -z `which jazzy` ]; then + echo "Jazzy not found on this machine. Installing jazzy…" + gem install jazzy + if [ -z `which jazzy` ]; then + echo "Unable to install jazzy :(" + exit 1 + fi +fi + +# Search for `s.version` in podspec, grab the first result, +# and return only the version between quotes +VERSION=$( grep -n "s.version" MapboxAnnotationExtension.podspec | head -n 1 | cut -d \" -f2 ) + +step "Jazzy installed. \nGenerating docs for Mapbox Annotation Extension ${VERSION}..." + jazzy \ - --config annotations-framework-extension/documentation/jazzy.yml \ - --output annotations-framework-extension/documentation/api-docs \ - --readme annotations-framework-extension/README.md \ - --title "Annotations Extension" \ - --module-version v0.0.0-alpha.2 + --config documentation/jazzy.yml \ + --output documentation/api-docs \ + --readme README.md \ + --title Annotations Extension \ + --module-version v${VERSION} + +step "Documentation generated for Annotation Extension ${VERSION}! \nPublish it by copying docs to a new pull request in ios-sdk." diff --git a/documentation/jazzy-theme b/documentation/jazzy-theme new file mode 160000 index 0000000..75b9170 --- /dev/null +++ b/documentation/jazzy-theme @@ -0,0 +1 @@ +Subproject commit 75b9170a8b9f85d64f94e3083f8204edce10302c diff --git a/documentation/jazzy.yml b/documentation/jazzy.yml index ef931bb..8c6f246 100644 --- a/documentation/jazzy.yml +++ b/documentation/jazzy.yml @@ -10,8 +10,8 @@ objc: Yes sdk: iphonesimulator skip_undocumented: Yes hide_documentation_coverage: Yes -umbrella_header: ../MapboxAnnotationsExtension/MapboxAnnotationsExtension.h -framework_root: ../MapboxAnnotationsExtension +umbrella_header: ../MapboxAnnotationExtension/MapboxAnnotationExtension.h +framework_root: ../MapboxAnnotationExtension theme: jazzy-theme custom_categories: