refactor: unify installation on devices & emulators (#1123)

* refactor: unify installation on devices & emulators

This change replaces the almost identical methods `device.install` and
`emulator.install` with the generic `target.install`.

* fix: use unified installation in platform-centric bins
This commit is contained in:
Raphael von der Grün
2020-11-20 22:12:18 +01:00
committed by GitHub
parent aa679ea1d6
commit bb7d733cde
10 changed files with 222 additions and 358 deletions
+6 -9
View File
@@ -19,6 +19,7 @@
under the License.
*/
const { install } = require('./target');
var device = require('./device');
var args = process.argv;
@@ -26,17 +27,13 @@ if (args.length > 2) {
var install_target;
if (args[2].substring(0, 9) === '--target=') {
install_target = args[2].substring(9, args[2].length);
device.install(install_target).catch(function (err) {
console.error('ERROR: ' + err);
process.exit(2);
});
} else {
console.error('ERROR : argument \'' + args[2] + '\' not recognized.');
process.exit(2);
}
} else {
device.install().catch(function (err) {
console.error('ERROR: ' + err);
process.exit(2);
});
}
device.resolveTarget(install_target).then(install).catch(err => {
console.error('ERROR: ' + err);
process.exit(2);
});