Skip to content

Commit

Permalink
fix(version): show cli verison if no Tessels are connected
Browse files Browse the repository at this point in the history
  • Loading branch information
HipsterBrown authored and rwaldron committed Jul 14, 2017
1 parent afe4fb0 commit 05bd0ac
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion lib/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,9 @@ controller.updateTesselWithVersion = function(opts, tessel, currentVersion, buil

controller.tesselEnvVersions = opts => {
opts.authorized = true;

const cliVersion = require('../package.json').version;

return controller.standardTesselCommand(opts, tessel => {
return new Promise((resolve, reject) => {
Promise.all([
Expand All @@ -1015,7 +1018,6 @@ controller.tesselEnvVersions = opts => {
responses[2] => (string) process.version (on board)
*/

const cliVersion = require('../package.json').version;
const build = updates.findBuild(responses[0], 'sha', responses[1]);
const firmwareVersion = (build && build.version) || responses[1];
const nodeVersion = responses[2];
Expand All @@ -1030,6 +1032,17 @@ controller.tesselEnvVersions = opts => {
// then this whole operation should fail.
}, reject).catch(reject);
});
})
.catch((error) => {
// if no tessels are found, default to cli version
if (error.includes(responses.noAuth) || error.includes(responses.auth)) {

log.info('Tessel Environment Versions:');
log.info(`t2-cli: ${cliVersion}`);
log.info(`${error}`);
return Promise.resolve();
}
return Promise.reject(error);
});
};

Expand Down

0 comments on commit 05bd0ac

Please sign in to comment.