mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-01-02 20:16:41 +00:00
Merge pull request #207 from resin-io/jviotti/fix/promise-using
Fix incorrect Promise.using syntax
This commit is contained in:
commit
0443a35f2b
@ -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);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -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) ->
|
||||||
|
Loading…
Reference in New Issue
Block a user