Merge pull request #182 from BobKerns/mingw

Make jsdoc script work with MinGW and Cygwin
This commit is contained in:
Jeff Williams 2012-09-12 07:12:01 -07:00
commit da485dff2c

13
jsdoc
View File

@ -3,10 +3,18 @@
# rhino discards the path to the current script file, so we must add it back
SOURCE="$0"
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
BASEPATH="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
# Get a Windows path under MinGW or Cygwin
BASEPATH="$( cd -P "$( dirname "$SOURCE" )" && (pwd -W 2>/dev/null || cygpath -w $(pwd) 2>/dev/null || pwd))"
if [ "${BASEPATH:0:1}" != "/" ] ; then
BASEPATH="${BASEPATH//\\//}"
# We need a extra slash for URLs
UBASEPATH="/$BASEPATH"
else
UBASEPATH="$BASEPATH"
fi
# for whatever reason, Rhino requires module paths to be valid URIs
URLPATH="file://"$BASEPATH
URLPATH="file://$UBASEPATH"
URLPATH=`echo "$URLPATH" | sed -e 's/ /%20/g'`
ENCODEDBASEPATH=`echo "$BASEPATH" | sed -e 's/ /%20/g'`
@ -27,6 +35,7 @@ fi
if test "$1" = "-T"
then
echo "Running Tests"
cd -P "$(dirname "$SOURCE")"
java -classpath "${BASEPATH}/lib/js.jar" ${CMD} -opt -1 -modules "${URLPATH}/nodejs_modules" -modules "${URLPATH}/rhino_modules" -modules "${URLPATH}" "${BASEPATH}/jsdoc.js" $ARGS --dirname="${BASEPATH}/"
else