Skip to content
This repository has been archived by the owner on Oct 17, 2019. It is now read-only.

Commit

Permalink
Config import
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhijay authored and cmoesel committed Sep 10, 2018
1 parent a4b163d commit 047f990
Showing 1 changed file with 25 additions and 14 deletions.
39 changes: 25 additions & 14 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,19 +111,25 @@ if (doADL) {

// Go!
logger.info('Starting CLI Import/Export');
const configSpecifications = shrTI.importConfigFromFilePath(input, program.config);
if (!configSpecifications) {
process.exit(1);
}
configSpecifications.showDuplicateErrors = showDuplicateErrors;
let configSpecifications;
let specifications;
let expSpecifications;
if (!importCimcore) {
configSpecifications = shrTI.importConfigFromFilePath(input, program.config);
if (!configSpecifications) {
logger.fatal('Project configuration not found! Exiting the program. ERROR_CODE:11032');
process.exit(1);
}
specifications = shrTI.importFromFilePath(input, configSpecifications);
expSpecifications = shrEx.expand(specifications, shrFE);
} else {
specifications = expSpecifications = shrTI.importCIMCOREFromFilePath(`./out/cimcore/`);
[configSpecifications, expSpecifications] = shrTI.importCIMCOREFromFilePath(`./cimcore-input/cimcore/`);
if (!configSpecifications) {
logger.fatal('Project configuration not found! Exiting the program. ERROR_CODE:11032');
process.exit(1);
}
}
configSpecifications.showDuplicateErrors = showDuplicateErrors;


let filter = false;
Expand Down Expand Up @@ -247,14 +253,19 @@ if (doADL) {
}

if (doJSON) {
try {
const jsonHierarchyResults = shrJE.exportToJSON(specifications, configSpecifications);
const hierarchyPath = path.join(program.out, 'json', 'definitions.json');
mkdirp.sync(path.dirname(hierarchyPath));
fs.writeFileSync(hierarchyPath, JSON.stringify(jsonHierarchyResults, null, ' '));
} catch (error) {
logger.fatal('Failure in JSON export. Aborting with error message: %s', error);
failedExports.push('shr-json-export');
if (!importCimcore) {
try {
const jsonHierarchyResults = shrJE.exportToJSON(specifications, configSpecifications);
const hierarchyPath = path.join(program.out, 'json', 'definitions.json');
mkdirp.sync(path.dirname(hierarchyPath));
fs.writeFileSync(hierarchyPath, JSON.stringify(jsonHierarchyResults, null, ' '));
} catch (error) {
logger.fatal('Failure in JSON export. Aborting with error message: %s', error);
failedExports.push('shr-json-export');
}
} else {
//Skipping website generation legacy output for imported cimcore.
logger.info('Using imported CIMCORE, skipping JSON export');
}
} else {
logger.info('Skipping JSON export');
Expand Down

0 comments on commit 047f990

Please sign in to comment.