diff options
author | isaacs <i@izs.me> | 2010-08-11 03:29:39 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2010-08-11 03:29:39 +0400 |
commit | 6cdf2fa6a46b37dbbdda6e9959f7e37f2e783933 (patch) | |
tree | 1cd23cc83a0607681ff782a0e26520575933d63a | |
parent | 8107dd17a2f5735cc5740749057df6be3ab591d7 (diff) |
Better: only do the wscript if it actually has a configure and build step, but fail if it fails.v0.1.25
-rw-r--r-- | lib/utils/read-json.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/utils/read-json.js b/lib/utils/read-json.js index daf6edf1f..7abe278ce 100644 --- a/lib/utils/read-json.js +++ b/lib/utils/read-json.js @@ -8,8 +8,10 @@ var fs = require("fs") function readJson (jsonFile, opts, cb) { if (typeof cb !== "function") cb = opts, opts = {} - fs.stat(path.join(path.dirname(jsonFile), "wscript"), function (er) { - opts.wscript = !er + fs.readFile(path.join(path.dirname(jsonFile), "wscript"), function (er, data) { + if (er) opts.wscript = false + else opts.wscript = data.toString().match(/(^|\n)def build\b/) + && data.toString().match(/(^|\n)def configure\b/) fs.readFile(jsonFile, processJson(opts, cb)) }) } @@ -86,7 +88,7 @@ function processObject (opts, cb) { return function (er, json) { var scripts = json.scripts = json.scripts || {} if (!scripts.install && !scripts.preinstall) { // don't fail if it was unexpected, just try. - scripts.preinstall = "node-waf configure build || true" + scripts.preinstall = "node-waf configure build" } } |