diff options
author | Forrest L Norvell <ogd@aoaioxxysz.net> | 2015-01-08 14:37:26 -0800 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2015-01-08 23:49:03 +0100 |
commit | e79ccee1685393e4ec73746bac93835cbcf3a809 (patch) | |
tree | 304a1ddd59495b50a20d1b25c62da2a4519228db /deps/npm/lib/cache.js | |
parent | 156cd82ef4d2ff4fa291407de562c3a7c2386dc7 (diff) | |
download | android-node-v8-e79ccee1685393e4ec73746bac93835cbcf3a809.tar.gz android-node-v8-e79ccee1685393e4ec73746bac93835cbcf3a809.tar.bz2 android-node-v8-e79ccee1685393e4ec73746bac93835cbcf3a809.zip |
npm: upgrade to v2.1.18
PR-URL: https://github.com/iojs/io.js/pull/266
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'deps/npm/lib/cache.js')
-rw-r--r-- | deps/npm/lib/cache.js | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/deps/npm/lib/cache.js b/deps/npm/lib/cache.js index e1afb0d157..357063551d 100644 --- a/deps/npm/lib/cache.js +++ b/deps/npm/lib/cache.js @@ -82,6 +82,7 @@ var npm = require("./npm.js") , npa = require("npm-package-arg") , getStat = require("./cache/get-stat.js") , cachedPackageRoot = require("./cache/cached-package-root.js") + , mapToRegistry = require("./utils/map-to-registry.js") cache.usage = "npm cache add <tarball file>" + "\nnpm cache add <folder>" @@ -172,6 +173,7 @@ function normalize (args) { if (normalized.substr(-1) === "/") { normalized = normalized.substr(0, normalized.length - 1) } + normalized = path.normalize(normalized) log.silly("ls", "normalized", normalized) return normalized @@ -202,7 +204,7 @@ function clean (args, cb) { if (!args) args = [] - var f = path.join(npm.cache, path.normalize(normalize(args))) + var f = path.join(npm.cache, normalize(args)) if (f === npm.cache) { fs.readdir(npm.cache, function (er, files) { if (er) return cb() @@ -213,7 +215,10 @@ function clean (args, cb) { }) , rm, cb ) }) - } else rm(path.join(npm.cache, path.normalize(normalize(args))), cb) + } + else { + rm(f, cb) + } } // npm cache add <tarball-url> @@ -285,7 +290,12 @@ function add (args, where, cb) { addLocal(p, null, cb) break case "remote": - addRemoteTarball(p.spec, {name : p.name}, null, cb) + // get auth, if possible + mapToRegistry(spec, npm.config, function (err, uri, auth) { + if (err) return cb(err) + + addRemoteTarball(p.spec, {name : p.name}, null, auth, cb) + }) break case "git": addRemoteGit(p.spec, false, cb) |