2016-01-04 12:35:25 +01:00
|
|
|
#!/bin/bash
|
2016-01-12 16:59:22 +01:00
|
|
|
set -e
|
2016-01-04 12:35:25 +01:00
|
|
|
|
|
|
|
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-04-21 02:41:11 +02:00
|
|
|
# Node modules
|
|
|
|
test -d node_modules || ./scripts/npm.sh install
|
|
|
|
|
|
|
|
# Get electron
|
2016-08-09 17:13:08 +02:00
|
|
|
test -f "$CODE" || ./node_modules/.bin/gulp electron
|
2016-04-21 02:41:11 +02:00
|
|
|
|
|
|
|
# Build
|
|
|
|
test -d out || ./node_modules/.bin/gulp compile
|
|
|
|
|
2016-01-04 12:35:25 +01:00
|
|
|
# Unit Tests
|
2016-08-19 17:19:32 +02:00
|
|
|
export VSCODE_DEV=1
|
2016-01-04 12:35:25 +01:00
|
|
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
2016-09-14 07:29:20 +02:00
|
|
|
cd $ROOT ; ulimit -n 4096 ; ELECTRON_RUN_AS_NODE=1 \
|
2016-08-09 17:13:08 +02:00
|
|
|
"$CODE" \
|
2016-08-26 11:52:21 +02:00
|
|
|
node_modules/mocha/bin/_mocha "$@"
|
2016-01-04 12:35:25 +01:00
|
|
|
else
|
2016-09-14 07:29:20 +02:00
|
|
|
cd $ROOT ; ELECTRON_RUN_AS_NODE=1 \
|
2016-08-09 17:13:08 +02:00
|
|
|
"$CODE" \
|
2016-08-26 11:52:21 +02:00
|
|
|
node_modules/mocha/bin/_mocha "$@"
|
2016-01-04 12:35:25 +01:00
|
|
|
fi
|