mirror of
https://github.com/openstf/stf
synced 2025-10-06 03:50:04 +02:00
Allow adb connect
URL to be customized.
This commit is contained in:
parent
7eb6f8f871
commit
caf8d35eb7
4 changed files with 47 additions and 2 deletions
33
lib/units/device/plugins/util/urlformat.js
Normal file
33
lib/units/device/plugins/util/urlformat.js
Normal file
|
@ -0,0 +1,33 @@
|
|||
var syrup = require('stf-syrup')
|
||||
var _ = require('lodash')
|
||||
var tr = require('transliteration')
|
||||
|
||||
module.exports = syrup.serial()
|
||||
.dependency(require('../identity'))
|
||||
.dependency(require('../data'))
|
||||
.define(function(options, identity, data) {
|
||||
function createSlug() {
|
||||
var model = identity.model
|
||||
, name = data ? data.name.id : ''
|
||||
|
||||
return (name === '' || model.toLowerCase() === name.toLowerCase())
|
||||
? tr.slugify(model)
|
||||
: tr.slugify(name + ' ' + model)
|
||||
}
|
||||
|
||||
var defaults = {
|
||||
publicIp: options.publicIp
|
||||
, serial: options.serial
|
||||
, model: identity.model
|
||||
, name: data ? data.name.id : ''
|
||||
, slug: createSlug()
|
||||
}
|
||||
|
||||
return function(template, port) {
|
||||
return _.template(template, {
|
||||
imports: {
|
||||
slugify: tr.slugify
|
||||
}
|
||||
})(_.defaults({publicPort: port}, defaults))
|
||||
}
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue