From 2acd5c31b8134fdec4c025f35b43bfc4fa37769e Mon Sep 17 00:00:00 2001 From: Austen Collins Date: Tue, 15 Sep 2015 07:57:26 -0700 Subject: [PATCH] new action: refactor --- lib/commands/new_action.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/commands/new_action.js b/lib/commands/new_action.js index d7f103660..f07faacaf 100644 --- a/lib/commands/new_action.js +++ b/lib/commands/new_action.js @@ -20,6 +20,7 @@ Promise.promisifyAll(fs); */ module.exports.run = function(JAWS, action) { + console.log(JAWS); var command = new CMD(JAWS, action); return command.run(); }; @@ -94,8 +95,8 @@ CMD.prototype._createSkeleton = Promise.method(function() { // Fetch skeleton resources var templatesPath = path.join(__dirname, '..', 'templates'); - var actionJson = JSON.parse(fs.readFileSync(path.join(templatesPath, 'jaws.json'))); - + var actionJson = JSON.parse(fs.readFileSync(path.join(templatesPath, 'awsm.json'))); + console.log(actionJson); var actionPath = path.join( _this._JAWS._meta.projectRootPath, 'back', @@ -115,7 +116,7 @@ CMD.prototype._createSkeleton = Promise.method(function() { // Edit jaws.json actionJson.name = _this._action.resource + '-' + _this._action.action; actionJson.lambda.functionName = actionJson.name; - actionJson.endpoint.path = _this._action.resource + '/' + _this._action.action; + actionJson.apiGateway.path = _this._action.resource + '/' + _this._action.action; // Create files for lambda actions switch (_this._action.runtime) { @@ -164,7 +165,7 @@ CMD.prototype._createSkeleton = Promise.method(function() { // Trim unnecessary JSON if (_this._action.type === 'lambda') { - delete actionJson.endpoint; + delete actionJson.apiGateway; } if (_this._action.type === 'endpoint') { @@ -172,6 +173,6 @@ CMD.prototype._createSkeleton = Promise.method(function() { } // Write Files - writeFilesDeferred.push(utils.writeFile(path.join(actionPath, 'jaws.json'), JSON.stringify(actionJson, null, 2))); + writeFilesDeferred.push(utils.writeFile(path.join(actionPath, 'awsm.json'), JSON.stringify(actionJson, null, 2))); return Promise.all(writeFilesDeferred); -}); +}); \ No newline at end of file