Comparing version 0.0.3 to 0.0.4
{ | ||
"name": "xadb", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"main": "./index", | ||
"dependencies": { | ||
"bluebird": "~2.9.24", | ||
"commander": "^2.3.0", | ||
"debug": "~2.6.3", | ||
"node-forge": "^0.6.12", | ||
"split": "~0.3.3" | ||
"node-forge": "^0.6.12" | ||
} | ||
} |
@@ -1,8 +0,1 @@ | ||
/* eslint-disable | ||
no-cond-assign, | ||
no-unused-vars, | ||
*/ | ||
// TODO: This file was created by bulk-decaffeinate. | ||
// Fix any style issues and re-enable lint. | ||
const Monkey = require('adbkit-monkey') | ||
const Promise = require('bluebird') | ||
@@ -34,5 +27,3 @@ const debug = require('debug')('adb:client') | ||
const LocalCommand = require('./command/host-transport/local') | ||
const LogcatCommand = require('./command/host-transport/logcat') | ||
const LogCommand = require('./command/host-transport/log') | ||
const MonkeyCommand = require('./command/host-transport/monkey') | ||
const RebootCommand = require('./command/host-transport/reboot') | ||
@@ -63,13 +54,18 @@ const RemountCommand = require('./command/host-transport/remount') | ||
var Client = (function() { | ||
var Client = (function () { | ||
let NoUserOptionError = undefined | ||
Client = class Client { | ||
static initClass() { | ||
NoUserOptionError = err => err.message.indexOf('--user') !== -1 | ||
} | ||
constructor(options = {}) { | ||
this.options = options | ||
if (!this.options.port) { this.options.port = 5037 } | ||
if (!this.options.bin) { this.options.bin = 'adb' } | ||
if (!this.options.port) { | ||
this.options.port = 5037 | ||
} | ||
if (!this.options.bin) { | ||
this.options.bin = 'adb' | ||
} | ||
} | ||
@@ -86,3 +82,3 @@ | ||
.on('error', (errorListener = err => resolver.reject(err))).on('connect', (connectListener = () => resolver.resolve(conn))).connect() | ||
return resolver.promise.finally(function() { | ||
return resolver.promise.finally(function () { | ||
conn.removeListener('error', errorListener) | ||
@@ -204,5 +200,7 @@ return conn.removeListener('connect', connectListener) | ||
return this.getProperties(serial) | ||
.then(function(properties) { | ||
.then(function (properties) { | ||
let ip | ||
if (ip = properties[`dhcp.${iface}.ipaddress`]) { return ip } | ||
if (ip = properties[`dhcp.${iface}.ipaddress`]) { | ||
return ip | ||
} | ||
throw new Error(`Unable to find ipaddress for '${iface}'`) | ||
@@ -270,3 +268,3 @@ }) | ||
} | ||
root(serial, callback) { | ||
@@ -335,3 +333,2 @@ return this.transport(serial) | ||
openProcStat(serial, callback) { | ||
@@ -360,7 +357,7 @@ return this.syncService(serial) | ||
transfer.on('end', (endListener = () => { | ||
return resolver.resolve(this.installRemote(serial, temp)) | ||
}) | ||
return resolver.resolve(this.installRemote(serial, temp)) | ||
}) | ||
) | ||
return resolver.promise.finally(function() { | ||
return resolver.promise.finally(function () { | ||
transfer.removeListener('error', errorListener) | ||
@@ -412,6 +409,9 @@ return transfer.removeListener('end', endListener) | ||
return this.transport(serial) | ||
.then(function(transport) { | ||
if (!options.user && (options.user !== null)) { options.user = 0 } | ||
.then(function (transport) { | ||
if (!options.user && (options.user !== null)) { | ||
options.user = 0 | ||
} | ||
return new StartServiceCommand(transport) | ||
.execute(options)}).catch(NoUserOptionError, () => { | ||
.execute(options) | ||
}).catch(NoUserOptionError, () => { | ||
options.user = null | ||
@@ -418,0 +418,0 @@ return this.startService(serial, options) |
@@ -1,13 +0,7 @@ | ||
/* eslint-disable | ||
no-unused-vars, | ||
no-useless-escape, | ||
*/ | ||
// TODO: This file was created by bulk-decaffeinate. | ||
// Fix any style issues and re-enable lint. | ||
const {EventEmitter} = require('events') | ||
const split = require('split') | ||
const Parser = require('../parser') | ||
var ProcStat = (function() { | ||
var ProcStat = (function () { | ||
let RE_CPULINE = undefined | ||
@@ -28,4 +22,4 @@ let RE_COLSEP = undefined | ||
this._timer = setInterval(() => { | ||
return this.update() | ||
} | ||
return this.update() | ||
} | ||
, this.interval) | ||
@@ -58,16 +52,20 @@ this.update() | ||
const type = cols.shift() | ||
if (this._ignore[type] === line) { continue } | ||
if (this._ignore[type] === line) { | ||
continue | ||
} | ||
let total = 0 | ||
for (let val of cols) { total += +val } | ||
for (let val of cols) { | ||
total += +val | ||
} | ||
stats.cpus[type] = { | ||
line, | ||
user: +cols[0] || 0, | ||
nice: +cols[1] || 0, | ||
system: +cols[2] || 0, | ||
idle: +cols[3] || 0, | ||
iowait: +cols[4] || 0, | ||
irq: +cols[5] || 0, | ||
softirq: +cols[6] || 0, | ||
steal: +cols[7] || 0, | ||
guest: +cols[8] || 0, | ||
user: +cols[0] || 0, | ||
nice: +cols[1] || 0, | ||
system: +cols[2] || 0, | ||
idle: +cols[3] || 0, | ||
iowait: +cols[4] || 0, | ||
irq: +cols[5] || 0, | ||
softirq: +cols[6] || 0, | ||
steal: +cols[7] || 0, | ||
guest: +cols[8] || 0, | ||
guestnice: +cols[9] || 0, | ||
@@ -86,3 +84,5 @@ total | ||
const old = this.stats.cpus[id] | ||
if (!old) { continue } | ||
if (!old) { | ||
continue | ||
} | ||
const ticks = cur.total - old.total | ||
@@ -95,13 +95,13 @@ if (ticks > 0) { | ||
loads[id] = { | ||
user: Math.floor(m * (cur.user - old.user)), | ||
nice: Math.floor(m * (cur.nice - old.nice)), | ||
system: Math.floor(m * (cur.system - old.system)), | ||
idle: Math.floor(m * (cur.idle - old.idle)), | ||
iowait: Math.floor(m * (cur.iowait - old.iowait)), | ||
irq: Math.floor(m * (cur.irq - old.irq)), | ||
softirq: Math.floor(m * (cur.softirq - old.softirq)), | ||
steal: Math.floor(m * (cur.steal - old.steal)), | ||
guest: Math.floor(m * (cur.guest - old.guest)), | ||
user: Math.floor(m * (cur.user - old.user)), | ||
nice: Math.floor(m * (cur.nice - old.nice)), | ||
system: Math.floor(m * (cur.system - old.system)), | ||
idle: Math.floor(m * (cur.idle - old.idle)), | ||
iowait: Math.floor(m * (cur.iowait - old.iowait)), | ||
irq: Math.floor(m * (cur.irq - old.irq)), | ||
softirq: Math.floor(m * (cur.softirq - old.softirq)), | ||
steal: Math.floor(m * (cur.steal - old.steal)), | ||
guest: Math.floor(m * (cur.guest - old.guest)), | ||
guestnice: Math.floor(m * (cur.guestnice - old.guestnice)), | ||
total: 100 | ||
total: 100 | ||
} | ||
@@ -119,3 +119,5 @@ } else { | ||
} | ||
if (found) { this.emit('load', loads) } | ||
if (found) { | ||
this.emit('load', loads) | ||
} | ||
return this.stats = stats | ||
@@ -122,0 +124,0 @@ } |
Sorry, the diff of this file is not supported yet
3
144274
74
3970
- Removedcommander@^2.3.0
- Removedsplit@~0.3.3
- Removedcommander@2.20.3(transitive)
- Removedsplit@0.3.3(transitive)
- Removedthrough@2.3.8(transitive)