-
-
Save christian-public/1080496 to your computer and use it in GitHub Desktop.
Script to be used within xcode as a build phase to generate documentation with appledoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Script to be used within xcode to generate documentation through appledoc | |
# Prior to the execution of this script the appledoc executable and templates should have been copied | |
# to the appledoc folder in the project root directory | |
# | |
# Created by Sumeru Chatterjee the night the earth stood still | |
# https://gist.github.com/1077672 | |
#Company Name the only variable that I cant seem to grab from the environment_variables | |
COMPANY=My_Company_Name | |
#Path to Appledoc executable | |
APPLEDOC="$PROJECT_DIR"/appledoc/appledoc | |
echo "Checking For Appledoc Executable at ${APPLEDOC}" | |
if [[ ! `ls "${APPLEDOC}"` ]] | |
then | |
exit -1 | |
fi | |
#The Templates Directory | |
TEMPLATE_DIR="$PROJECT_DIR"/appledoc/Templates | |
#The Output Directory | |
OUTPUT_DIR="$PROJECT_DIR"/appledoc/Output | |
#Company ID | |
COMPANY_SMALL=`echo $COMPANY | tr A-Z a-z` | |
COMPANY_ID="com.${COMPANY_SMALL}" | |
echo "Running appledoc to Generate Documentation From Header Files" | |
"${APPLEDOC}" --templates "${TEMPLATE_DIR}" --project-name ${PROJECT} --project-company ${COMPANY} --company-id ${COMPANY_ID} --output "${OUTPUT_DIR}" --keep-intermediate-files --keep-undocumented-objects --keep-undocumented-members --search-undocumented-doc --merge-categories "$PROJECT_DIR"/appledoc/Headers | |
#Delete Copied Headers | |
rm "$PROJECT_DIR"/appledoc/Headers/* | |
#The address of the Web Server root on a mac | |
WEB_SERVER_ROOT=/Library/WebServer/Documents | |
PROJECT_SMALL=`echo $PROJECT | tr A-Z a-z` | |
DOC_DIR="${PROJECT_SMALL}doc" | |
if [ ! -d "$WEB_SERVER_ROOT/$DOC_DIR" ]; then | |
echo "Creating Directory ${WEB_SERVER_ROOT}/${DOC_DIR}" | |
mkdir $WEB_SERVER_ROOT/$DOC_DIR | |
else | |
echo "Cleaning Previous Documentation from ${WEB_SERVER_ROOT}/${DOC_DIR}" | |
rm -rf $WEB_SERVER_ROOT/$DOC_DIR/* | |
fi | |
echo "Copying Generated HTML to ${WEB_SERVER_ROOT}/${DOC_DIR}" | |
cp -R "$PROJECT_DIR"/appledoc/output/html/* $WEB_SERVER_ROOT/$DOC_DIR | |
if [ $? -eq 0 ] ; then | |
echo "Files Copied Successfully.Now go to http://127.0.0.1/${DOC_DIR} to view the documentation" | |
exit 0; | |
else | |
echo "ERROR: failed to copy files to webserver directory" | |
exit -1; | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment