Project: fix toObjectPopulated()

This commit is contained in:
ac360 2016-03-01 13:47:20 -08:00
parent 6ca9564c52
commit 4b00f8d07e
4 changed files with 13 additions and 12 deletions

View File

@ -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;

View File

@ -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() {

View File

@ -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]);

View File

@ -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