2017-10-06 16:33:22 +00:00
|
|
|
#!/bin/bash
|
2016-01-04 11:35:25 +00:00
|
|
|
|
2017-07-03 07:38:19 +00:00
|
|
|
|
2016-01-04 11:35:25 +00:00
|
|
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
|
|
realpath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"; }
|
|
|
|
ROOT=$(dirname $(dirname $(realpath "$0")))
|
2018-07-23 14:34:16 +00:00
|
|
|
|
|
|
|
# On Linux with Electron 2.0.x running out of a VM causes
|
|
|
|
# a freeze so we only enable this flag on macOS
|
|
|
|
export ELECTRON_ENABLE_LOGGING=1
|
2016-01-04 11:35:25 +00:00
|
|
|
else
|
|
|
|
ROOT=$(dirname $(dirname $(readlink -f $0)))
|
|
|
|
fi
|
|
|
|
|
2016-05-10 14:42:47 +00:00
|
|
|
cd $ROOT
|
2016-05-10 14:15:48 +00:00
|
|
|
|
2016-08-09 15:13:08 +00:00
|
|
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
2016-08-09 15:56:05 +00:00
|
|
|
NAME=`node -p "require('./product.json').nameLong"`
|
2016-08-09 15:13:08 +00:00
|
|
|
CODE="./.build/electron/$NAME.app/Contents/MacOS/Electron"
|
|
|
|
else
|
|
|
|
NAME=`node -p "require('./product.json').applicationName"`
|
2016-08-09 15:57:09 +00:00
|
|
|
CODE=".build/electron/$NAME"
|
2016-08-09 15:13:08 +00:00
|
|
|
fi
|
|
|
|
|
2016-04-21 00:41:11 +00:00
|
|
|
# Node modules
|
2017-11-16 09:47:02 +00:00
|
|
|
test -d node_modules || yarn
|
2016-04-21 00:41:11 +00:00
|
|
|
|
|
|
|
# Get electron
|
2017-11-16 13:43:41 +00:00
|
|
|
node build/lib/electron.js || ./node_modules/.bin/gulp electron
|
2016-04-21 00:41:11 +00:00
|
|
|
|
2016-01-04 11:35:25 +00:00
|
|
|
# Unit Tests
|
2017-07-03 09:45:11 +00:00
|
|
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
2017-04-10 08:20:56 +00:00
|
|
|
cd $ROOT ; ulimit -n 4096 ; \
|
2016-08-09 15:13:08 +00:00
|
|
|
"$CODE" \
|
2017-04-10 08:20:56 +00:00
|
|
|
test/electron/index.js "$@"
|
2016-01-04 11:35:25 +00:00
|
|
|
else
|
2017-04-10 08:20:56 +00:00
|
|
|
cd $ROOT ; \
|
2016-08-09 15:13:08 +00:00
|
|
|
"$CODE" \
|
2017-04-10 08:20:56 +00:00
|
|
|
test/electron/index.js "$@"
|
2016-01-04 11:35:25 +00:00
|
|
|
fi
|