| 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 |
|
| 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++; |
| 16 |
fileUtils.ensureDirectory(fileUtils.getFilepath(dest)); |
| 17 |
fs.writeFile(dest, content, "utf8", function(err){ |
| 18 |
if(err){ |
| 19 |
|
| 20 |
} |
| 21 |
bc.passGate(); |
| 22 |
}); |
| 23 |
}); |
| 24 |
return 0; |
| 25 |
}; |
| 26 |
}); |