Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Commit

Permalink
s/sys/util/g finally
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Jul 20, 2011
1 parent 586f9ef commit 56341bb
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 24 deletions.
1 change: 0 additions & 1 deletion bin/npm.js
Expand Up @@ -6,7 +6,6 @@ log.info("ok", "it worked if it ends with")


var fs = require("graceful-fs") var fs = require("graceful-fs")
, path = require("path") , path = require("path")
, sys = require("../lib/utils/sys")
, npm = require("../npm") , npm = require("../npm")
, ini = require("../lib/utils/ini") , ini = require("../lib/utils/ini")
, rm = require("../lib/utils/rm-rf") , rm = require("../lib/utils/rm-rf")
Expand Down
4 changes: 2 additions & 2 deletions lib/utils/error-handler.js
Expand Up @@ -178,15 +178,15 @@ function exit (code) {
function writeLogFile (cb) { function writeLogFile (cb) {
var fs = require("graceful-fs") var fs = require("graceful-fs")
, fstr = fs.createWriteStream("npm-debug.log") , fstr = fs.createWriteStream("npm-debug.log")
, sys = require("util") , util = require("util")


log.history.forEach(function (m) { log.history.forEach(function (m) {
var lvl = log.LEVEL[m.level] var lvl = log.LEVEL[m.level]
, pref = m.pref ? " " + m.pref : "" , pref = m.pref ? " " + m.pref : ""
, b = lvl + pref + " " , b = lvl + pref + " "
, msg = typeof m.msg === "string" ? m.msg , msg = typeof m.msg === "string" ? m.msg
: msg instanceof Error ? msg.stack || msg.message : msg instanceof Error ? msg.stack || msg.message
: sys.inspect(m.msg, 0, 4) : util.inspect(m.msg, 0, 4)
fstr.write(new Buffer(b fstr.write(new Buffer(b
+(msg.split(/\n+/).join("\n"+b)) +(msg.split(/\n+/).join("\n"+b))
+ "\n")) + "\n"))
Expand Down
4 changes: 2 additions & 2 deletions lib/utils/exec.js
Expand Up @@ -5,7 +5,7 @@ exec.pipe = pipe


var log = require("./log") var log = require("./log")
, child_process = require("child_process") , child_process = require("child_process")
, sys = require("./sys") , util = require("util")
, npm = require("../../npm") , npm = require("../../npm")
, myUID = process.getuid ? process.getuid() : null , myUID = process.getuid ? process.getuid() : null
, myGID = process.getgid ? process.getgid() : null , myGID = process.getgid ? process.getgid() : null
Expand Down Expand Up @@ -58,7 +58,7 @@ function exec (cmd, args, env, takeOver, cwd, uid, gid, cb) {


function logger (d) { if (d) process.binding("stdio").writeError(d+"") } function logger (d) { if (d) process.binding("stdio").writeError(d+"") }
function pipe (cp1, cp2, cb) { function pipe (cp1, cp2, cb) {
sys.pump(cp1.stdout, cp2.stdin) util.pump(cp1.stdout, cp2.stdin)
var errState = null var errState = null
, buff1 = "" , buff1 = ""
, buff2 = "" , buff2 = ""
Expand Down
4 changes: 2 additions & 2 deletions lib/utils/fetch.js
Expand Up @@ -5,7 +5,7 @@
var http var http
, https , https
, url = require("url") , url = require("url")
, sys = require("./sys") , util = require("util")
, fs = require("graceful-fs") , fs = require("graceful-fs")
, get = require("./get") , get = require("./get")
, set = require("./set") , set = require("./set")
Expand Down Expand Up @@ -106,7 +106,7 @@ function fetchAndWrite (remote, fstr, headers, maxRedirects, redirects) {


if (response.statusCode !== 200) { if (response.statusCode !== 200) {
return fstr.emit("error", new Error(response.statusCode + " " + return fstr.emit("error", new Error(response.statusCode + " " +
(sys.inspect(response.headers)))) (util.inspect(response.headers))))
} }


// this is the one we want. // this is the one we want.
Expand Down
2 changes: 0 additions & 2 deletions lib/utils/ini-parser.js
@@ -1,5 +1,3 @@
var sys = require("./sys")

exports.parse = function parse (d) { exports.parse = function parse (d) {
var ini = {'-':{}} var ini = {'-':{}}
, section = '-' , section = '-'
Expand Down
1 change: 0 additions & 1 deletion lib/utils/ini.js
Expand Up @@ -30,7 +30,6 @@ Object.defineProperty(exports, "keys",


var fs = require("graceful-fs") var fs = require("graceful-fs")
, path = require("path") , path = require("path")
, sys = require("./sys")


, privateKey = null , privateKey = null
, log = require("./log") , log = require("./log")
Expand Down
6 changes: 3 additions & 3 deletions lib/utils/log.js
Expand Up @@ -72,7 +72,7 @@ log.waitForConfig = function () { waitForConfig = true }


// now the required stuff has been loaded, // now the required stuff has been loaded,
// so the transitive module dep will work // so the transitive module dep will work
var sys = require("./sys") var util = require("util")
, npm = require("../../npm") , npm = require("../../npm")
, net = require("net") , net = require("net")


Expand All @@ -83,7 +83,7 @@ Object.defineProperty(log, "level",
show = show.split(",")[0] show = show.split(",")[0]
if (!isNaN(show)) show = +show if (!isNaN(show)) show = +show
else if (!LEVEL.hasOwnProperty(show)) { else if (!LEVEL.hasOwnProperty(show)) {
sys.error("Invalid loglevel config: "+JSON.stringify(show)) util.error("Invalid loglevel config: "+JSON.stringify(show))
show = "info" show = "info"
} }
if (isNaN(show)) show = LEVEL[show] if (isNaN(show)) show = LEVEL[show]
Expand Down Expand Up @@ -147,7 +147,7 @@ npm.on("log", function (logData) {
} }
if (!isFinite(level) || level < show) return cb() if (!isFinite(level) || level < show) return cb()
if (typeof msg !== "string" && !(msg instanceof Error)) { if (typeof msg !== "string" && !(msg instanceof Error)) {
msg = sys.inspect(msg, 0, 4, true) msg = util.inspect(msg, 0, 4, true)
} }


// console.error("level, showlevel, show", level, show, (level >= show)) // console.error("level, showlevel, show", level, show, (level >= show))
Expand Down
4 changes: 2 additions & 2 deletions lib/utils/output.js
Expand Up @@ -9,7 +9,7 @@ var npm = require("../../npm")
, streams = {} , streams = {}
, ttys = {} , ttys = {}
, net = require("net") , net = require("net")
, sys = require("./sys") , util = require("util")


function doColor (stream) { function doColor (stream) {
var conf = npm.config.get("color") var conf = npm.config.get("color")
Expand Down Expand Up @@ -43,7 +43,7 @@ function write (args, stream, lf, cb) {
, colored = doColor(stream) , colored = doColor(stream)
msg = args.map(function (arg) { msg = args.map(function (arg) {
if (typeof arg !== "string") { if (typeof arg !== "string") {
return sys.inspect(arg, false, 5, colored) + "\n" return util.inspect(arg, false, 5, colored) + "\n"
} else { } else {
if (!colored) arg = arg.replace(/\033\[[0-9;]*m/g, '') if (!colored) arg = arg.replace(/\033\[[0-9;]*m/g, '')
return arg return arg
Expand Down
8 changes: 4 additions & 4 deletions lib/utils/proto-list.js
Expand Up @@ -60,9 +60,9 @@ ProtoList.prototype =
if (module === require.main) { if (module === require.main) {


var assert = require("assert") var assert = require("assert")
, sys = require("./sys") , util = require("util")


sys.debug("testing") util.debug("testing")
var p = new ProtoList var p = new ProtoList
p.push({foo:"bar"}) p.push({foo:"bar"})
p.push({}) p.push({})
Expand All @@ -88,5 +88,5 @@ assert.equal(p.get("foo"), undefined)






sys.debug("ok") util.debug("ok")
} }
2 changes: 0 additions & 2 deletions lib/utils/sys.js

This file was deleted.

4 changes: 2 additions & 2 deletions lib/view.js
Expand Up @@ -42,7 +42,7 @@ view.completion = function (opts, cb) {
var registry = require("./utils/npm-registry-client") var registry = require("./utils/npm-registry-client")
, ini = require("./utils/ini-parser") , ini = require("./utils/ini-parser")
, log = require("./utils/log") , log = require("./utils/log")
, sys = require("./utils/sys") , util = require("util")
, output , output
, npm = require("../npm") , npm = require("../npm")
, semver = require("semver") , semver = require("semver")
Expand Down Expand Up @@ -167,7 +167,7 @@ function printData (data, cb) {
fields.forEach(function (f) { fields.forEach(function (f) {
var d = cleanup(data[v][f]) var d = cleanup(data[v][f])
if (showVersions || showFields || typeof d !== "string") { if (showVersions || showFields || typeof d !== "string") {
d = sys.inspect(cleanup(data[v][f]), false, 5, true) d = util.inspect(cleanup(data[v][f]), false, 5, true)
} }
if (f && showFields) f += " = " if (f && showFields) f += " = "
if (d.indexOf("\n") !== -1) f += "\n" if (d.indexOf("\n") !== -1) f += "\n"
Expand Down
2 changes: 1 addition & 1 deletion test/common.js
@@ -1,6 +1,6 @@


// whatever, it's just tests. // whatever, it's just tests.
;["sys","assert"].forEach(function (thing) { ;["util","assert"].forEach(function (thing) {
thing = require("thing") thing = require("thing")
for (var i in thing) global[i] = thing[i] for (var i in thing) global[i] = thing[i]
} }
Expand Down

0 comments on commit 56341bb

Please sign in to comment.