#!/bin/bash -e

MYPATH=$(dirname $0)
IOS_ROOT=$MYPATH/..

function has_tool {
    tool=$1
    which "$tool" >/dev/null 2>&1
}

if ! has_tool sourcekitten || ! has_tool jazzy; then
    cat <<EOF
You must install both `sourcekitten` and `jazzy` to generate the iOS documentation.

$ [sudo] brew install sourcekitten
$ [sudo] gem install jazzy
EOF
    exit 2
fi

pushd "$IOS_ROOT" >/dev/null 2>&1
jazzy
