Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: nodejitsu/jitsu
...
head fork: nodejitsu/jitsu
  • 5 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
View
91 lib/jitsu/commands/apps.js
@@ -116,11 +116,14 @@ apps.deploy = function (callback) {
jitsu.apps.view(local.name, function (err, app) {
var pkg;
+ //
+ // TODO: replace this error handling with errs library
+ //
if (err) {
if (err.result) {
if (err.result.error === 'not_found') {
- jitsu.log.silly('app ' + local.name.magenta + ' doesn\'t exist');
+ jitsu.log.silly('App ' + local.name.magenta + ' doesn\'t exist!');
//
// If there is a before filter we should run before creating the app do so,
// then create the application.
@@ -194,6 +197,15 @@ apps.deploy.usage = [
// using `name` if supplied and falling back to `package.name`.
//
apps.create = function (target, callback) {
+
+ //
+ // Allows arbitrary amount of arguments
+ //
+ if(arguments) {
+ arguments = Array.prototype.slice.call(arguments);
+ callback = arguments[arguments.length - 1];
+ }
+
var dir = process.cwd();
function createApp(err, pkg) {
@@ -320,6 +332,14 @@ apps.list.usage = [
apps.view = function (name, callback) {
//
+ // Allows arbitrary amount of arguments
+ //
+ if(arguments) {
+ arguments = Array.prototype.slice.call(arguments);
+ callback = arguments[arguments.length - 1];
+ }
+
+ //
// Always curry last argument to callback
//
if(arguments) {
@@ -397,6 +417,15 @@ apps.view.usage = [
// Lists the applications for the authenticated user.
//
apps.update = function (name, callback) {
+
+ //
+ // Allows arbitrary amount of arguments
+ //
+ if(arguments) {
+ arguments = Array.prototype.slice.call(arguments);
+ callback = arguments[arguments.length - 1];
+ }
+
jitsu.log.silly('Reading package.json in ' + process.cwd());
jitsu.package.tryRead(process.cwd(), callback, function (pkg) {
name = name || pkg.name;
@@ -441,6 +470,14 @@ apps.update.usage = [
//
apps.destroy = function (name, callback) {
+ //
+ // Allows arbitrary amount of arguments
+ //
+ if(arguments) {
+ arguments = Array.prototype.slice.call(arguments);
+ callback = arguments[arguments.length - 1];
+ }
+
function executeDestroy() {
jitsu.log.info('Destroying app ' + name.magenta);
jitsu.apps.destroy(name, function (err) {
@@ -487,10 +524,22 @@ apps.destroy.usage = [
//
apps.start = function (name, callback) {
+ //
+ // Allows arbitrary amount of arguments
+ //
+ if(arguments) {
+ arguments = Array.prototype.slice.call(arguments);
+ callback = arguments[arguments.length - 1];
+ }
+
function executeStart() {
jitsu.log.info('Starting app ' + name.magenta);
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');
@@ -498,9 +547,21 @@ apps.start = function (name, callback) {
return callback({}, null);
}
}
+
+ //
+ // TODO: replace this error handling with errs library
+ //
if (err) {
- return callback(err, true);
+ 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);
+ }
}
+
+
jitsu.apps.view(name, function (err, app) {
if (err) {
return callback(err);
@@ -544,6 +605,14 @@ apps.start.usage = [
//
apps.restart = function (name, callback) {
+ //
+ // Allows arbitrary amount of arguments
+ //
+ if(arguments) {
+ arguments = Array.prototype.slice.call(arguments);
+ callback = arguments[arguments.length - 1];
+ }
+
function executeRestart() {
jitsu.log.info('Restarting app ' + name.magenta);
jitsu.apps.restart(name, function (err) {
@@ -586,13 +655,29 @@ apps.restart.usage = [
//
apps.stop = function (name, callback) {
+ //
+ // Allows arbitrary amount of arguments
+ //
+ if(arguments) {
+ arguments = Array.prototype.slice.call(arguments);
+ callback = arguments[arguments.length - 1];
+ }
+
function executeStop() {
jitsu.log.info('Stopping app ' + name.magenta);
jitsu.apps.stop(name, function (err) {
+
+ //
+ // TODO: replace this error handling with errs library
+ //
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);
}
-
+
jitsu.log.info('App ' + name.magenta + ' is stopped');
callback();
});
View
8 lib/jitsu/commands/env.js
@@ -194,7 +194,15 @@ env.clear = function (appName, callback) {
//
function viewApp(callback, success) {
jitsu.package.tryRead(process.cwd(), callback, function (pkg) {
+ jitsu.log.info('Attempting to set env variables for app ' + (process.cwd()+ '/package.json').grey);
jitsu.apps.view(pkg.name, function (err, app) {
+ //
+ // TODO: replace this error handling with errs library
+ //
+ if (err && err.result && err.result.error === "not_found") {
+ jitsu.log.error('app ' + pkg.name.magenta + ' doesn\'t exist on Nodejitsu yet!');
+ return callback({});
+ }
return err ? callback(err) : success(null, app);
});
});
View
2  lib/jitsu/package.js
@@ -105,7 +105,7 @@ package.read = function (dir, callback) {
//
package.tryRead = function (dir, callback, success) {
package.read(dir, function (err, pkg) {
- return err ? callback(new Error('No package.json in ' + dir), true) : success(pkg);
+ return err ? callback(new Error('No package found at ' + (dir + '/package.json').grey), true) : success(pkg);
});
};

No commit comments for this range

Something went wrong with that request. Please try again.