diff --git a/lib/commands/new.js b/lib/commands/new.js index 1d6545f54..b2a3e96b0 100644 --- a/lib/commands/new.js +++ b/lib/commands/new.js @@ -172,7 +172,7 @@ module.exports = function(JAWS) { resolve(); }) .then(function() { //Make skeleton dir structure and initial files - var adminEnv = 'ADMIN_AWS_PROFILE=' + project.awsProfile + os.EOF; + var adminEnv = 'ADMIN_AWS_PROFILE=' + project.awsProfile + os.EOL; // Set project root path. Append unique id if name is in use if (fs.existsSync(path.join(JAWS._meta.cwd, project.name))) { @@ -191,13 +191,14 @@ module.exports = function(JAWS) { cfTemplate.Parameters.aaDataModelPrefix.AllowedValues = [project.stages[0]]; cfTemplate.Parameters.aaNotficationEmail.Default = project.notificationEmail; + var rootPath = JAWS._meta.projectRootPath; return Promise.all([ - fs.mkdirAsync(JAWS._meta.projectRootPath), - fs.mkdirAsync(path.join(JAWS._meta.projectRootPath, 'back')), - fs.mkdirAsync(path.join(JAWS._meta.projectRootPath, 'front')), - fs.mkdirAsync(path.join(JAWS._meta.projectRootPath, 'tests')), - fs.writeFileAsync(path.join(JAWS._meta.projectRootPath, 'admin.env'), adminEnv), - fs.writeFileAsync(path.join(JAWS._meta.projectRootPath, 'jaws-cf.json'), cfTemplate), + fs.mkdirAsync(rootPath), + fs.mkdirAsync(path.join(rootPath, 'back')), + fs.mkdirAsync(path.join(rootPath, 'front')), + fs.mkdirAsync(path.join(rootPath, 'tests')), + fs.writeFileAsync(path.join(rootPath, 'admin.env'), adminEnv), + fs.writeFileAsync(path.join(rootPath, 'jaws-cf.json'), JSON.stringify(cfTemplate, null, 2)), ]); }).then(function() { @@ -228,7 +229,7 @@ module.exports = function(JAWS) { fs.writeFileSync(path.join(JAWS._meta.projectRootPath, 'jaws.json'), JSON.stringify(jawsJson, null, 2)); fs.writeFileSync( path.join(JAWS._meta.projectRootPath, 'jaws-swagger.json'), - _createSwaggerTemplate(project.name) + JSON.stringify(_createSwaggerTemplate(project.name), null, 2) ); console.log('Your project "' + diff --git a/tests/new/index.js b/tests/new/index.js index 7e28f2704..1e68ecced 100644 --- a/tests/new/index.js +++ b/tests/new/index.js @@ -13,6 +13,7 @@ var JAWS = require('../../lib/index.js'); describe('new', function() { before(function(done) { this.timeout(0); //dont timeout anything, creating tables, deleting tables etc + console.error('>tmp dir for proj:', projDir); done(); });