- +

Watson Developer Cloud Swift SDK

Table of Contents

diff --git a/Scripts/generate-documentation.sh b/Scripts/generate-documentation.sh index caddb9cc4..4cf2cd648 100755 --- a/Scripts/generate-documentation.sh +++ b/Scripts/generate-documentation.sh @@ -1,5 +1,8 @@ #!/bin/bash +# Set the output directory +outdir=${1:-gh-pages} + ################################################################################ # Define list of services ################################################################################ @@ -8,7 +11,7 @@ services=( AssistantV1 ConversationV1 DiscoveryV1 - LanguageTranslatorV2 + LanguageTranslatorV3 NaturalLanguageClassifierV1 NaturalLanguageUnderstandingV1 PersonalityInsightsV3 @@ -32,25 +35,25 @@ cd .. # Create folder for generated documentation ################################################################################ -if [ -d "docs/swift-api" ]; then - echo "The docs/swift-api directory already exists." +if [ -d "${outdir}" ]; then + echo "The output directory ${outdir} already exists." echo "Please remove the directory and try again." exit fi -mkdir docs/swift-api -mkdir docs/swift-api/services +mkdir ${outdir} +mkdir ${outdir}/services ################################################################################ # Run Jazzy to generate documentation ################################################################################ for service in ${services[@]}; do - mkdir docs/swift-api/services/${service} + mkdir ${outdir}/services/${service} xcodebuild_arguments=-project,WatsonDeveloperCloud.xcodeproj,-scheme,${service} jazzy \ --xcodebuild-arguments $xcodebuild_arguments \ - --output docs/swift-api/services/${service} \ + --output ${outdir}/services/${service} \ --clean \ --github_url https://github.com/watson-developer-cloud/ios-sdk \ --hide-documentation-coverage @@ -60,36 +63,36 @@ done # Generate index.html and copy supporting files ################################################################################ -cp Scripts/generate-documentation-resources/index-prefix docs/index.html +cp Scripts/generate-documentation-resources/index-prefix ${outdir}/index.html for service in ${services[@]}; do - html="
  • ${service}
  • " - echo ${html} >> docs/index.html + html="
  • ${service}
  • " + echo ${html} >> ${outdir}/index.html done -cat Scripts/generate-documentation-resources/index-postfix >> docs/index.html +cat Scripts/generate-documentation-resources/index-postfix >> ${outdir}/index.html -cp -r Scripts/generate-documentation-resources/* docs/swift-api -rm docs/swift-api/index-prefix docs/swift-api/index-postfix +cp -r Scripts/generate-documentation-resources/* ${outdir} +rm ${outdir}/index-prefix ${outdir}/index-postfix ################################################################################ # Collect undocumented.json files ################################################################################ -touch docs/swift-api/undocumented.json -echo "[" >> docs/swift-api/undocumented.json +touch ${outdir}/undocumented.json +echo "[" >> ${outdir}/undocumented.json declare -a undocumenteds -undocumenteds=($(ls -r docs/swift-api/services/*/undocumented.json)) +undocumenteds=($(ls -r ${outdir}/services/*/undocumented.json)) if [ ${#undocumenteds[@]} -gt 0 ]; then - echo -e -n "\t" >> docs/swift-api/undocumented.json - cat "${undocumenteds[0]}" >> docs/swift-api/undocumented.json + echo -e -n "\t" >> ${outdir}/undocumented.json + cat "${undocumenteds[0]}" >> ${outdir}/undocumented.json unset undocumenteds[0] for f in "${undocumenteds[@]}"; do - echo "," >> docs/swift-api/undocumented.json - echo -e -n "\t" >> docs/swift-api/undocumented.json - cat "$f" >> docs/swift-api/undocumented.json + echo "," >> ${outdir}/undocumented.json + echo -e -n "\t" >> ${outdir}/undocumented.json + cat "$f" >> ${outdir}/undocumented.json done fi -echo "" >> docs/swift-api/undocumented.json -echo "]" >> docs/swift-api/undocumented.json +echo "" >> ${outdir}/undocumented.json +echo "]" >> ${outdir}/undocumented.json