diff --git a/scripts/code.sh b/scripts/code.sh index 49b500947a1b3abc07c3acc566a9f71cc8dd2a07..33b084826ad293f6b151eb238e421dc499b06c4c 100755 --- a/scripts/code.sh +++ b/scripts/code.sh @@ -10,15 +10,19 @@ fi function code() { cd $ROOT + if [[ "$OSTYPE" == "darwin"* ]]; then + NAME=`node -p "require('./product.json').nameShort"` + CODE="./.build/electron/$NAME.app/Contents/MacOS/Electron" + else + NAME=`node -p "require('./product.json').applicationName"` + CODE=".build/electron/code-oss" + fi + # Node modules test -d node_modules || ./scripts/npm.sh install # Get electron - if [[ "$OSTYPE" == "darwin"* ]]; then - test -d .build/electron/Code\ -\ OSS.app || ./node_modules/.bin/gulp electron - else - test -d .build/electron/code-oss || ./node_modules/.bin/gulp electron - fi + test -f "$CODE" || ./node_modules/.bin/gulp electron # Build test -d out || ./node_modules/.bin/gulp compile @@ -31,11 +35,7 @@ function code() { export ELECTRON_ENABLE_STACK_DUMPING=1 # Launch Code - if [[ "$OSTYPE" == "darwin"* ]]; then - exec ./.build/electron/Code\ -\ OSS.app/Contents/MacOS/Electron . "$@" - else - exec ./.build/electron/code-oss . "$@" - fi + exec "$CODE" . "$@" } code "$@" diff --git a/scripts/test.bat b/scripts/test.bat index 976fad08e2fe41c958c4639e688fbe81d8c6b6b6..7b580cbeac1d91de8149c66c1514e00daadda1ea 100644 --- a/scripts/test.bat +++ b/scripts/test.bat @@ -9,7 +9,13 @@ if not "%BUILD_BUILDID%" == "" ( ) pushd %~dp0\.. -.\.build\electron\code-oss-dev.exe .\node_modules\mocha\bin\_mocha %* + +for /f "tokens=2 delims=:," %%a in ('findstr /R /C:"\"nameShort\":.*" product.json') do set NAMESHORT=%%~a +set NAMESHORT=%NAMESHORT: "=% +set NAMESHORT=%NAMESHORT:"=%.exe +set CODE=".build\electron\%NAMESHORT%" + +%CODE% .\node_modules\mocha\bin\_mocha %* popd endlocal diff --git a/scripts/test.sh b/scripts/test.sh index beea6a1352b9a42bcabd6eaea0d036c454fe9e00..1d98a613577820ccb07acb148bd5ace35087a5e0 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -10,15 +10,19 @@ fi cd $ROOT +if [[ "$OSTYPE" == "darwin"* ]]; then + NAME=`node -p "require('./product.json').nameShort"` + CODE="./.build/electron/$NAME.app/Contents/MacOS/Electron" +else + NAME=`node -p "require('./product.json').applicationName"` + CODE=".build/electron/code-oss" +fi + # Node modules test -d node_modules || ./scripts/npm.sh install # Get electron -if [[ "$OSTYPE" == "darwin"* ]]; then - test -d .build/electron/Code\ -\ OSS.app || ./node_modules/.bin/gulp electron -else - test -d .build/electron/code-oss || ./node_modules/.bin/gulp electron -fi +test -f "$CODE" || ./node_modules/.bin/gulp electron # Build test -d out || ./node_modules/.bin/gulp compile @@ -26,10 +30,10 @@ test -d out || ./node_modules/.bin/gulp compile # Unit Tests if [[ "$OSTYPE" == "darwin"* ]]; then cd $ROOT ; ulimit -n 4096 ; ATOM_SHELL_INTERNAL_RUN_AS_NODE=1 \ - ./.build/electron/Code\ -\ OSS.app/Contents/MacOS/Electron \ + "$CODE" \ node_modules/mocha/bin/_mocha $* else cd $ROOT ; ATOM_SHELL_INTERNAL_RUN_AS_NODE=1 \ - ./.build/electron/code-oss \ + "$CODE" \ node_modules/mocha/bin/_mocha $* fi