Skip to content

Commit

Permalink
Warnings and pointers for homebrew users.
Browse files Browse the repository at this point in the history
Warn if Cellar paths detected in __filename or execPath.

Echo a warning whenever bins/modules/man pages are installed to
someplace where they are unlikely to be found.
  • Loading branch information
isaacs committed Dec 12, 2010
1 parent 5aba569 commit 9d1ff59
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
11 changes: 9 additions & 2 deletions cli.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
#!/usr/bin/env node
;(function () { // wrapper in case we're in module_context mode
// don't assume that npm is installed in any particular spot, since this
// might conceivably be a bootstrap attempt.
var log = require("./lib/utils/log")
log.waitForConfig()
log.info("ok", "it worked if it ends with")

if (__filename.match(/Cellar\/npm\/[^\/]+\/libexec\/cli.js$/)
||process.execPath.match(/Cellar\/node\/[^\/]+\/bin\/node$/) {
log.warn("This program is not compatible with Homebrew."
+"\n brew rm npm ; brew rm node"
+"\nThen use one of the techniques in this gist instead:"
+"\nhttps://gist.github.com/579814", "brew incompatible")
}


var fs = require("./lib/utils/graceful-fs")
, path = require("path")
, sys = require("./lib/utils/sys")
Expand Down
11 changes: 6 additions & 5 deletions lib/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,7 @@ function linkMans (pkg, cb) {
exec("manpath", [], null, false, function (er, code, stdout, stderr) {
var manpath = er ? [] : stdout.trim().split(":")
if (manpath.indexOf(manroot) === -1) {
log.warn( "It seems " + manroot + " might not be visible to man\n"
+ "For greater justice, please add it to your man path\n"
+ "See: `man man`"
, pkg._id + " linkMans"
)
log.warn("man pages installing to " + manroot + ", outside MANPATH")
}
asyncMap(man, function (man, cb) {
var parseMan = man.match(/(.*)\.([0-9]+)(\.gz)?$/)
Expand Down Expand Up @@ -298,6 +294,11 @@ function linkMans (pkg, cb) {
function linkModules (pkg, target, cb) {
log.silly(pkg.modules, "linkModules")
log.verbose(target, "linkModules")
if (target === npm.root
&& !target.match(/node_modules$/)
&& -1 === require.paths.indexOf(target)) {
log.warn("modules installing to "+target+", outside NODE_PATH")
}
var mod = pkg.modules

// FIXME: remove in 0.3.0, and uncomment this functionality in
Expand Down

0 comments on commit 9d1ff59

Please sign in to comment.