Skip to content

Commit

Permalink
Update log messages
Browse files Browse the repository at this point in the history
  • Loading branch information
megahertz committed Oct 14, 2016
1 parent 42a16f6 commit 5a75ef0
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 9 deletions.
16 changes: 14 additions & 2 deletions example/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,18 @@
<link
rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<style>
table { table-layout: fixed }
.pre { white-space: pre; overflow: auto }
col { width: 80px }
</style>
</head>
<body>

<table class="table table-hover">
<colgroup>
<col>
</colgroup>
<thead>
<tr>
<th>Name</th>
Expand All @@ -24,27 +32,31 @@
const { app } = remote;

renderData([
['Command line', JSON.stringify(remote.process.argv, null, ' ')],
['Command line', JSON.stringify(remote.process.argv, null, ' '), 'pre'],
['Executable', app.getPath('exe')],
['App Path', app.getAppPath()],
['App data path', app.getPath('appData')],
['User data path', app.getPath('userData')],
['Resource path', remote.process.resourcesPath],
['App version', app.getVersion()],
['ENV', JSON.stringify(remote.process.env, null, ' '), 'pre'],
]);


function renderData(data) {
const tableBody = document.getElementById('rows');
data
.map(([name, value]) => {
.map(([name, value, className]) => {
const tr = document.createElement('tr');

const td1 = document.createElement('td');
td1.appendChild(document.createTextNode(name));

const td2 = document.createElement('td');
td2.appendChild(document.createTextNode(value));
if (className) {
td2.classList.add(className);
}

tr.appendChild(td1);
tr.appendChild(td2);
Expand Down
3 changes: 1 addition & 2 deletions example/app/main.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
'use strict';

const {app, BrowserWindow} = require('electron');
const updater = require('../../index');
//const updater = require('electron-simple-updater');
const updater = require('electron-simple-updater');


updater.init({
Expand Down
10 changes: 6 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,21 @@ class SimpleUpdater extends events.EventEmitter {
}

downloadUpdate() {
const feedUrl = autoUpdater.getFeedURL();
let feedUrl = autoUpdater.getFeedURL();
/**
* @event update-downloading
* @param {Object} meta Update metadata
*/
this.emit('update-downloading', this.meta);
this.options.logger.info(`Downloading updates from ${feedUrl}`);

if (this.meta.platform === 'linux') {

if (this.meta.platform === 'linux') {
feedUrl = this.meta.updateUrl;
} else {
autoUpdater.checkForUpdates();
}

this.options.logger.info(`Downloading updates from ${feedUrl}`);
}

quitAndInstall() {
Expand Down Expand Up @@ -126,7 +128,7 @@ class SimpleUpdater extends events.EventEmitter {
this.meta = meta;
const opt = this.options;

opt.logger.info(`Found version ${meta.name} at '${meta.updateUrl}'`);
opt.logger.info(`Found version ${meta.version} at ${meta.updateUrl}`);
autoUpdater.setFeedURL(meta.updateUrl);
/**
* @event update-available
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.4",
"version": "0.0.5",
"description": "Simple way to enable update for the electron application",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 5a75ef0

Please sign in to comment.