Files
nexe/lib/monkeypatch.js
T
Craig Condon 932db9813d Merge pull request #44 from northshorenetworks/master
Add option to pass through CLI flags but ignore node and v8 flags
2014-02-28 19:31:00 -08:00

35 lines
685 B
JavaScript

var async = require("async"),
fs = require("fs"),
_log = require("./log");
var _log = require('./log');
module.exports = _monkeypatch;
/**
*/
function _monkeypatch (filePath, monkeyPatched, processor, complete) {
async.waterfall([
function read (next) {
fs.readFile(filePath, "utf8", next);
},
// TODO - need to parse gyp file - this is a bit hacker
function monkeypatch (content, next) {
if (monkeyPatched(content)) return complete();
_log("monkey patch %s", filePath);
processor(content, next);
},
function write (content, next) {
fs.writeFile(filePath, content, "utf8", next);
}
], complete);
}