From e5e871ddcd9f20e1be05d88b2009b5390bfdfbcd Mon Sep 17 00:00:00 2001 From: Juan Cruz Viotti Date: Mon, 12 Oct 2015 08:34:22 -0400 Subject: [PATCH] Upgrade SDK to v3.0.0 Breaking changes in this version: - `resin.models.device.generateUUID()` is now async. --- build/actions/device.js | 8 ++++---- lib/actions/device.coffee | 7 ++++--- package.json | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/build/actions/device.js b/build/actions/device.js index d9cd1be4..ff5b1264 100644 --- a/build/actions/device.js +++ b/build/actions/device.js @@ -72,10 +72,10 @@ permission: 'user', action: function(params, options, done) { return resin.models.application.get(params.application).then(function(application) { - var uuid; - uuid = resin.models.device.generateUUID(); - console.info("Registering to " + application.app_name + ": " + uuid); - return resin.models.device.register(application.app_name, uuid); + return resin.models.device.generateUUID().then(function(uuid) { + console.info("Registering to " + application.app_name + ": " + uuid); + return resin.models.device.register(application.app_name, uuid); + }); }).get('uuid').nodeify(done); } }; diff --git a/lib/actions/device.coffee b/lib/actions/device.coffee index d3edd5ba..05580947 100644 --- a/lib/actions/device.coffee +++ b/lib/actions/device.coffee @@ -100,9 +100,10 @@ exports.register = permission: 'user' action: (params, options, done) -> resin.models.application.get(params.application).then (application) -> - uuid = resin.models.device.generateUUID() - console.info("Registering to #{application.app_name}: #{uuid}") - return resin.models.device.register(application.app_name, uuid) + + resin.models.device.generateUUID().then (uuid) -> + console.info("Registering to #{application.app_name}: #{uuid}") + return resin.models.device.register(application.app_name, uuid) .get('uuid') .nodeify(done) diff --git a/package.json b/package.json index 65022338..d0739590 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "resin-image": "^1.1.4", "resin-image-manager": "^3.2.2", "resin-pine": "^1.3.0", - "resin-sdk": "^2.7.2", + "resin-sdk": "^3.0.0", "resin-settings-client": "^3.1.0", "resin-vcs": "^2.0.0", "rimraf": "^2.4.3",