Large diffs are not rendered by default.

File renamed without changes.
@@ -0,0 +1,82 @@
/**
* @module driveshare-gui/logs
*/

'use strict';

var $ = require('jquery');
var ipc = require('electron-safe-ipc/guest');

/**
* Creates a logger and bind to view
* @constructor
*/
function Logger() {
this._output = '';
this._maxLength = 1048576 / 16; // approximately 1 MB of string memory
this._view = $('#modalLogs');
this._log = $('#modalLogsCode');
this._showTrigger = $('#view-output');

this._showTrigger.click(this.show.bind(this));
ipc.on('showLogs', this.show.bind(this));
}

/**
* Sets the logger output and trims if over maximum length
* #_realize
*/
Logger.prototype._realize = function() {
var index = this._output.indexOf('\n') + 1;

if (this.output.length > this.maxLength) {
this._output = this._output.substr(index, this._output.length);
}

this.log.text(this._output);
};

/**
* Opens the logger window
* #show
* @param {Object} event - optional dom event to prevent
*/
Logger.prototype.show = function(event) {
if (event) {
event.preventDefault();
}

this.view.modal('show');
};

/**
* Adds given message to the log output
* #append
* @param {String} record
*/
Logger.prototype.append = function(record) {
this._output += record + '\n';
this._realize();
};

/**
* Inserts given message to the front of log output
* #prepend
* @param {String} record
*/
Logger.prototype.prepend = function(record) {
this._output = record + '\n' + this._output;
this._realize();
};

/**
* Empties the logger output
* #clear
*/
Logger.prototype.clear = function() {
this._output = '';
this._realize();
};

module.exports = new Logger();
module.exports.Logger = Logger;
File renamed without changes.

This file was deleted.

File renamed without changes.
@@ -0,0 +1,48 @@
/**
* @module drivshare-gui/updater
*/

'use strict';

var request = require('request');
var ipc = require('electron-safe-ipc/guest');
var about = require('../package');

/**
* Handles update checking
* @constructor
*/
function Updater() {
this._versionCheckURL = about.config.versionCheckURL;

ipc.on('checkForUpdates', this.check.bind(this));
this.check(true);
}

/**
* Fetches remote package metadata and determines if update is available
* #check
*/
Updater.prototype.check = function() {
var self = this;
var meta = null;

request(this._versionCheckURL, function(err, res, body) {
if (err || res.statusCode !== 200) {
return self.emit('error', err || new Error('Failed to check updates'));
}

try {
meta = JSON.parse(body);
} catch(err) {
return self.emit('error', new Error('Failed to parse update info'));
}

if (about.version < meta.version) {
self.emit('update_available');
}
});
};

module.exports = new Updater();
module.exports.Updater = Updater;
File renamed without changes.

This file was deleted.

This file was deleted.

@@ -12,11 +12,15 @@
},
"dependencies": {
"adm-zip": "^0.4.7",
"async": "^1.5.0",
"bootstrap": "^3.3.6",
"diskspace": "keverw/diskspace.js",
"electron-safe-ipc": "^0.6.1",
"file-encryptor": "^0.1.0",
"fs-extra": "^0.24.0",
"fs-jetpack": "^0.7.0",
"jquery": "^2.1.4",
"ladda": "^0.9.8",
"request": "^2.63.0",
"sudo-prompt": "^1.1.7"
}

This file was deleted.

This file was deleted.

@@ -13,21 +13,13 @@ var srcDir = projectDir.cwd('./app');
var destDir = projectDir.cwd('./build');

var paths = {
jsCodeToTranspile: [
'app/**/*.js',
'!app/main.js',
'!app/spec.js',
'!app/node_modules/**',
'!app/lib/**'
],
copyFromAppDir: [
'./modules/**',
'./main.js',
'./spec.js',
'./node_modules/**',
'./lib/**',
'./**/*.html'
],
copyFromAppDir: [
'./main.js',
'./spec.js',
'./node_modules/**',
'./lib/**',
'./**/*.html'
],
}

// -------------------------------------
@@ -59,34 +51,34 @@ gulp.task('less-watch', lessTask);


gulp.task('finalize', ['clean'], function () {
var manifest = srcDir.read('package.json', 'json');
switch (utils.getEnvName()) {
case 'development':
// Add "dev" suffix to name, so Electron will write all
// data like cookies and localStorage into separate place.
manifest.name += '-dev';
manifest.productName += '_dev';
break;
case 'test':
// Add "test" suffix to name, so Electron will write all
// data like cookies and localStorage into separate place.
manifest.name += '-test';
manifest.productName += '_test';
// Change the main entry to spec runner.
manifest.main = 'spec.js';
break;
}
destDir.write('package.json', manifest);

var configFilePath = projectDir.path('config/env_' + utils.getEnvName() + '.json');
destDir.copy(configFilePath, 'env_config.json');
var manifest = srcDir.read('package.json', 'json');
switch (utils.getEnvName()) {
case 'development':
// Add "dev" suffix to name, so Electron will write all
// data like cookies and localStorage into separate place.
manifest.name += '-dev';
manifest.productName += '_dev';
break;
case 'test':
// Add "test" suffix to name, so Electron will write all
// data like cookies and localStorage into separate place.
manifest.name += '-test';
manifest.productName += '_test';
// Change the main entry to spec runner.
manifest.main = 'spec.js';
break;
}
destDir.write('package.json', manifest);

var configFilePath = projectDir.path('config/env_' + utils.getEnvName() + '.json');
destDir.copy(configFilePath, 'env_config.json');
});


gulp.task('watch', function () {
gulp.watch(paths.jsCodeToTranspile, ['transpile-watch']);
gulp.watch(paths.copyFromAppDir, { cwd: 'app' }, ['copy-watch']);
gulp.watch('app/**/*.less', ['less-watch']);
gulp.watch(paths.jsCodeToTranspile, ['transpile-watch']);
gulp.watch(paths.copyFromAppDir, { cwd: 'app' }, ['copy-watch']);
gulp.watch('app/**/*.less', ['less-watch']);
});


@@ -4,11 +4,11 @@ var gulp = require('gulp');
var utils = require('./utils');

var releaseForOs = {
osx: require('./release_osx'),
linux: require('./release_linux'),
windows: require('./release_windows'),
osx: require('./release_osx'),
linux: require('./release_linux'),
windows: require('./release_windows'),
};

gulp.task('release', ['build'], function () {
return releaseForOs[utils.os()]();
return releaseForOs[utils.os()]();
});