diff options
author | isaacs <i@izs.me> | 2010-08-24 10:42:36 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2010-08-24 10:42:36 +0400 |
commit | efb145ad4563ffd7ba94cd10d999948bb236bab0 (patch) | |
tree | b0784e30792802f1bedc430d94a5c8846c0af79f | |
parent | 98fa3f2b83c57f25045a3fb1a076da4f160d7c7d (diff) |
lob getter
-rw-r--r-- | lib/adduser.js | 1 | ||||
-rw-r--r-- | lib/build.js | 5 | ||||
-rw-r--r-- | lib/utils/registry/adduser.js | 10 | ||||
-rw-r--r-- | lib/utils/registry/request.js | 15 |
4 files changed, 15 insertions, 16 deletions
diff --git a/lib/adduser.js b/lib/adduser.js index ac612c110..a8a61eab8 100644 --- a/lib/adduser.js +++ b/lib/adduser.js @@ -43,7 +43,6 @@ function adduser (args, cb) { ini.set("_password", u.p, "user") ini.set("email", u.e, "user") log("Authorized user " + u.u, "adduser") - log.warn("Remember to clear your shell history!", "adduser") ini.save(cb) }) }) diff --git a/lib/build.js b/lib/build.js index 784a62544..dcca4cb89 100644 --- a/lib/build.js +++ b/lib/build.js @@ -183,6 +183,7 @@ function dependencyLink (pkg, cb) { // shim {target}/{module-name} to ROOT/.npm/{name}/{version}/package/{module-path} module.libWarning = false function linkModules (pkg, target, cb) { + log.verbose([ pkg, target ].join("\n"), "linkModules") var mod = pkg.modules if (!mod) { var lib = pkg.directories && pkg.directories.lib || pkg.lib @@ -211,7 +212,7 @@ function linkModules (pkg, target, cb) { // shim ROOT/{name}-{version}/**/*.js to ROOT/.npm/{name}/{version}/{lib}/**/*.js function linkDefaultModules(pkg, lib, target, cb) { - log.warn("linking default modules", pkg._id) + log.verbose("linking default modules", pkg._id) var pkgDir = path.join(npm.dir, pkg.name, pkg.version, "package") , libDir = path.join(pkgDir, lib) @@ -250,7 +251,7 @@ function walk (dir, cb) { function linkBins (pkg, cb) { if (!pkg.bin) return cb() - log(pkg._id, "linkBins") + log.verbose(pkg._id, "linkBins") var binroot = npm.config.get("binroot") , dep = path.join(npm.dir, pkg.name, pkg.version, "dependencies") if (!binroot) return cb() diff --git a/lib/utils/registry/adduser.js b/lib/utils/registry/adduser.js index b35c87b38..1830867f7 100644 --- a/lib/utils/registry/adduser.js +++ b/lib/utils/registry/adduser.js @@ -30,7 +30,7 @@ function adduser (username, password, email, cb) { , roles : [] } cb = done(cb) - log(userobj, "before first PUT") + log.verbose(userobj, "before first PUT") request.PUT ( '/adduser/org.couchdb.user:'+encodeURIComponent(username) , userobj @@ -47,13 +47,13 @@ function adduser (username, password, email, cb) { if (!error || !response || response.statusCode !== 409) { return cb(error, data, json, response) } - log("update existing user", "adduser") + log.verbose("update existing user", "adduser") return request.GET ( '/getuser/org.couchdb.user:'+encodeURIComponent(username) , function (er, data, json, response) { userobj._rev = data._rev userobj.roles = data.roles - log(userobj, "userobj") + log.verbose(userobj, "userobj") request.PUT ( '/adduser/org.couchdb.user:'+encodeURIComponent(username) + "/-rev/" + userobj._rev @@ -70,8 +70,8 @@ function done (cb) { return function (error, data, json, response) { if (!error && (!response || response.statusCode === 201)) { return cb(error, data, json, response) } - log(response && response.statusCode, "response") - log(error, "error") + log.verbose(response && response.statusCode, "adduser response") + log.error(error, "adduser") return cb(new Error( (response && response.statusCode) + " "+ "Could not create user "+error+'\n'+JSON.stringify(data))) }} diff --git a/lib/utils/registry/request.js b/lib/utils/registry/request.js index 05c645357..96070c5ec 100644 --- a/lib/utils/registry/request.js +++ b/lib/utils/registry/request.js @@ -14,7 +14,7 @@ var npm = require("../../../npm") , fs = require("../graceful-fs") function request (method, where, what, cb) { - log(where||"/", method) + log.verbose(where||"/", method) if ( typeof what === "function" && !cb ) cb = what, what = null try { reg() } @@ -35,7 +35,6 @@ function request (method, where, what, cb) { , path = proxy ? u.href : u.pathname if (authRequired && !auth) { - log(auth, "auth") return cb(new Error( "Cannot insert data into the registry without authorization\n" + "See: npm-adduser(1)")) @@ -49,7 +48,7 @@ function request (method, where, what, cb) { if (auth) headers.authorization = "Basic " + auth if (what) { if (what instanceof File) { - log(what.name, "uploading") + log.verbose(what.name, "uploading") headers["content-type"] = "application/octet-stream" } else { what = JSON.stringify(what) @@ -76,7 +75,7 @@ function request (method, where, what, cb) { parsed = JSON.parse(data) } catch (ex) { ex.message += "\n" + data - log("error parsing json", "registry") + log.error("error parsing json", "registry") return cb(ex, null, data, response) } if (parsed && parsed.error) { @@ -92,7 +91,7 @@ function request (method, where, what, cb) { var size = 1024 // , b = new Buffer(what.length) , remaining = what.length - log(what.length, "bytes") + log.verbose(what.length, "bytes") ;(function W () { var b = new Buffer(size) try { @@ -112,8 +111,8 @@ function request (method, where, what, cb) { } if (!remaining) { request.end() - log(what.name, "written to uploading stream") - log("Not done yet! If it hangs/quits now, it didn't work.", "upload") + log.verbose(what.name, "written to uploading stream") + log.verbose("Not done yet! If it hangs/quits now, it didn't work.", "upload") return } // wtf!? No bytes read, but also bytes remaining. @@ -144,7 +143,7 @@ function File (name, cb) { if (f.loaded) return cb(null, f) fs.stat(f.name, function (er, stat) { if (er) return log.er(cb, "doesn't exist "+f.name)(er) - log(stat, "stat "+name) + log.verbose(stat, "stat "+name) f.length = stat.size fs.open(f.name, "r", 0666, function (er, fd) { if (er) return log.er(cb, "Error opening "+f.name)(er) |