mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-04-08 11:54:12 +00:00
Merge pull request #41 from resin-io/feature/command-run
Make use of capitano.run() to run subcommands
This commit is contained in:
commit
741acfbba3
@ -1,5 +1,7 @@
|
||||
(function() {
|
||||
var _, async, commandOptions, osAction, path, resin, tmp, vcs, visuals;
|
||||
var _, async, capitano, commandOptions, osAction, path, resin, tmp, vcs, visuals;
|
||||
|
||||
capitano = require('capitano');
|
||||
|
||||
_ = require('lodash-contrib');
|
||||
|
||||
@ -196,8 +198,7 @@
|
||||
return callback(null, outputFile, cleanupCallback);
|
||||
});
|
||||
}, function(outputFile, cleanupCallback, callback) {
|
||||
params.image = outputFile;
|
||||
return osAction.install.action(params, options, function(error) {
|
||||
return capitano.run("os install " + outputFile + " " + params.device, function(error) {
|
||||
if (error != null) {
|
||||
return callback(error);
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
(function() {
|
||||
var _, async, commandOptions, elevate, mkdirp, npm, os, packageJSON, path, resin, umount, updateActions, visuals;
|
||||
var _, async, capitano, commandOptions, elevate, mkdirp, npm, os, packageJSON, path, resin, umount, visuals;
|
||||
|
||||
capitano = require('capitano');
|
||||
|
||||
_ = require('lodash-contrib');
|
||||
|
||||
@ -23,8 +25,6 @@
|
||||
|
||||
packageJSON = require('../../package.json');
|
||||
|
||||
updateActions = require('./update');
|
||||
|
||||
elevate = require('../elevate');
|
||||
|
||||
exports.download = {
|
||||
@ -113,7 +113,7 @@
|
||||
return callback();
|
||||
}
|
||||
console.info('Resin CLI is outdated.\n\nIn order to avoid device compatibility issues, this command\nrequires that you have the Resin CLI updated.\n\nUpdating now...');
|
||||
return updateActions.update.action(params, options, _.unary(callback));
|
||||
return capitano.run('update', _.unary(callback));
|
||||
}, function(callback) {
|
||||
if (params.device != null) {
|
||||
return callback(null, params.device);
|
||||
|
@ -1,3 +1,4 @@
|
||||
capitano = require('capitano')
|
||||
_ = require('lodash-contrib')
|
||||
path = require('path')
|
||||
async = require('async')
|
||||
@ -274,13 +275,16 @@ exports.init =
|
||||
|
||||
(tmpPath, tmpFd, cleanupCallback, callback) ->
|
||||
options.output = tmpPath
|
||||
|
||||
# TODO: Figure out how to make use of capitano.run()
|
||||
# here given the complexity of converting network
|
||||
# params object to string options
|
||||
osAction.download.action params, options, (error, outputFile) ->
|
||||
return callback(error) if error?
|
||||
return callback(null, outputFile, cleanupCallback)
|
||||
|
||||
(outputFile, cleanupCallback, callback) ->
|
||||
params.image = outputFile
|
||||
osAction.install.action params, options, (error) ->
|
||||
capitano.run "os install #{outputFile} #{params.device}", (error) ->
|
||||
return callback(error) if error?
|
||||
cleanupCallback()
|
||||
return callback()
|
||||
|
@ -1,3 +1,4 @@
|
||||
capitano = require('capitano')
|
||||
_ = require('lodash-contrib')
|
||||
os = require('os')
|
||||
async = require('async')
|
||||
@ -9,7 +10,6 @@ umount = require('umount').umount
|
||||
commandOptions = require('./command-options')
|
||||
npm = require('../npm')
|
||||
packageJSON = require('../../package.json')
|
||||
updateActions = require('./update')
|
||||
elevate = require('../elevate')
|
||||
|
||||
exports.download =
|
||||
@ -136,7 +136,7 @@ exports.install =
|
||||
Updating now...
|
||||
'''
|
||||
|
||||
updateActions.update.action(params, options, _.unary(callback))
|
||||
capitano.run('update', _.unary(callback))
|
||||
|
||||
(callback) ->
|
||||
return callback(null, params.device) if params.device?
|
||||
|
Loading…
x
Reference in New Issue
Block a user