Skip to content

Commit

Permalink
grunt: jsbeautifier
Browse files Browse the repository at this point in the history
Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
  • Loading branch information
rwaldron committed Jul 20, 2017
1 parent 0a7bc8a commit e5af6b5
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 35 deletions.
68 changes: 34 additions & 34 deletions lib/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -1006,44 +1006,44 @@ controller.tesselEnvVersions = opts => {
const cliVersion = require('../package.json').version;

return controller.standardTesselCommand(opts, tessel => {
return new Promise((resolve, reject) => {
Promise.all([
updates.requestBuildList(),
tessel.fetchCurrentBuildInfo(),
tessel.fetchNodeProcessVersion(),
]).then(responses => {
/*
responses[0] => (array) Entries contain released data, sha, version
responses[1] => (string) SHA of current build
responses[2] => (string) process.version (on board)
*/

const build = updates.findBuild(responses[0], 'sha', responses[1]);
const firmwareVersion = (build && build.version) || responses[1];
const nodeVersion = responses[2];
return new Promise((resolve, reject) => {
Promise.all([
updates.requestBuildList(),
tessel.fetchCurrentBuildInfo(),
tessel.fetchNodeProcessVersion(),
]).then(responses => {
/*
responses[0] => (array) Entries contain released data, sha, version
responses[1] => (string) SHA of current build
responses[2] => (string) process.version (on board)
*/

const build = updates.findBuild(responses[0], 'sha', responses[1]);
const firmwareVersion = (build && build.version) || responses[1];
const nodeVersion = responses[2];

log.info('Tessel Environment Versions:');
log.info(`t2-cli: ${cliVersion}`);
log.info(`t2-firmware: ${firmwareVersion}`);
log.info(`Node.js: ${nodeVersion}`);

resolve();
// If any of the requests for version data fail,
// 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(`t2-firmware: ${firmwareVersion}`);
log.info(`Node.js: ${nodeVersion}`);

resolve();
// If any of the requests for version data fail,
// then this whole operation should fail.
}, reject).catch(reject);
log.info(`${error}`);
return Promise.resolve();
}
return Promise.reject(error);
});
})
.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);
});
};

controller.reboot = opts => {
Expand Down
2 changes: 1 addition & 1 deletion test/unit/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ exports['controller.tesselEnvVersions'] = {
test.expect(7);

const message = 'No Tessels Found.';

this.standardTesselCommand.restore();
this.standardTesselCommand = this.sandbox.stub(controller, 'standardTesselCommand', () => {
return Promise.reject(message);
Expand Down

0 comments on commit e5af6b5

Please sign in to comment.