2015-10-19 11:47:49 +00:00
|
|
|
/*
|
|
|
|
|
*
|
|
|
|
|
* FileListPrinter (file-list-printer.js)
|
|
|
|
|
* Author: nmatpt
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2015-12-20 22:22:58 +00:00
|
|
|
(function() {
|
|
|
|
|
|
|
|
|
|
var printerUtils = require('./printer-utils.js').PrinterUtils;
|
|
|
|
|
|
2016-05-09 18:38:55 +00:00
|
|
|
var hoganUtils = require('./hoganjs-utils.js').HoganJsUtils;
|
|
|
|
|
var baseTemplatesPath = 'file-summary';
|
|
|
|
|
|
2015-12-20 22:22:58 +00:00
|
|
|
function FileListPrinter() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FileListPrinter.prototype.generateFileList = function(diffFiles) {
|
2016-05-09 18:38:55 +00:00
|
|
|
var files = diffFiles.map(function(file) {
|
|
|
|
|
return hoganUtils.render(baseTemplatesPath, 'line', {
|
|
|
|
|
fileHtmlId: printerUtils.getHtmlId(file),
|
|
|
|
|
fileName: printerUtils.getDiffName(file),
|
|
|
|
|
deletedLines: '-' + file.deletedLines,
|
|
|
|
|
addedLines: '+' + file.addedLines
|
|
|
|
|
});
|
|
|
|
|
}).join('\n');
|
|
|
|
|
|
|
|
|
|
return hoganUtils.render(baseTemplatesPath, 'wrapper', {
|
|
|
|
|
filesNumber: diffFiles.length,
|
|
|
|
|
files: files
|
|
|
|
|
});
|
2015-12-20 22:22:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
module.exports.FileListPrinter = new FileListPrinter();
|
|
|
|
|
|
|
|
|
|
})();
|