Permalink
Browse files

Merge pull request #356 from felixrieseberg/updater

Auto Updater for OS X
  • Loading branch information...
2 parents ec0604e + 0ae3796 commit 5fa6c86390ccdc8c94ae65eaca1eb591e6aa6ff2 @felixrieseberg felixrieseberg committed Sep 29, 2015
Showing with 94 additions and 15 deletions.
  1. 0 auto_updater.json
  2. +47 −13 electron.js
  3. +3 −2 package.json
  4. +44 −0 postcompile/osx/codesign.sh
View
No changes.
View
@@ -32,23 +32,54 @@ var handleSquirrelEvent = function () {
var squirrelEvent = process.argv[1];
switch (squirrelEvent) {
- case '--squirrel-install':
- install(app.quit);
- return true;
- case '--squirrel-updated':
- install(app.quit);
- return true;
- case '--squirrel-obsolete':
- app.quit();
- return true;
- case '--squirrel-uninstall':
- uninstall(app.quit);
- return true;
+ case '--squirrel-install':
+ install(app.quit);
+ return true;
+ case '--squirrel-updated':
+ install(app.quit);
+ return true;
+ case '--squirrel-obsolete':
+ app.quit();
+ return true;
+ case '--squirrel-uninstall':
+ uninstall(app.quit);
+ return true;
}
return false;
};
+var checkForGitHubRelease = function () {
+ var gh_releases = require('electron-gh-releases');
+
+ var options = {
+ repo: 'azure-storage/deco',
+ currentVersion: app.getVersion()
+ }
+
+ var update = new gh_releases(options, function (auto_updater) {
+ auto_updater.on('update-downloaded', function (e, rNotes, rName, rDate, uUrl, quitAndUpdate) {
+ var dialog = require('dialog');
+ dialog.showMessageBox({
+ type: 'info',
+ buttons: ['Hooray!'],
+ title: 'Update Downloaded',
+ message: 'We found and downdloaded a new version of the Azure Storage Explorer! Once you close this dialog, Azure Storage Explorer will automatically update and restart.'
+ });
+
+ // Install the update
+ quitAndUpdate();
+ });
+ });
+
+ // Check for updates
+ update.check(function (err, status) {
+ if (!err && status) {
+ update.download();
+ }
+ });
+};
+
app.on('window-all-closed', function onWindowAllClosed() {
if (process.platform !== 'darwin') {
app.quit();
@@ -60,6 +91,9 @@ app.on('ready', function onReady() {
return;
}
+ // Check for update
+ checkForGitHubRelease();
+
mainWindow = new BrowserWindow({
title: 'Azure Storage Explorer',
width: 1100,
@@ -86,4 +120,4 @@ app.on('ready', function onReady() {
mainWindow.on('closed', function onClosed() {
mainWindow = null;
});
-});
+});
View
@@ -1,6 +1,6 @@
{
"name": "azureexplorer",
- "version": "0.4.2",
+ "version": "0.5.0",
"description": "A cross-platform tool to explore Azure Storage Accounts",
"scripts": {
"start": "ember electron",
@@ -80,6 +80,7 @@
"main": "electron.js",
"dependencies": {
"azure-storage": "^0.4.3",
- "fs-extra": "^0.22.1"
+ "fs-extra": "^0.22.1",
+ "electron-gh-releases": "^1.0.1"
}
}
@@ -0,0 +1,44 @@
+# Invoke this script with a relative `.app` path
+# EX:
+# codesign.sh "dist/osx/MyApp-darwin-x64/MyApp.app"
+
+# I had better luck using the iPhoneOS codesign_allocate
+# export CODESIGN_ALLOCATE="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate"
+
+# Next two are specified in Apple docs:
+# export CODESIGN_ALLOCATE="/Applications/Xcode.app/Contents/Developer/usr/bin/codesign_allocate"
+export CODESIGN_ALLOCATE="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate"
+
+# However, neither worked, and gave error:
+# /Users/JoshBavari/Development/ionic-gui/dist/osx/MyApp-darwin-x64/MyApp.app/Contents/Frameworks/Electron Framework.framework/Electron Framework: cannot find code object on disk
+
+#Run the following to get a list of certs
+# security find-identity
+app="$PWD/$1"
+identity="Felix Rieseberg"
+
+echo "### signing frameworks"
+codesign --deep --force --verify --verbose --sign "$identity" "$app/Contents/Frameworks/Electron Framework.framework/Electron Framework"
+codesign --deep --force --verify --verbose --sign "$identity" "$app/Contents/Frameworks/Electron Framework.framework/Versions/A"
+codesign --deep --force --verify --verbose --sign "$identity" "$app/Contents/Frameworks/Electron Framework.framework/Versions/Current/Electron Framework"
+codesign --deep --force --verify --verbose --sign "$identity" "$app/Contents/Frameworks/Electron Helper EH.app/Contents/MacOS/Electron Helper EH"
+codesign --deep --force --verify --verbose --sign "$identity" "$app/Contents/Frameworks/Electron Helper NP.app/Contents/MacOS/Electron Helper NP"
+codesign --deep --force --verify --verbose --sign "$identity" "$app/Contents/Frameworks/Electron Helper NP.app/Contents/MacOS/Electron Helper NP"
+codesign --deep --force --verify --verbose --sign "$identity" "$app/Contents/Frameworks/MyApp Helper.app/Contents/MacOS/MyApp Helper"
+codesign --deep --force --verify --verbose --sign "$identity" "$app/Contents/Frameworks/Mantle.framework/Mantle"
+codesign --deep --force --verify --verbose --sign "$identity" "$app/Contents/Frameworks/Mantle.framework/Versions/A"
+codesign --deep --force --verify --verbose --sign "$identity" "$app/Contents/Frameworks/ReactiveCocoa.framework/ReactiveCocoa"
+codesign --deep --force --verify --verbose --sign "$identity" "$app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A"
+codesign --deep --force --verify --verbose --sign "$identity" "$app/Contents/Frameworks/Squirrel.framework/Squirrel"
+codesign --deep --force --verify --verbose --sign "$identity" "$app/Contents/Frameworks/Squirrel.framework/Versions/A"
+
+echo "### signing app"
+codesign --deep --force --verify --verbose --sign "$identity" "$app"
+
+
+echo "### Zipping app"
+ditto -c -k --sequesterRsrc --keepParent ./builds/storageexplorer-darwin-x64/storageexplorer.app/ ./builds/storageexplorer-osx.zip
+
+echo "### verifying signature",
+codesign -vvvv -d "$app"
+sudo spctl -a -vvvv "$app"

0 comments on commit 5fa6c86

Please sign in to comment.