Permalink
Fetching contributors…
Cannot retrieve contributors at this time
executable file 50 lines (40 sloc) 1.07 KB
#!/usr/bin/env bash
# Enable errexit: Exit if any "simple command" fails
set -e
BINARY_DIR=/usr/local/bin/
TEMPLATES_DIR=~/.appledoc
usage() {
cat <<EOF
Usage: $0 [-b binary_path] [-t templates_path]
Builds and installs appledoc
OPTIONS:
-b Path where binary will be installed. Default is $BINARY_DIR
-t Path where templates will be installed. Default is $TEMPLATES_DIR
EOF
}
while getopts "hb:t:" OPTION
do
case $OPTION in
h) usage
exit 0;;
b)
BINARY_DIR=$OPTARG;;
t)
INSTALL_TEMPLATES="YES"
echo "arg is = $OPTARG"
if [ "$OPTARG" != "default" ]; then
TEMPLATES_DIR=$OPTARG
fi
;;
[?])
usage
exit 1;;
esac
done
echo "Building..."
xcodebuild -workspace appledoc.xcworkspace -scheme appledoc -derivedDataPath /tmp -configuration Release install
install -v /tmp/Build/Intermediates/ArchiveIntermediates/appledoc/InstallationBuildProductsLocation/usr/local/bin/appledoc "$BINARY_DIR"
if [ "$INSTALL_TEMPLATES" == "YES" ]; then
echo "Copying templates to $TEMPLATES_DIR"
cp -R Templates/ "$TEMPLATES_DIR"
fi