Skip to content

Commit 4030d66

Browse files
author
Emmanouil Konstantinidis
committed
Init auto-update
1 parent ac90533 commit 4030d66

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

main.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ var app = require('app');
22
var path = require('path');
33
var ipc = require('ipc');
44

5+
var ghReleases = require('electron-gh-releases');
6+
57
require('crash-reporter').start();
68

79
var Menu = require('menu');
@@ -12,6 +14,52 @@ var AutoLaunch = require('auto-launch');
1214
var iconIdle = path.join(__dirname, 'images', 'tray-idleTemplate.png');
1315
var iconActive = path.join(__dirname, 'images', 'tray-active.png');
1416

17+
var ghReleasesOptions = {
18+
repo: 'ekonstantinidis/testify',
19+
currentVersion: app.getVersion()
20+
};
21+
22+
var update = new ghReleases(ghReleasesOptions, function (autoUpdater) {
23+
// Auto updater event listener
24+
console.log('.......');
25+
console.log('.......');
26+
console.log(app.getVersion());
27+
console.log('.......');
28+
console.log('.......');
29+
// autoUpdater.checkForUpdates();
30+
31+
autoUpdater
32+
// .on('checking-for-update', function() {
33+
// console.log('Checking for update');
34+
// })
35+
.on('update-downloaded', function (e, rNotes, rName, rDate, uUrl, quitAndUpdate) {
36+
// Install the update
37+
console.log('Update Downloaded...');
38+
quitAndUpdate();
39+
});
40+
});
41+
42+
// Check for updates
43+
update.check(function (err, status) {
44+
console.log('ERR: ' + err + '. STATUS: ' + status);
45+
46+
if (!err && status) {
47+
update.download();
48+
}
49+
});
50+
51+
// autoUpdater
52+
//
53+
// .on('update-available', function() {
54+
// console.log('Update available');
55+
// })
56+
// .on('update-not-available', function() {
57+
// console.log('Update not available');
58+
// })
59+
// .on('update-downloaded', function() {
60+
// console.log('Update downloaded');
61+
// });
62+
1563
var autoStart = new AutoLaunch({
1664
name: 'Gitify',
1765
path: process.execPath.match(/.*?\.app/)[0]

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
"babelify": "=6.1.3",
7979
"bootstrap": "=3.3.5",
8080
"browserify": "=11.0.1",
81+
"electron-gh-releases": "=1.0.1",
8182
"font-awesome": "=4.4.0",
8283
"octicons": "=2.4.1",
8384
"react": "=0.13.3",

0 commit comments

Comments
 (0)