Comparing version 0.8.1 to 0.8.2-1
@@ -158,57 +158,32 @@ /* | ||
apps.create = function (target, callback) { | ||
var dir = process.cwd(), | ||
name; | ||
var dir = process.cwd(); | ||
function executeCreate (err, pkg) { | ||
function createApp(err, pkg) { | ||
if (err) { | ||
jitsu.log.error(err); | ||
return callback(new Error(), true); | ||
return callback(err); | ||
} | ||
pkg.name = name || pkg.name; | ||
jitsu.apps.list(function (err, apps) { | ||
jitsu.log.info('Creating app ' + pkg.name.magenta); | ||
jitsu.apps.create(pkg, function (err, res, result) { | ||
if (err) { | ||
jitsu.log.error('Error creating ' + pkg.name.magenta); | ||
jitsu.log.error(err.message); | ||
return callback(err); | ||
} | ||
var existing = apps.filter(function (a) { | ||
return a.name === pkg.name; | ||
}); | ||
if (existing.length > 0) { | ||
return callback(new Error('Cannot create duplicate application ' + pkg.name.magenta), true, true); | ||
} | ||
// | ||
// TODO (indexzero): Configure this default value in nodejitsu APIs | ||
// | ||
pkg.state = 'stopped'; | ||
function createApp (err, result) { | ||
if (err) { | ||
return callback(err); | ||
} | ||
jitsu.log.info('Creating app ' + pkg.name.magenta); | ||
jitsu.apps.create(pkg, function (err, res, result) { | ||
jitsu.log.silly('Done creating app ' + pkg.name.magenta); | ||
return err ? callback(err) : callback(null, pkg); | ||
}); | ||
} | ||
jitsu.log.silly('Done creating app ' + pkg.name.magenta); | ||
return callback(null, pkg); | ||
}); | ||
} | ||
jitsu.log.info('Checking app availability ' + pkg.name.magenta); | ||
jitsu.package.available(pkg, dir, createApp, function createPackage (err, result) { | ||
if (err) { | ||
jitsu.log.error('Error creating ' + pkg.name.magenta); | ||
jitsu.log.error(err.message); | ||
return callback(new Error()); | ||
} | ||
function executeCreate(err, pkg) { | ||
if (err) { | ||
return callback(err); | ||
} | ||
jitsu.package.available(result, dir, createApp, createPackage); | ||
}); | ||
}); | ||
pkg.state = 'stopped'; | ||
jitsu.log.info('Checking app availability ' + pkg.name.magenta); | ||
jitsu.package.available(pkg, dir, createApp, executeCreate); | ||
} | ||
if (target && typeof target === 'object') { | ||
name = target.name; | ||
return executeCreate(null, target); | ||
@@ -215,0 +190,0 @@ } |
@@ -11,3 +11,3 @@ { | ||
], | ||
"version": "0.8.1", | ||
"version": "0.8.2-1", | ||
"author": "Nodejitsu Inc. <support@nodejitsu.com>", | ||
@@ -28,3 +28,3 @@ "repository": { | ||
"request": "2.9.100", | ||
"require-analyzer": "0.4.0-2", | ||
"require-analyzer": "0.4.0-3", | ||
"semver": "1.0.13" | ||
@@ -31,0 +31,0 @@ }, |
@@ -160,6 +160,2 @@ /* | ||
}, { 'x-powered-by': 'Nodejitsu' }) | ||
.get('/apps/tester') | ||
.reply(200, { | ||
apps: [] | ||
}, { 'x-powered-by': 'Nodejitsu' }) | ||
.post('/apps/tester/example-app/available', { | ||
@@ -166,0 +162,0 @@ name: 'example-app', |
814509
4233
+ Addedrequire-analyzer@0.4.0-3(transitive)
- Removedrequire-analyzer@0.4.0-2(transitive)
Updatedrequire-analyzer@0.4.0-3