932db9813d
Add option to pass through CLI flags but ignore node and v8 flags
35 lines
685 B
JavaScript
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);
|
|
} |