Debian Codegraph @

util/build/transforms/report.js

raw symbols SCIP
1 define([
2 "../buildControl",
3 "../fileUtils",
4 "../fs"
5 ], function(bc, fileUtils, fs) {
6 return function(resource, callback) {
7 resource.reports.forEach(function(report){
8 // report is a hash of dir, filename, content; content may be a function
9 var
10 dest = fileUtils.computePath(fileUtils.catPath(report.dir, report.filename), bc.destBasePath),
11 content = report.content;
12 if(typeof content=="function"){
13 content = content(bc);
14 };
15 bc.waiting++; // matches *1*
16 fileUtils.ensureDirectory(fileUtils.getFilepath(dest));
17 fs.writeFile(dest, content, "utf8", function(err){
18 if(err){
19 //TODO
20 }
21 bc.passGate(); // matches *1*
22 });
23 });
24 return 0;
25 };
26 });