summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/npm-registry-client/lib/get.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/npm-registry-client/lib/get.js')
-rw-r--r--deps/npm/node_modules/npm-registry-client/lib/get.js24
1 files changed, 12 insertions, 12 deletions
diff --git a/deps/npm/node_modules/npm-registry-client/lib/get.js b/deps/npm/node_modules/npm-registry-client/lib/get.js
index 835eb4ce5..584a986b5 100644
--- a/deps/npm/node_modules/npm-registry-client/lib/get.js
+++ b/deps/npm/node_modules/npm-registry-client/lib/get.js
@@ -12,10 +12,10 @@ function get (uri, timeout, nofollow, staleOk, cb) {
if (typeof cb !== "function") cb = timeout, timeout = -1
if (typeof cb !== "function") cb = version, version = null
- timeout = Math.min(timeout, this.cacheMax)
- timeout = Math.max(timeout, this.cacheMin)
+ timeout = Math.min(timeout, this.conf.get('cache-max') || 0)
+ timeout = Math.max(timeout, this.conf.get('cache-min') || Infinity)
- if (!this.registry) timeout = Infinity
+ if (!this.conf.get('registry')) timeout = Infinity
if ( process.env.COMP_CWORD !== undefined
&& process.env.COMP_LINE !== undefined
@@ -29,7 +29,7 @@ function get (uri, timeout, nofollow, staleOk, cb) {
return requestAll.call(this, cb)
}
- var cache = path.join(this.cache, uri, ".cache.json")
+ var cache = path.join(this.conf.get('cache'), uri, ".cache.json")
fs.stat(cache, function (er, stat) {
if (!er) fs.readFile(cache, function (er, data) {
try { data = JSON.parse(data) }
@@ -41,9 +41,9 @@ function get (uri, timeout, nofollow, staleOk, cb) {
}
function requestAll (cb) {
- var cache = path.join(this.cache, "/-/all", ".cache.json")
+ var cache = path.join(this.conf.get('cache'), "/-/all", ".cache.json")
- mkdir(path.join(this.cache, "-", "all"), function (er) {
+ mkdir(path.join(this.conf.get('cache'), "-", "all"), function (er) {
fs.readFile(cache, function (er, data) {
if (er) return requestAll_.call(this, 0, {}, cb)
try {
@@ -74,7 +74,7 @@ function requestAll_ (c, data, cb) {
uri = "/-/all"
}
- var cache = path.join(this.cache, "-/all", ".cache.json")
+ var cache = path.join(this.conf.get('cache'), "-/all", ".cache.json")
this.request('GET', uri, function (er, updates, _, res) {
if (er) return cb(er, data)
var headers = res.headers
@@ -143,20 +143,20 @@ function get_ (uri, timeout, cache, stat, data, nofollow, staleOk, cb) {
}
function saveToCache (cache, data, saved) {
- if (this.cacheStat) {
- var cs = this.cacheStat
+ if (this._cacheStat) {
+ var cs = this._cacheStat
return saveToCache_.call(this, cache, data, cs.uid, cs.gid, saved)
}
- fs.stat(this.cache, function (er, st) {
+ fs.stat(this.conf.get('cache'), function (er, st) {
if (er) {
return fs.stat(process.env.HOME || "", function (er, st) {
// if this fails, oh well.
if (er) return saved()
- this.cacheStat = st
+ this._cacheStat = st
return saveToCache.call(this, cache, data, saved)
}.bind(this))
}
- this.cacheStat = st || { uid: null, gid: null }
+ this._cacheStat = st || { uid: null, gid: null }
return saveToCache.call(this, cache, data, saved)
}.bind(this))
}