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,19 +142,19 @@
var download; var download;
download = function() { download = function() {
return tmp.tmpNameAsync().then(function(temporalPath) { 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)); }).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("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 configure " + temporalPath + " " + device.uuid).then(function() {
return capitano.runAsync("os initialize " + temporalPath + " " + device.uuid); return capitano.runAsync("os initialize " + temporalPath + " " + device.uuid);
}); });
});
}).then(function(device) { }).then(function(device) {
console.log('Done'); console.log('Done');
return device.uuid; return device.uuid;
}); });
});
}).nodeify(done); }).nodeify(done);
} }
}; };

View File

@ -198,10 +198,10 @@ exports.init =
download = -> download = ->
tmp.tmpNameAsync().then (temporalPath) -> tmp.tmpNameAsync().then (temporalPath) ->
capitano.runAsync("os download --output #{temporalPath}") capitano.runAsync("os download #{application.device_type} --output #{temporalPath}")
.disposer(_.ary(rimraf, 1)) .disposer(_.ary(rimraf, 1))
Promise.using(download()).then (temporalPath) -> Promise.using download(), (temporalPath) ->
capitano.runAsync("device register #{application.app_name}") capitano.runAsync("device register #{application.app_name}")
.then(resin.models.device.get) .then(resin.models.device.get)
.tap (device) -> .tap (device) ->