Skip to content

Commit

Permalink
Merge pull request #106 from officert/gh-releases-auto-update
Browse files Browse the repository at this point in the history
add electron gh-releaess,
  • Loading branch information
officert committed Feb 7, 2016
2 parents 4d7800d + ac90706 commit c4b310d
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
3 changes: 3 additions & 0 deletions auto_updater.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"url": "https://github.com/officert/mongotron/releases/download/1.0.0-alpha.1/Mongotron-darwin-x64.zip"
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"bluebird": "3.0.6",
"bson": "https://github.com/officert/js-bson/tarball/master",
"csv": "0.4.6",
"electron-gh-releases": "2.0.2",
"electron-packager": "5.2.1",
"escodegen": "1.8.0",
"esprima": "2.7.1",
Expand Down
27 changes: 27 additions & 0 deletions src/browser/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,39 @@ const BrowserWindow = require('browser-window');
const crashReporter = require('crash-reporter');
const ipcMain = require('electron').ipcMain;
const path = require('path');
const GhReleases = require('electron-gh-releases');

require('src/mongotron').init();

const appConfig = require('src/config/appConfig');
const logger = require('lib/modules/logger');

let autoUpdateOptions = {
repo: 'officert/mongotron',
currentVersion: app.getVersion()
};

const updater = new GhReleases(autoUpdateOptions);

// Check for updates
// `status` returns true if there is a new update available
updater.check((err, status) => {
console.log('updater check', err, status);

if (!err && status) {
// Download the update
updater.download();
}
});

// When an update has been downloaded
updater.on('update-downloaded', (info) => {
console.log('updater downloaded', info);

// Restart the app and install the update
updater.install();
});

/* ------------------------------------------------
* App initialization
* ------------------------------------------------ */
Expand Down

0 comments on commit c4b310d

Please sign in to comment.