Merge pull request #207 from resin-io/jviotti/fix/promise-using

Fix incorrect Promise.using syntax
This commit is contained in:
Juan Cruz Viotti 2015-09-30 12:06:51 -04:00
commit 0443a35f2b
2 changed files with 10 additions and 10 deletions

View File

@ -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);
}

View File

@ -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)