mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-19 05:37:51 +00:00
Update to latest SDK in lots of easy device commands
This commit is contained in:
parent
232cf8d426
commit
28fe69fe94
@ -125,7 +125,7 @@ exports.supported =
|
||||
$ resin devices supported
|
||||
'''
|
||||
action: (params, options, done) ->
|
||||
resin = require('resin-sdk-preconfigured')
|
||||
resin = require('resin-sdk').fromSharedOptions()
|
||||
visuals = require('resin-cli-visuals')
|
||||
|
||||
resin.models.config.getDeviceTypes().then (deviceTypes) ->
|
||||
@ -161,7 +161,7 @@ exports.register =
|
||||
]
|
||||
action: (params, options, done) ->
|
||||
Promise = require('bluebird')
|
||||
resin = require('resin-sdk-preconfigured')
|
||||
resin = require('resin-sdk').fromSharedOptions()
|
||||
|
||||
Promise.join(
|
||||
resin.models.application.get(params.application)
|
||||
@ -196,7 +196,7 @@ exports.remove =
|
||||
permission: 'user'
|
||||
action: (params, options, done) ->
|
||||
normalizeUuidProp(params)
|
||||
resin = require('resin-sdk-preconfigured')
|
||||
resin = require('resin-sdk').fromSharedOptions()
|
||||
patterns = require('../utils/patterns')
|
||||
|
||||
patterns.confirm(options.yes, 'Are you sure you want to delete the device?').then ->
|
||||
@ -218,7 +218,7 @@ exports.identify =
|
||||
permission: 'user'
|
||||
action: (params, options, done) ->
|
||||
normalizeUuidProp(params)
|
||||
resin = require('resin-sdk-preconfigured')
|
||||
resin = require('resin-sdk').fromSharedOptions()
|
||||
resin.models.device.identify(params.uuid).nodeify(done)
|
||||
|
||||
exports.reboot =
|
||||
@ -235,7 +235,7 @@ exports.reboot =
|
||||
permission: 'user'
|
||||
action: (params, options, done) ->
|
||||
normalizeUuidProp(params)
|
||||
resin = require('resin-sdk-preconfigured')
|
||||
resin = require('resin-sdk').fromSharedOptions()
|
||||
resin.models.device.reboot(params.uuid, options).nodeify(done)
|
||||
|
||||
exports.shutdown =
|
||||
@ -252,7 +252,7 @@ exports.shutdown =
|
||||
permission: 'user'
|
||||
action: (params, options, done) ->
|
||||
normalizeUuidProp(params)
|
||||
resin = require('resin-sdk-preconfigured')
|
||||
resin = require('resin-sdk').fromSharedOptions()
|
||||
resin.models.device.shutdown(params.uuid, options).nodeify(done)
|
||||
|
||||
exports.enableDeviceUrl =
|
||||
@ -268,7 +268,7 @@ exports.enableDeviceUrl =
|
||||
permission: 'user'
|
||||
action: (params, options, done) ->
|
||||
normalizeUuidProp(params)
|
||||
resin = require('resin-sdk-preconfigured')
|
||||
resin = require('resin-sdk').fromSharedOptions()
|
||||
resin.models.device.enableDeviceUrl(params.uuid).nodeify(done)
|
||||
|
||||
exports.disableDeviceUrl =
|
||||
@ -284,7 +284,7 @@ exports.disableDeviceUrl =
|
||||
permission: 'user'
|
||||
action: (params, options, done) ->
|
||||
normalizeUuidProp(params)
|
||||
resin = require('resin-sdk-preconfigured')
|
||||
resin = require('resin-sdk').fromSharedOptions()
|
||||
resin.models.device.disableDeviceUrl(params.uuid).nodeify(done)
|
||||
|
||||
exports.getDeviceUrl =
|
||||
@ -300,7 +300,7 @@ exports.getDeviceUrl =
|
||||
permission: 'user'
|
||||
action: (params, options, done) ->
|
||||
normalizeUuidProp(params)
|
||||
resin = require('resin-sdk-preconfigured')
|
||||
resin = require('resin-sdk').fromSharedOptions()
|
||||
resin.models.device.getDeviceUrl(params.uuid).then (url) ->
|
||||
console.log(url)
|
||||
.nodeify(done)
|
||||
@ -318,7 +318,7 @@ exports.hasDeviceUrl =
|
||||
permission: 'user'
|
||||
action: (params, options, done) ->
|
||||
normalizeUuidProp(params)
|
||||
resin = require('resin-sdk-preconfigured')
|
||||
resin = require('resin-sdk').fromSharedOptions()
|
||||
resin.models.device.hasDeviceUrl(params.uuid).then (hasDeviceUrl) ->
|
||||
console.log(hasDeviceUrl)
|
||||
.nodeify(done)
|
||||
@ -340,7 +340,7 @@ exports.rename =
|
||||
action: (params, options, done) ->
|
||||
normalizeUuidProp(params)
|
||||
Promise = require('bluebird')
|
||||
resin = require('resin-sdk-preconfigured')
|
||||
resin = require('resin-sdk').fromSharedOptions()
|
||||
form = require('resin-cli-form')
|
||||
|
||||
Promise.try ->
|
||||
@ -370,14 +370,14 @@ exports.move =
|
||||
options: [ commandOptions.optionalApplication ]
|
||||
action: (params, options, done) ->
|
||||
normalizeUuidProp(params)
|
||||
resin = require('resin-sdk-preconfigured')
|
||||
resin = require('resin-sdk').fromSharedOptions()
|
||||
patterns = require('../utils/patterns')
|
||||
|
||||
resin.models.device.get(params.uuid).then (device) ->
|
||||
resin.models.device.get(params.uuid, expandForAppName).then (device) ->
|
||||
return options.application or patterns.selectApplication (application) ->
|
||||
return _.every [
|
||||
application.device_type is device.device_type
|
||||
device.application_name isnt application.app_name
|
||||
device.belongs_to__application[0].app_name isnt application.app_name
|
||||
]
|
||||
.tap (application) ->
|
||||
return resin.models.device.move(params.uuid, application)
|
||||
|
Loading…
Reference in New Issue
Block a user