Skip to content

Commit

Permalink
Make a first working example
Browse files Browse the repository at this point in the history
  • Loading branch information
megahertz committed Oct 14, 2016
1 parent 198c515 commit 08f2953
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 6 deletions.
2 changes: 1 addition & 1 deletion example/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
"url": "https://raw.githubusercontent.com/megahertz/electron-simple-updater/master/example/updates.json"
},
"dependencies": {
"electron-simple-updater": "*"
"electron-simple-updater": "0.0.4"
}
}
15 changes: 14 additions & 1 deletion example/updates.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
{

"linux-x64-prod": {
"updateUrl": "https://github.com/megahertz/electron-simple-updater/releases/download/v0.0.1/simple-updater-example-0.0.1-x86_64.AppImage",
"installerUrl": "https://github.com/megahertz/electron-simple-updater/releases/download/v0.0.1/simple-updater-example-0.0.1-x86_64.AppImage",
"version": "0.0.1",
"platform": "linux",
"readme": "First release"
},
"win32-x64-prod": {
"updateUrl": "https://github.com/megahertz/electron-simple-updater/releases/download/example-win32-x64-prod-v0.0.1",
"installerUrl": "https://github.com/megahertz/electron-simple-updater/releases/download/example-win32-x64-prod-v0.0.1/Simple.Updater.Example.Setup.0.0.1.exe",
"version": "0.0.1",
"platform": "win32",
"readme": "First release"
}
}
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class SimpleUpdater extends events.EventEmitter {
checkForUpdates() {
const opt = this.options;

if (opts.disabled) {
if (opt.disabled) {
opt.logger.warn(`Update is disabled`);
}

Expand All @@ -65,7 +65,7 @@ class SimpleUpdater extends events.EventEmitter {
if (updateMeta) {
this.onFoundUpdate(updateMeta);
} else {
opt.logger.log(`Updates for ${this.build} are not available`);
opt.logger.log(`Updates for ${this.options.build} are not available`);
this.emit('update-not-available');
}
})
Expand Down
8 changes: 7 additions & 1 deletion lib/get-updates-meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,13 @@ function getJson(url) {
if (err) {
reject(err);
} else {
resolve(JSON.parse(data));
try {
resolve(JSON.parse(data));
} catch(e) {
e.message =
`Error while parsing '${url}'. ${e.message}. Data:\n ${data}`;
reject(e);
}
}
});
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "electron-simple-updater",
"version": "0.0.3",
"version": "0.0.4",
"description": "Simple way to enable update for the electron application",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 08f2953

Please sign in to comment.