balena-cli/build/actions/update.js

24 lines
903 B
JavaScript
Raw Normal View History

2015-03-04 18:03:08 +00:00
(function() {
2015-05-13 18:37:27 +00:00
var packageJSON, selfupdate;
2015-05-13 18:37:27 +00:00
selfupdate = require('selfupdate');
2015-03-04 18:03:08 +00:00
packageJSON = require('../../package.json');
exports.update = {
signature: 'update',
description: 'update the resin cli',
2015-03-04 18:47:46 +00:00
help: 'Use this command to update the Resin CLI\n\nThis command outputs information about the update process.\nUse `--quiet` to remove that output.\n\nThe Resin CLI checks for updates once per day.\n\nMajor updates require a manual update with this update command,\nwhile minor updates are applied automatically.\n\nExamples:\n\n $ resin update',
2015-03-04 18:03:08 +00:00
action: function(params, options, done) {
2015-05-13 18:37:27 +00:00
return selfupdate.update(packageJSON, function(error, version) {
if (error != null) {
return done(error);
2015-03-04 18:03:08 +00:00
}
2015-05-13 18:37:27 +00:00
console.info("Updated " + packageJSON.name + " to version " + version + ".");
return done();
});
2015-03-04 18:03:08 +00:00
}
};
}).call(this);