Skip to content
10 changes: 5 additions & 5 deletions tools/build.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#!/bin/bash -e
home=`dirname $0`
home=$(dirname $0)
cd $home
if [ -f buildpid.log ]; then
buildpid=`cat buildpid.log`
buildpid=$(cat buildpid.log)
kill -9 $buildpid || true
rm -f buildpid.log
fi
echo $$ > buildpid.log
if [ -f nodepid.log ]; then
nodepid=`cat nodepid.log`
nodepid=$(cat nodepid.log)
kill -9 $nodepid || true
rm -f nodepid.log
fi
ver=`grep 'numeric.version.*=.*"' ../src/numeric.js | sed 's/numeric.version[ =]*"\([0-9.]*\)".*/\1/'`
ver=$(grep 'numeric.version.*=.*"' ../src/numeric.js | sed 's/numeric.version[ =]*"\([0-9.]*\)".*/\1/')
echo "Version is $ver"
cat ../src/numeric.js ../src/seedrandom.js ../src/quadprog.js ../src/svd.js > ../lib/numeric-$ver.js
uglifyjs ../lib/numeric-$ver.js > ../lib/numeric-$ver.min.js
Expand Down Expand Up @@ -44,7 +44,7 @@ cp ../src/documentation.html ..
rm -f ../workshop.php
sed -e '/WORKSHOPHTML/r workshop.html' -e 's/WORKSHOPHTML//' -e "s/VERSIONSTRING/$ver/" workshop_in.php > ../workshop.php
cd ..
runjs=`which d8 || which jsdb || which node`
runjs=$(which d8 || which jsdb || which node)
echo Using $runjs
$runjs ./tools/unit2.js &
echo $! > tools/nodepid.log
Expand Down
18 changes: 9 additions & 9 deletions tools/deploy/#deploy.sh#
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
#!/bin/bash
set -e
cd `dirname $0`
cd $(dirname $0)
cd ../..
foo=`git status --porcelain` &&
foo=$(git status --porcelain) &&
if [ "x" != "x$foo" ]; then
echo "Cannot deploy while there are uncommited changes."
exit
fi
ver=`grep "numeric.version =" src/numeric.js | sed 's/.*[''"]\([0-9.]*\)[''"].*/\1/'`
ver=$(grep "numeric.version =" src/numeric.js | sed 's/.*[''"]\([0-9.]*\)[''"].*/\1/')
npm publish ./lib/numeric-1.1.9.tar.gz
git tag v$ver
git push --tags
chmod a-w lib/numeric-$ver*.js
cd tools/deploy
source config.sh
echo Fetching staging copy...
echo "Fetching staging copy..."
curl $server/staging/ > staging-copy.html
if grep Loisel staging-copy.html > /dev/null; then
echo "Fetched."
else
echo "Staging copy does not work!"
exit 1
fi
echo Deploying...
echo "Deploying..."
ssh $server -l $user "( cd $webroot && [ -L staging ] && foo=\`readlink staging\` && rm -f numeric && ln -s \$foo numeric && rm -f staging && numeric/tools/deploy/clean.sh && echo Deployment successful. ) || echo FAIL: Deployment unsuccessful."
echo Comparing staging copy with live copy...
echo "Comparing staging copy with live copy..."
curl http://$server/ > live-copy.html
if diff staging-copy.html live-copy.html >/dev/null; then
echo Staging and live copies match.
echo "Staging and live copies match."
else
echo FAIL: Staging and live copies do not match.
echo "FAIL: Staging and live copies do not match."
exit 1
fi
rm -f staging-copy.html live-copy.html
echo Testing live links
echo "Testing live links"
cd ..
pwd
python ./selenium_links.py Firefox http://$server/
Expand Down
8 changes: 4 additions & 4 deletions tools/deploy/clean.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/bin/bash
set -e
cd `dirname $0`
cd $(dirname $0)
cd ../../..
numeric=`readlink numeric || echo ""`
staging=`readlink staging || echo ""`
numeric=$(readlink numeric || echo "")
staging=$(readlink staging || echo "")
for x in v*; do
if [ "z$x" != "z$numeric" -a "z$x" != "z$staging" ]; then
if [ "z$x" != "z$numeric" ] && [ "z$x" != "z$staging" ]; then
rm -rf $x
fi
done
18 changes: 9 additions & 9 deletions tools/deploy/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
#!/bin/bash
set -e
cd `dirname $0`
cd $(dirname $0)
cd ../..
foo=`git status --porcelain` &&
foo=$(git status --porcelain) &&
if [ "x" != "x$foo" ]; then
echo "Cannot deploy while there are uncommited changes."
exit
fi
ver=`grep "numeric.version =" src/numeric.js | sed 's/.*[''"]\([0-9.]*\)[''"].*/\1/'`
ver=$(grep "numeric.version =" src/numeric.js | sed 's/.*[''"]\([0-9.]*\)[''"].*/\1/')
npm publish ./lib/numeric-$ver.tar.gz
git tag v$ver
git push --tags
chmod a-w lib/numeric-$ver*.js
cd tools/deploy
source config.sh
echo Fetching staging copy...
echo "Fetching staging copy..."
curl $server/staging/ > staging-copy.html
if grep Loisel staging-copy.html > /dev/null; then
echo "Fetched."
else
echo "Staging copy does not work!"
exit 1
fi
echo Deploying...
echo "Deploying..."
ssh $server -l $user "( cd $webroot && [ -L staging ] && foo=\`readlink staging\` && rm -f numeric && ln -s \$foo numeric && rm -f staging && numeric/tools/deploy/clean.sh && echo Deployment successful. ) || echo FAIL: Deployment unsuccessful."
echo Comparing staging copy with live copy...
echo "Comparing staging copy with live copy..."
curl http://$server/ > live-copy.html
if diff staging-copy.html live-copy.html >/dev/null; then
echo Staging and live copies match.
echo "Staging and live copies match."
else
echo FAIL: Staging and live copies do not match.
echo "FAIL: Staging and live copies do not match."
exit 1
fi
rm -f staging-copy.html live-copy.html
echo Testing live links
echo "Testing live links"
cd ..
pwd
python ./selenium_links.py Firefox http://$server/
Expand Down
8 changes: 4 additions & 4 deletions tools/deploy/stage.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/bin/bash
set -e
version=`date "+%Y-%m-%d_%H-%M-%S"`
cd `dirname $0`
version=$(date "+%Y-%m-%d_%H-%M-%S")
cd $(dirname $0)
rm -f version.txt
echo $version > version.txt
source config.sh
cd ../../
ver=`grep "numeric.version =" src/numeric.js | sed 's/.*[''"]\([0-9.]*\)[''"].*/\1/'`
foo=`git tag -l v$ver`
ver=$(grep "numeric.version =" src/numeric.js | sed 's/.*[''"]\([0-9.]*\)[''"].*/\1/')
foo=$(git tag -l v$ver)
if [ "x$foo" != "x" ]; then
echo "The version $ver already exists."
echo "You must update the version number in numeric.js."
Expand Down
6 changes: 3 additions & 3 deletions tools/deploy/test.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
cd `dirname $0`
cd $(dirname $0) || exit 1
source config.sh
version=`cat version.txt`
version=$(cat version.txt)
rm -f wintests.log mactests.txt
echo "test.sh: launching IE unit tests"
cd ..
Expand All @@ -24,6 +24,6 @@ echo "test.sh: Mac/Firefox unit tests on $server/staging"
python -u selenium_tests.py Firefox http://$server/staging/ >> $logfile 2>&1
kill -9 $tailpid
echo "test.sh: making report"
cd deploy
cd deploy || exit 1
python make_report.py $version > report.html
scp report.html $user@$server:$webroot/staging
6 changes: 3 additions & 3 deletions tools/mkdoc.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/bin/bash
d0=`dirname $0`
d1=`cd $d0/.. && pwd`
d0=$(dirname $0)
d1=$(cd $d0/.. && pwd)
djsdoc=$d1/tools/jsdoc-toolkit
djs=$d1/lib
ddoc=$d1/doc

cd $djsdoc
cd $djsdoc || exit 1
echo "JSDoc:"
rm -rf $ddoc
mkdir $ddoc
Expand Down