diff options
author | isaacs <i@izs.me> | 2012-09-25 08:28:55 -0700 |
---|---|---|
committer | isaacs <i@izs.me> | 2012-09-25 08:29:05 -0700 |
commit | 83d39c8d535559bb7287c2a670ba256c5e9cb627 (patch) | |
tree | 9c23ad63d4f0ea29192b65da76a11cf95c1fbd1d /deps/npm/lib/bugs.js | |
parent | d5e9895ce0fb708e35216753999b951bae571f39 (diff) | |
download | node-new-83d39c8d535559bb7287c2a670ba256c5e9cb627.tar.gz |
npm: upgrade to 1.1.62
Diffstat (limited to 'deps/npm/lib/bugs.js')
-rw-r--r-- | deps/npm/lib/bugs.js | 40 |
1 files changed, 11 insertions, 29 deletions
diff --git a/deps/npm/lib/bugs.js b/deps/npm/lib/bugs.js index 3f9de12315..fa66dc3e41 100644 --- a/deps/npm/lib/bugs.js +++ b/deps/npm/lib/bugs.js @@ -7,6 +7,7 @@ var exec = require("./utils/exec.js") , npm = require("./npm.js") , registry = npm.registry , log = require("npmlog") + , opener = require("opener") bugs.completion = function (opts, cb) { if (opts.conf.argv.remain.length > 2) return cb() @@ -22,41 +23,22 @@ function bugs (args, cb) { if (er) return cb(er) var bugs = d.bugs , repo = d.repository || d.repositories + , url if (bugs) { - if (typeof bugs === "string") return open(bugs, cb) - if (bugs.url) return open(bugs.url, cb) - } - if (repo) { + url = (typeof bugs === "string") ? bugs : bugs.url + } else if (repo) { if (Array.isArray(repo)) repo = repo.shift() if (repo.hasOwnProperty("url")) repo = repo.url log.verbose("repository", repo) if (repo && repo.match(/^(https?:\/\/|git(:\/\/|@))github.com/)) { - return open(repo.replace(/^git(@|:\/\/)/, "http://") - .replace(/^https?:\/\/github.com:/, "github.com/") - .replace(/\.git$/, '')+"/issues", cb) + url = repo.replace(/^git(@|:\/\/)/, "https://") + .replace(/^https?:\/\/github.com:/, "https://github.com/") + .replace(/\.git$/, '')+"/issues" } } - return open("http://search.npmjs.org/#/" + d.name, cb) + if (!url) { + url = "https://npmjs.org/package/" + d.name + } + opener(url, { command: npm.config.get("browser") }, cb) }) } - -function open (url, cb) { - var args = [url] - , browser = npm.config.get("browser") - - if (process.platform === "win32" && browser === "start") { - args = [ "/c", "start" ].concat(args) - browser = "cmd" - } - - if (!browser) { - var er = ["the 'browser' config is not set. Try doing this:" - ," npm config set browser google-chrome" - ,"or:" - ," npm config set browser lynx"].join("\n") - return cb(er) - } - - exec(browser, args, process.env, false, function () {}) - cb() -} |