styling fixes; tests passing; added missing ms dependency.

This commit is contained in:
Alberto Miranda
2017-02-06 00:54:16 -03:00
parent c3cdda354e
commit 944eb8b8b0
5 changed files with 14 additions and 19 deletions

View File

@@ -32,6 +32,7 @@
"location-history": "^1.0.0", "location-history": "^1.0.0",
"material-ui": "^0.16.0", "material-ui": "^0.16.0",
"mkdirp": "^0.5.1", "mkdirp": "^0.5.1",
"ms": "^0.7.2",
"musicmetadata": "^2.0.2", "musicmetadata": "^2.0.2",
"network-address": "^1.1.0", "network-address": "^1.1.0",
"node-notifier": "^5.0.2", "node-notifier": "^5.0.2",

View File

@@ -3,7 +3,6 @@ const fs = require('fs')
const path = require('path') const path = require('path')
const electron = require('electron') const electron = require('electron')
const arch = require('arch') const arch = require('arch')
const {resolve} = require('path')
const gaze = require('gaze') const gaze = require('gaze')
const APP_NAME = 'WebTorrent' const APP_NAME = 'WebTorrent'
@@ -113,7 +112,7 @@ function updateConfig () {
config = JSON.parse(fs.readFileSync(configFile)) config = JSON.parse(fs.readFileSync(configFile))
} }
function watch() { function watch () {
gaze(configFile, function (err) { gaze(configFile, function (err) {
if (err) { if (err) {
throw err throw err

View File

@@ -78,7 +78,7 @@ function init () {
// init new plugins then notify user // init new plugins then notify user
plugins.subscribe(() => { plugins.subscribe(() => {
// update menu and windows // update menu and windows
// passing thru new plugin decorators // passing thru new plugin decorators
initApp(state) initApp(state)
}) })
@@ -106,8 +106,8 @@ function init () {
// init and decorate window // init and decorate window
windows.main.init( windows.main.init(
state, state,
{hidden: hidden}, {hidden: hidden},
(options) => plugins.decorateWindow(options) (options) => plugins.decorateWindow(options)
) )
windows.webtorrent.init((options) => plugins.decorateWindow(options)) windows.webtorrent.init((options) => plugins.decorateWindow(options))

View File

@@ -20,7 +20,7 @@ let menu = null
function init (decorate) { function init (decorate) {
let template = getMenuTemplate() let template = getMenuTemplate()
if (decorate) template = decorate(template) if (decorate) template = decorate(template)
menu = electron.Menu.buildFromTemplate(template) menu = electron.Menu.buildFromTemplate(template)
electron.Menu.setApplicationMenu(menu) electron.Menu.setApplicationMenu(menu)
} }

View File

@@ -3,6 +3,7 @@ const {resolve, basename} = require('path')
const {writeFileSync} = require('fs') const {writeFileSync} = require('fs')
const State = require('./renderer/lib/state') const State = require('./renderer/lib/state')
const notifier = require('node-notifier') const notifier = require('node-notifier')
const {app} = require('electron')
const {sync: mkdirpSync} = require('mkdirp') const {sync: mkdirpSync} = require('mkdirp')
const ms = require('ms') const ms = require('ms')
@@ -96,8 +97,8 @@ module.exports = class Plugins {
} }
getId (plugins) { getId (plugins) {
const hash = crypto.createHash('sha256'); const hash = crypto.createHash('sha256')
hash.update(JSON.stringify(plugins)); hash.update(JSON.stringify(plugins))
return hash.digest('hex') return hash.digest('hex')
} }
@@ -125,9 +126,7 @@ module.exports = class Plugins {
return return
} }
this.alert( this.alert(`Error updating plugins: Check '${this.path}/npm-debug.log' for more information.`)
'Error updating plugins: Check `${this.path}/npm-debug.log` for more information.'
)
return return
} }
@@ -269,13 +268,9 @@ module.exports = class Plugins {
// Use the install command that is appropriate for our shell // Use the install command that is appropriate for our shell
exec(installCommands[whichShell], { exec(installCommands[whichShell], {
cwd: this.path//, cwd: this.path
// env,
// shell
}, err => { }, err => {
if (err) { if (err) return fn(err)
return fn(err)
}
fn(null) fn(null)
}) })
}).catch(fn) }).catch(fn)
@@ -397,11 +392,11 @@ module.exports = class Plugins {
* Logs passed arguments to console using a prefix. * Logs passed arguments to console using a prefix.
* *
*/ */
function log() { function log () {
const prefix = '[ PLUGINS ]-->' const prefix = '[ PLUGINS ]-->'
const args = [prefix] const args = [prefix]
for (var i=0; i<arguments.length; ++i) { for (var i = 0; i < arguments.length; ++i) {
args.push(arguments[i]) args.push(arguments[i])
} }