1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-04 18:29:17 +02:00

Allow the cleanup plugin to be disabled. Resolves #346 and others. May

need a more generic method to disable individual plugins later.
This commit is contained in:
Simo Kinnunen 2016-06-07 00:42:29 +09:00
parent 5abecb18f2
commit 158b6944be
2 changed files with 14 additions and 1 deletions

View file

@ -76,6 +76,8 @@ program
, 'whether to mute master volume when devices are being used') , 'whether to mute master volume when devices are being used')
.option('--lock-rotation' .option('--lock-rotation'
, 'whether to lock rotation when devices are being used') , 'whether to lock rotation when devices are being used')
.option('-C, --no-cleanup'
, 'do not attempt to clean up devices between uses')
.action(function(serials, options) { .action(function(serials, options) {
if (!options.connectSub) { if (!options.connectSub) {
this.missingArgument('--connect-sub') this.missingArgument('--connect-sub')
@ -116,7 +118,8 @@ program
, '--vnc-initial-size', options.vncInitialSize.join('x') , '--vnc-initial-size', options.vncInitialSize.join('x')
] ]
.concat(options.muteMaster ? ['--mute-master'] : []) .concat(options.muteMaster ? ['--mute-master'] : [])
.concat(options.lockRotation ? ['--lock-rotation'] : [])) .concat(options.lockRotation ? ['--lock-rotation'] : [])
.concat(!options.cleanup ? ['--no-cleanup'] : []))
} }
, endpoints: { , endpoints: {
sub: options.connectSub sub: options.connectSub
@ -187,6 +190,8 @@ program
, 'whether to mute master volume when devices are being used') , 'whether to mute master volume when devices are being used')
.option('--lock-rotation' .option('--lock-rotation'
, 'whether to lock rotation when devices are being used') , 'whether to lock rotation when devices are being used')
.option('-C, --no-cleanup'
, 'do not attempt to clean up devices between uses')
.action(function(serial, options) { .action(function(serial, options) {
if (!options.connectSub) { if (!options.connectSub) {
this.missingArgument('--connect-sub') this.missingArgument('--connect-sub')
@ -231,6 +236,7 @@ program
, heartbeatInterval: options.heartbeatInterval , heartbeatInterval: options.heartbeatInterval
, muteMaster: options.muteMaster , muteMaster: options.muteMaster
, lockRotation: options.lockRotation , lockRotation: options.lockRotation
, cleanup: options.cleanup
}) })
}) })
@ -1169,6 +1175,8 @@ program
, 'whether to mute master volume when devices are being used') , 'whether to mute master volume when devices are being used')
.option('--lock-rotation' .option('--lock-rotation'
, 'whether to lock rotation when devices are being used') , 'whether to lock rotation when devices are being used')
.option('-C, --no-cleanup'
, 'do not attempt to clean up devices between uses')
.action(function(serials, options) { .action(function(serials, options) {
var log = logger.createLogger('cli:local') var log = logger.createLogger('cli:local')
var procutil = require('./util/procutil') var procutil = require('./util/procutil')
@ -1235,6 +1243,7 @@ program
.concat(options.allowRemote ? ['--allow-remote'] : []) .concat(options.allowRemote ? ['--allow-remote'] : [])
.concat(options.muteMaster ? ['--mute-master'] : []) .concat(options.muteMaster ? ['--mute-master'] : [])
.concat(options.lockRotation ? ['--lock-rotation'] : []) .concat(options.lockRotation ? ['--lock-rotation'] : [])
.concat(!options.cleanup ? ['--no-cleanup'] : [])
.concat(serials)) .concat(serials))
// auth // auth

View file

@ -12,6 +12,10 @@ module.exports = syrup.serial()
var log = logger.createLogger('device:plugins:cleanup') var log = logger.createLogger('device:plugins:cleanup')
var plugin = Object.create(null) var plugin = Object.create(null)
if (!options.cleanup) {
return plugin
}
function listPackages() { function listPackages() {
return adb.getPackages(options.serial) return adb.getPackages(options.serial)
} }