2016-01-04 12:35:25 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
|
|
realpath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"; }
|
|
|
|
ROOT=$(dirname $(dirname $(realpath "$0")))
|
|
|
|
else
|
|
|
|
ROOT=$(dirname $(dirname $(readlink -f $0)))
|
|
|
|
fi
|
|
|
|
|
2016-05-10 16:42:47 +02:00
|
|
|
cd $ROOT
|
2016-05-10 16:15:48 +02:00
|
|
|
|
2016-08-09 17:13:08 +02:00
|
|
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
2016-08-09 17:56:05 +02:00
|
|
|
NAME=`node -p "require('./product.json').nameLong"`
|
2016-08-09 17:13:08 +02:00
|
|
|
CODE="./.build/electron/$NAME.app/Contents/MacOS/Electron"
|
|
|
|
else
|
|
|
|
NAME=`node -p "require('./product.json').applicationName"`
|
2016-08-09 17:57:09 +02:00
|
|
|
CODE=".build/electron/$NAME"
|
2016-08-09 17:13:08 +02:00
|
|
|
fi
|
|
|
|
|
2016-11-17 10:16:01 +01:00
|
|
|
INTENDED_VERSION="v`node -p "require('./package.json').electronVersion"`"
|
2017-02-15 11:16:38 +01:00
|
|
|
INSTALLED_VERSION=$(cat .build/electron/version 2> /dev/null)
|
2016-11-17 10:16:01 +01:00
|
|
|
|
2016-04-21 02:41:11 +02:00
|
|
|
# Node modules
|
|
|
|
test -d node_modules || ./scripts/npm.sh install
|
|
|
|
|
|
|
|
# Get electron
|
2016-11-17 10:16:01 +01:00
|
|
|
(test -f "$CODE" && [ $INTENDED_VERSION == $INSTALLED_VERSION ]) || ./node_modules/.bin/gulp electron
|
2016-04-21 02:41:11 +02:00
|
|
|
|
2016-01-04 12:35:25 +01:00
|
|
|
# Unit Tests
|
2017-04-13 12:44:37 +02:00
|
|
|
if [[ "$1" == "--xvfb" ]]; then
|
|
|
|
cd $ROOT ; \
|
2017-05-18 13:47:55 +02:00
|
|
|
xvfb-run -a "$CODE" test/electron/index.js "$@"
|
2017-04-13 12:44:37 +02:00
|
|
|
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
2017-04-10 10:20:56 +02:00
|
|
|
cd $ROOT ; ulimit -n 4096 ; \
|
2016-08-09 17:13:08 +02:00
|
|
|
"$CODE" \
|
2017-04-10 10:20:56 +02:00
|
|
|
test/electron/index.js "$@"
|
2016-01-04 12:35:25 +01:00
|
|
|
else
|
2017-04-10 10:20:56 +02:00
|
|
|
cd $ROOT ; \
|
2016-08-09 17:13:08 +02:00
|
|
|
"$CODE" \
|
2017-04-10 10:20:56 +02:00
|
|
|
test/electron/index.js "$@"
|
2016-01-04 12:35:25 +01:00
|
|
|
fi
|