Startup & Uninstall

This commit is contained in:
Jeffrey Morgan
2015-06-15 22:06:47 -07:00
parent 90fe44a931
commit 325836009f
4 changed files with 46 additions and 34 deletions

View File

@@ -76,11 +76,38 @@ module.exports = function (grunt) {
}
},
rcedit: {
exes: {
files: [{
expand: true,
cwd: 'dist/Kitematic-win32',
src: ['Kitematic.exe']
}],
options: {
icon: 'util/kitematic.ico',
'file-version': packagejson.version,
'product-version': packagejson.version,
'version-string': {
'CompanyName': 'Docker, Inc',
'ProductVersion': packagejson.version,
'ProductName': 'Kitematic',
'FileDescription': 'Kitematic',
'InternalName': 'Kitematic.exe',
'OriginalFilename': 'Kitematic.exe',
'LegalCopyright': 'Copyright 2015 Docker Inc. All rights reserved.'
}
}
}
},
'create-windows-installer': {
appDirectory: 'dist/Kitematic-win32/',
authors: 'Docker Inc.',
loadingGif: 'util/loading.gif',
setupIcon: 'util/kitematic.ico'
setupIcon: 'util/kitematic.ico',
description: 'Kitematic',
title: 'Kitematic',
version: packagejson.version
},
// docker binaries
@@ -269,7 +296,7 @@ module.exports = function (grunt) {
grunt.registerTask('default', ['download-binary', 'newer:babel', 'newer:less', 'newer:copy:dev', 'shell:electron', 'watchChokidar']);
if (process.platform === 'win32') {
grunt.registerTask('release', ['clean', 'download-binary', 'babel', 'less', 'copy:dev', 'electron:windows', 'copy:windows', 'create-windows-installer', 'rename:installer']);
grunt.registerTask('release', ['clean', 'download-binary', 'babel', 'less', 'copy:dev', 'electron:windows', 'copy:windows', 'rcedit:exes', 'create-windows-installer', 'rename:installer']);
} else {
grunt.registerTask('release', ['clean:dist', 'clean:build', 'download-binary', 'babel', 'less', 'copy:dev', 'electron:osx', 'copy:osx', 'shell:sign', 'shell:zip']);
}

View File

@@ -80,6 +80,7 @@
"grunt-electron": "^1.0.0",
"grunt-electron-installer": "^0.33.0",
"grunt-newer": "^1.1.1",
"grunt-rcedit": "^0.3.1",
"grunt-rename": "^0.1.4",
"grunt-shell": "^1.1.2",
"grunt-shell-spawn": "^0.3.8",

View File

@@ -5,6 +5,7 @@ var fs = require('fs');
var os = require('os');
var ipc = require('ipc');
var path = require('path');
var child_process = require('child_process');
process.env.NODE_PATH = path.join(__dirname, 'node_modules');
process.env.RESOURCES_PATH = path.join(__dirname, '/../resources');
@@ -18,45 +19,28 @@ try {
settingsjson = JSON.parse(fs.readFileSync(path.join(__dirname, 'settings.json'), 'utf8'));
} catch (err) {}
var handleStartupEvent = function() {
if (process.platform !== 'win32') {
return false;
}
let updateCmd = (args, cb) => {
let updateExe = path.resolve(path.dirname(process.execPath), '..', 'Update.exe');
let child = child_process.spawn(updateExe, args, {detached: true});
child.on('close', cb);
};
if (process.platform === 'win32') {
var squirrelCommand = process.argv[1];
let target = path.basename(process.execPath);
switch (squirrelCommand) {
case '--squirrel-install':
case '--squirrel-updated':
// Optionally do things such as:
//
// - Install desktop and start menu shortcuts
// - Add your .exe to the PATH
// - Write to the registry for things like file associations and
// explorer context menus
// Always quit when done
app.quit();
return true;
updateCmd(['--createShortcut', target], app.quit);
break;
case '--squirrel-uninstall':
// Undo anything you did in the --squirrel-install and
// --squirrel-updated handlers
// Always quit when done
app.quit();
return true;
updateCmd(['--removeShortcut', target], app.quit);
break;
case '--squirrel-obsolete':
// This is called on the outgoing version of your app before
// we update to the new version - it's the opposite of
// --squirrel-updated
app.quit();
return true;
break;
}
};
handleStartupEvent();
}
var openURL = null;
app.on('open-url', function (event, url) {
@@ -73,7 +57,7 @@ app.on('ready', function () {
'standard-window': false,
resizable: true,
frame: false,
show: false,
show: false
});
mainWindow.loadUrl(path.normalize('file://' + path.join(__dirname, 'index.html')));

View File

@@ -5,7 +5,7 @@ var fs = require('fs');
var util = require('./Util');
var resources = require('./ResourcesUtil');
var NAME = 'dev';
var NAME = util.isWindows () ? 'kitematic' : 'dev';
var DockerMachine = {
command: function () {