diff --git a/build/actions/device.js b/build/actions/device.js index 22bb0f7f..944fd7a8 100644 --- a/build/actions/device.js +++ b/build/actions/device.js @@ -142,18 +142,18 @@ var download; download = function() { return tmp.tmpNameAsync().then(function(temporalPath) { - return capitano.runAsync("os download --output " + temporalPath); + return capitano.runAsync("os download " + application.device_type + " --output " + temporalPath); }).disposer(_.ary(rimraf, 1)); }; - return Promise.using(download()).then(function(temporalPath) { + return Promise.using(download(), function(temporalPath) { return capitano.runAsync("device register " + application.app_name).then(resin.models.device.get).tap(function(device) { return capitano.runAsync("os configure " + temporalPath + " " + device.uuid).then(function() { return capitano.runAsync("os initialize " + temporalPath + " " + device.uuid); }); - }).then(function(device) { - console.log('Done'); - return device.uuid; }); + }).then(function(device) { + console.log('Done'); + return device.uuid; }); }).nodeify(done); } diff --git a/lib/actions/device.coffee b/lib/actions/device.coffee index c4ad4b50..d9cff71c 100644 --- a/lib/actions/device.coffee +++ b/lib/actions/device.coffee @@ -198,17 +198,17 @@ exports.init = download = -> tmp.tmpNameAsync().then (temporalPath) -> - capitano.runAsync("os download --output #{temporalPath}") + capitano.runAsync("os download #{application.device_type} --output #{temporalPath}") .disposer(_.ary(rimraf, 1)) - Promise.using(download()).then (temporalPath) -> + Promise.using download(), (temporalPath) -> capitano.runAsync("device register #{application.app_name}") .then(resin.models.device.get) .tap (device) -> capitano.runAsync("os configure #{temporalPath} #{device.uuid}").then -> capitano.runAsync("os initialize #{temporalPath} #{device.uuid}") - .then (device) -> - console.log('Done') - return device.uuid + .then (device) -> + console.log('Done') + return device.uuid .nodeify(done)