#!/bin/bash # pls modifid follow lines youself. PHPDOC_DIR="/usr/local/lib/php/pear/PHPDoc" #windows:c:/php/pear/PHPDoc" PHPBIN="/usr/local/bin/php" #windows: c:/php/php.exe CleanUp() { if [ -f $APIDOC_DES/$PID ] ; then printf "Cleaning up..." ; rm -f "$APIDOC_DES/*html" "$APIDOC_DES/*xml" echo "done" fi } ShowUsage() { cat << USAGE_END ; Usage: `basename $0` -s src_dir -d dest_dir [-i title] [-t tpl_dir] Create your API documents with PHPDOC -s source_dir -d dest_dir -i application_title ,optional -t templates_dir,optional ------------------------------------------------- Written by NightSailer when u found bugs,pls tell me,thanx. ------------------------------------------------- USAGE_END } #main procedure APIDOC_TEMP="$PHPDOC_DIR/renderer/html/templates" APIDOC_TITLE="Pear Apication" while getopts s:d:i:t: OPTION ; do case "$OPTION" in s)APIDOC_SRC="$OPTARG";; d)APIDOC_DES="$OPTARG";; i)APIDOC_TITLE="$OPTARG";; t)APIDOC_TEMP="$OPTARG";; \?) ShowUsage; exit 1; ;; esac done if [ -z "$APIDOC_SRC" ] || [ -z "$APIDOC_DES" ] ; then ShowUsage; exit 1; fi echo -n "Check dir..." if [ ! -d $APIDOC_SRC ] || [ ! -r $APIDOC_SRC ] ; then echo "$APIDOC_SRC not existed! or no read permission" exit 1; fi if [ ! -d $APIDOC_DES ] || [ ! -w $APIDOC_DES ] ; then echo "$APIDOC_DES not existed! or no write permission" exit 1; fi echo "Ok" #trap CleanUp 1 2 3 15 #PID=$$ #touch $APIDOC_SRC/$PID $PHPBIN -q << MAKEAPIDOC setApplication("$APIDOC_TITLE"); \$doc->setSourceDirectory("$APIDOC_SRC/"); \$doc->setTarget("$APIDOC_DES/"); \$doc->setSourceFileSuffix(array("php","inc")); \$doc->setTemplateDirectory("$APIDOC_TEMP/"); \$doc->parse(); \$doc->render(); echo "Finished.pls see $APIDOC_DES,enjoy it!"; ?> MAKEAPIDOC #rm -f "$APIDOC_DES/$PID" #exit 0