diff options
| -rw-r--r-- | electron_js/main.js | 38 | ||||
| -rw-r--r-- | electron_js/package.json | 5 | ||||
| -rwxr-xr-x | make_desktop.sh | 41 |
3 files changed, 84 insertions, 0 deletions
diff --git a/electron_js/main.js b/electron_js/main.js new file mode 100644 index 00000000..e905b73c --- /dev/null +++ b/electron_js/main.js @@ -0,0 +1,38 @@ +var app = require('app'); // Module to control application life. +app.commandLine.appendSwitch ('ignore-certificate-errors', 'true'); +var BrowserWindow = require('browser-window'); // Module to create native browser window. + +// Report crashes to our server. +require('crash-reporter').start(); + +// Keep a global reference of the window object, if you don't, the window will +// be closed automatically when the JavaScript object is GCed. +var mainWindow = null; + +// Quit when all windows are closed. +app.on('window-all-closed', function() { + // On OS X it is common for applications and their menu bar + // to stay active until the user quits explicitly with Cmd + Q + if (process.platform != 'darwin') { + app.quit(); + } +}); + +// This method will be called when Electron has finished +// initialization and is ready to create browser windows. +app.on('ready', function() { + // Create the browser window. + mainWindow = new BrowserWindow({width:1024, height:900}); + + // and load the index.html of the app. + mainWindow.loadUrl('file://' + __dirname + '/index.html'); + + // Emitted when the window is closed. + mainWindow.on('closed', function() { + // Dereference the window object, usually you would store windows + // in an array if your app supports multi windows, this is the time + // when you should delete the corresponding element. + + mainWindow = null; + }); +}); diff --git a/electron_js/package.json b/electron_js/package.json new file mode 100644 index 00000000..bcab2f07 --- /dev/null +++ b/electron_js/package.json @@ -0,0 +1,5 @@ +{ + "name" : "zmNinjaDesktop", + "version" : "0.1.0", + "main" : "main.js" +} diff --git a/make_desktop.sh b/make_desktop.sh new file mode 100755 index 00000000..065be9af --- /dev/null +++ b/make_desktop.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +exe() { echo "\$ $@" ; "$@" ; } + +# Custom stuff I need to do for zmNinja +echo ---------------------------------------------------- +echo Pliable Pixels Desktop build process +echo ---------------------------------------------------- +APPVER=`cat config.xml | grep "widget id=" | sed 's/.* version=\"\([^\"]*\)\" xmlns.*/\1/'` +echo "Application version:$APPVER" + +declare -a app_ports=("../zmNinja-mac.app/Contents/Resources" "../zmNinja-linux/resources" "../zmNinja-win/resources") + +for i in "${app_ports[@]}" +do +if [ -d "$i" ]; then + echo "------------------------------------------------------------------------" + echo "Working on packaging $i" + echo "------------------------------------------------------------------------" + exe rm -fr $i/app + exe mkdir $i/app + exe cp -R www/ $i/app + exe cp electron_js/* $i/app + exe cd $i + cat app/js/DataModel.js | sed "s/var zmAppVersion=\"unknown\"/var zmAppVersion=\"$APPVER\"/" > app/js/DataModel.js.tmp + exe rm -fr app/js/DataModel.js + exe mv app/js/DataModel.js.tmp app/js/DataModel.js + + + rm -fr app.asar +# exe asar pack app app.asar +# exe rm -fr app + exe cd - + echo "Done!" + +else + echo "$i does not exist, skipping" +fi +done + + |
