2008-10-22 23:15:04 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
usage()
|
|
|
|
{
|
|
|
|
cat << HELPMSG
|
|
|
|
Usage:
|
|
|
|
add this library to a javascript project for you
|
|
|
|
$0 -d <project path>
|
|
|
|
|
|
|
|
print this help
|
|
|
|
$0 -h
|
|
|
|
HELPMSG
|
|
|
|
}
|
|
|
|
|
|
|
|
while getopts "d:h" OPTION
|
|
|
|
do
|
|
|
|
case $OPTION in
|
|
|
|
d)
|
|
|
|
DIRNAME=$OPTARG
|
|
|
|
;;
|
|
|
|
h)
|
|
|
|
usage
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
?)
|
|
|
|
usage
|
|
|
|
exit 1
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2009-01-02 21:25:35 -06:00
|
|
|
MYDIR=$(dirname $0)
|
|
|
|
|
2008-10-22 23:15:04 +00:00
|
|
|
if [[ -z $DIRNAME ]]
|
|
|
|
then
|
|
|
|
echo "No -d option was present. You must provide a Project path.";
|
|
|
|
usage
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Setting up in project: ${DIRNAME}"
|
|
|
|
|
|
|
|
#set up the directory structure
|
2009-01-02 21:25:35 -06:00
|
|
|
if [[ ! -d $DIRNAME/ext ]]
|
2008-10-22 23:15:04 +00:00
|
|
|
then
|
2009-01-02 21:25:35 -06:00
|
|
|
echo Making ${DIRNAME}/ext
|
|
|
|
mkdir $DIRNAME/ext
|
2008-10-22 23:15:04 +00:00
|
|
|
fi
|
|
|
|
|
2009-01-02 21:25:35 -06:00
|
|
|
if [[ ! -d $DIRNAME/harness ]]
|
2008-10-22 23:15:04 +00:00
|
|
|
then
|
2009-01-02 21:25:35 -06:00
|
|
|
echo Making ${DIRNAME}/harness
|
|
|
|
mkdir $DIRNAME/harness
|
2008-10-22 23:15:04 +00:00
|
|
|
fi
|
|
|
|
|
2009-01-02 21:25:35 -06:00
|
|
|
if [[ ! -d $DIRNAME/t || -d $DIRNAME/tests ]]
|
2008-10-22 23:15:04 +00:00
|
|
|
then
|
2009-01-02 21:25:35 -06:00
|
|
|
echo Making ${DIRNAME}/t
|
|
|
|
mkdir $DIRNAME/t
|
2008-10-22 23:15:04 +00:00
|
|
|
fi
|
|
|
|
|
2009-01-02 21:25:35 -06:00
|
|
|
echo copy the files we need for initial setup
|
|
|
|
cp -r -f $MYDIR/../lib/Test $DIRNAME/ext/
|
|
|
|
if [[ -d $DIRNAME/t ]]
|
2008-10-22 23:15:04 +00:00
|
|
|
then
|
2009-01-02 21:25:35 -06:00
|
|
|
echo copying TapHarness.html to $DIRNAME/t/
|
|
|
|
cp -r -f $MYDIR/../tmpl/TapHarness.html $DIRNAME/t/
|
2008-10-22 23:15:04 +00:00
|
|
|
elif [[ -d tests ]]
|
|
|
|
then
|
2009-01-02 21:25:35 -06:00
|
|
|
echo copying TapHarness.html to $DIRNAME/tests/
|
|
|
|
cp -r -f $MYDIR/../tmpl/TapHarness.html $DIRNAME/tests/
|
2008-10-22 23:15:04 +00:00
|
|
|
fi
|
|
|
|
|
2009-01-02 21:25:35 -06:00
|
|
|
echo copying rhino harnesses to $DIRNAME/harness/
|
|
|
|
cp -r -f $MYDIR/../tmpl/*rhino* $DIRNAME/harness/
|
2008-10-22 23:15:04 +00:00
|
|
|
|