Skip to content

Commit

Permalink
t2 restore: make api testable, match promise interface used throughout.
Browse files Browse the repository at this point in the history
Closes gh-493

- update-fetch.js made testable (TODO: more tests to be written)
- restore: adds -f to skip device id check
- restore: simplified controller handler
- consolidate contents of "flash.js" into "restore.js"
- restore.js: eliminate async, uses promises
- restore.js: substantial tests, but still lacking coverage in a few areas, this can be done in a follow up
- updates to jshintrc and bootstrap.js

Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
  • Loading branch information
rwaldron committed Aug 18, 2016
1 parent 0f07402 commit 5c6e994
Show file tree
Hide file tree
Showing 8 changed files with 630 additions and 257 deletions.
7 changes: 6 additions & 1 deletion bin/tessel-2.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,16 @@ parser.command('provision')
})
.help('Authorize your computer to control the USB-connected Tessel');

parser.command('restore')
makeCommand('restore')
.callback(options => {
log.level(options.loglevel);
callControllerWith('restoreTessel', options);
})
.option('force', {
abbr: 'f',
flag: true,
help: 'Skip the Device ID check and restore. Including this flag is not recommended, but may be necessary if Tessel memory device contents are corrupt.'
})
.help('Restore your Tessel by installing the factory version of OpenWrt.');

makeCommand('restart')
Expand Down
8 changes: 1 addition & 7 deletions lib/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -562,13 +562,7 @@ controller.restoreTessel = function(opts) {
opts.altSetting = 1;
return controller.get(opts).then((tessel) => {
return new Promise((resolve, reject) => {
tessel.restore(opts)
.then((result) => {
resolve(result);
})
.catch((err) => {
reject(err);
});
return tessel.restore(opts).then(resolve).catch(reject);
});
});
};
Expand Down
180 changes: 0 additions & 180 deletions lib/flash.js

This file was deleted.

0 comments on commit 5c6e994

Please sign in to comment.