-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add engine version number to footer, http headers and spec files #129
- Loading branch information
Showing
7 changed files
with
36 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,26 @@ | ||
'use strict'; | ||
|
||
var fs = require('fs'); | ||
var path = require('path'); | ||
var pathToApp = path.dirname(require.main.filename); | ||
var ejs = require('ejs'); | ||
|
||
exports.getHeaderAndFooter = function () { | ||
var defaultTemplatePath = pathToApp + "/assets/templates/"; | ||
var userTemplatePath = global.app.get('user') + "/assets/templates/"; | ||
var headerFile = "header.inc.html"; | ||
var footerFile = "footer.inc.html"; | ||
var defaultTemplatePath = global.pathToApp + '/assets/templates/'; | ||
var userTemplatePath = global.app.get('user') + '/assets/templates/'; | ||
var headerFile = 'header.inc.html'; | ||
var footerFile = 'footer.inc.html'; | ||
|
||
var data = {}; | ||
var output = {}; | ||
|
||
if(fs.existsSync(userTemplatePath + headerFile)) { | ||
data.header = ejs.render(fs.readFileSync(userTemplatePath + headerFile, "utf-8")); | ||
} else { | ||
data.header = ejs.render(fs.readFileSync(defaultTemplatePath + headerFile, "utf-8")); | ||
} | ||
var userHeaderTplPath = userTemplatePath + headerFile; | ||
var headerTplPath = fs.existsSync(userHeaderTplPath) ? userHeaderTplPath : defaultTemplatePath + headerFile; | ||
|
||
if(fs.existsSync(userTemplatePath + footerFile)) { | ||
data.footer = ejs.render(fs.readFileSync(userTemplatePath + footerFile, "utf-8")); | ||
} else { | ||
data.footer = ejs.render(fs.readFileSync(defaultTemplatePath + footerFile, "utf-8")); | ||
} | ||
var userFooterTplPath = userTemplatePath + footerFile; | ||
var footerTplPath = fs.existsSync(userFooterTplPath) ? userFooterTplPath : defaultTemplatePath + footerFile; | ||
|
||
return data; | ||
output.header = ejs.render(fs.readFileSync(headerTplPath, 'utf-8')); | ||
output.footer = ejs.render(fs.readFileSync(footerTplPath, 'utf-8'), { | ||
engineVersion: global.engineVersion | ||
}); | ||
|
||
return output; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters