diff --git a/lib/Project.js b/lib/Project.js index b6751d88d..1178dc21c 100644 --- a/lib/Project.js +++ b/lib/Project.js @@ -78,7 +78,7 @@ class Project extends SerializerFileSystem { } // Populate - let populated = SUtils.populate(this, this.getTemplates().toObject(), this.toObject(), options.stage, options.region); + let populated = SUtils.populate(this, this.getTemplates().toObject(), obj, options.stage, options.region); if (components) populated.components = components; if (resources) populated.resources = resources; diff --git a/lib/SerializerFileSystem.js b/lib/SerializerFileSystem.js index c047b1ed0..dc57ab1a4 100644 --- a/lib/SerializerFileSystem.js +++ b/lib/SerializerFileSystem.js @@ -552,16 +552,16 @@ class SerializerFileSystem { }) .then(function() { - let parentDir = path.dirname(templates.getFilePath()); // Skip this, if we are in the project or component root, - if (SUtils.fileExistsSync(path.join(parentDir, 's-project.json') || - SUtils.fileExistsSync(path.join(parentDir, 's-component.json')))) { + if (SUtils.fileExistsSync(templates.getRootPath('s-project.json')) || + SUtils.fileExistsSync(templates.getRootPath('s-component.json'))) { return; } // People can store s-templates.json in infinite subfolders in their components. We have to find these... // Loop through parent dirs and find parent templates until hitting component root let parents = [], + parentDir = templates.getRootPath(), notRoot = true; while (notRoot) { @@ -571,7 +571,6 @@ class SerializerFileSystem { parents.push(SUtils.readFileSync(path.join(parentDir, 's-templates.json'))) } } - templates.setParents(parents); }) .then(function() { diff --git a/lib/utils/new.js b/lib/utils/new.js index 639a89658..b354370e0 100644 --- a/lib/utils/new.js +++ b/lib/utils/new.js @@ -330,7 +330,9 @@ module.exports = { 'Module level templates extend project level templates if there are duplicates. You will need to change: ' + template); } - if (!templates[template]) SCli.log('WARNING: the following template is requested but not defined: ' + template); + if (!templates[template]) { + SCli.log('WARNING: the following template is requested but not defined: ' + template); + } // Replace if (templates[template]) t.update(templates[template]); diff --git a/tests/all.js b/tests/all.js index 9015612a1..bbd397d19 100644 --- a/tests/all.js +++ b/tests/all.js @@ -10,12 +10,12 @@ describe('All Tests', function() { }); after(function() {}); - require('./tests/classes/Project'); // working - require('./tests/classes/Component'); // working - require('./tests/classes/Function'); // working - require('./tests/classes/Endpoint'); // working - require('./tests/classes/Stage'); // working - require('./tests/classes/Region'); // working + require('./tests/classes/Project'); + require('./tests/classes/Component'); + require('./tests/classes/Function'); + require('./tests/classes/Endpoint'); + require('./tests/classes/Stage'); + require('./tests/classes/Region'); // require('./tests/actions/TestPluginCustom'); // working // //require('./tests/actions/TestDefaultActionHook'); // BROKEN. Something has to do with getParentTemplate // require('./tests/actions/StageCreate'); // working