Comparing version 0.10.2 to 0.10.3
@@ -32,2 +32,20 @@ /* | ||
function handleStartError(err, name, callback) { | ||
// | ||
// TODO: replace this error handling with errs library | ||
// | ||
if (err.result) { | ||
if (err.result.message === "Cannot start application with no snapshots") { | ||
jitsu.log.error('Cannot start ' + name.magenta + ' since it has no snapshots'); | ||
jitsu.log.help('Try running a ' + 'jitsu deploy'.magenta); | ||
return callback({}, null); | ||
} | ||
else if (err.result.error === 'not_found') { | ||
jitsu.log.error('App ' + name.magenta + ' doesn\'t exist on Nodejitsu yet!'); | ||
return callback({}); | ||
} | ||
} | ||
callback(err); | ||
} | ||
// | ||
@@ -584,28 +602,6 @@ // ### function deploy (callback) | ||
jitsu.apps.start(name, function (err) { | ||
// | ||
// TODO: replace this error handling with errs library | ||
// | ||
if (err && err.result) { | ||
if(err.result.message === "Cannot start application with no snapshots") { | ||
jitsu.log.error('Cannot start ' + name.magenta + ' since it has no snapshots'); | ||
jitsu.log.help('Try running a ' + 'jitsu deploy'.magenta); | ||
return callback({}, null); | ||
} | ||
} | ||
// | ||
// TODO: replace this error handling with errs library | ||
// | ||
if (err) { | ||
if (err) { | ||
if(err.result && err.result.error === "not_found") { | ||
jitsu.log.error('App ' + name.magenta + ' doesn\'t exist on Nodejitsu yet!'); | ||
return callback({}); | ||
} | ||
return callback(err); | ||
} | ||
return handleStartError(err, name, callback); | ||
} | ||
jitsu.apps.view(name, function (err, app) { | ||
@@ -754,1 +750,47 @@ if (err) { | ||
]; | ||
// | ||
// ### function setdrones (name, number, callback) | ||
// #### @name {string} **optional** Name of the application to stop. | ||
// #### @callback {function} Continuation to pass control to when complete. | ||
// Stops the application specified by `name`. If no name is supplied | ||
// this will stop the application in the current directory. | ||
// | ||
apps.setdrones = function (name, number, callback) { | ||
function executeSet() { | ||
number = parseInt(number, 10); | ||
jitsu.log.info('Setting number of drones for app ' + name.magenta + ' to ' + number.toString().magenta); | ||
jitsu.apps.setDrones(name, number, function (err) { | ||
if (err) { | ||
return handleStartError(err, name, callback); | ||
} | ||
jitsu.log.info('App ' + name.magenta + ' is now running on ' + number.toString().magenta + ' drones'); | ||
callback(); | ||
}); | ||
} | ||
if (!isNaN(parseInt(name, 10))) { | ||
number = name; | ||
name = null; | ||
} | ||
if (!name) { | ||
return jitsu.package.tryRead(process.cwd(), callback, function (pkg) { | ||
name = pkg.name; | ||
executeSet(); | ||
}); | ||
} | ||
executeSet(); | ||
}; | ||
// | ||
// Usage for `jitsu apps setdrones [<name>] <number>` | ||
// | ||
apps.setdrones.usage = [ | ||
'Sets number of drones used by the application.', | ||
'', | ||
'jitsu apps stop [<name>] <number>', | ||
]; |
@@ -11,3 +11,3 @@ { | ||
], | ||
"version": "0.10.2", | ||
"version": "0.10.3", | ||
"author": "Nodejitsu Inc. <info@nodejitsu.com>", | ||
@@ -33,3 +33,3 @@ "maintainers": [ | ||
"npm": "1.1.59", | ||
"nodejitsu-api": "0.3.5", | ||
"nodejitsu-api": "0.3.6", | ||
"pkginfo": "0.2.3", | ||
@@ -36,0 +36,0 @@ "request": "2.9.203", |
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
410564
5947
12
1
+ Addednodejitsu-api@0.3.6(transitive)
- Removednodejitsu-api@0.3.5(transitive)
Updatednodejitsu-api@0.3.6