Skip to content

Commit

Permalink
Use rimraf instead of local thing
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Aug 7, 2011
1 parent 39e965d commit 963cdb2
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 116 deletions.
1 change: 0 additions & 1 deletion bin/npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ var fs = require("graceful-fs")
, path = require("path")
, npm = require("../npm")
, ini = require("../lib/utils/ini")
, rm = require("../lib/utils/rm-rf")
, errorHandler = require("../lib/utils/error-handler")

, configDefs = require("../lib/utils/config-defs")
Expand Down
2 changes: 1 addition & 1 deletion lib/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ var mkdir = require("./utils/mkdir-p.js")
, fetch = require("./utils/fetch.js")
, npm = require("../npm.js")
, fs = require("graceful-fs")
, rm = require("./utils/rm-rf.js")
, rm = require("rimraf")
, readJson = require("./utils/read-json.js")
, registry = require("./utils/npm-registry-client/index.js")
, log = require("./utils/log.js")
Expand Down
2 changes: 1 addition & 1 deletion lib/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var npm = require("../npm.js")
, chain = require("slide").chain
, path = require("path")
, relativize = require("./utils/relativize.js")
, rm = require("./utils/rm-rf.js")
, rm = require("rimraf")
, output = require("./utils/output.js")
, build = require("./build.js")

Expand Down
10 changes: 7 additions & 3 deletions lib/unbuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = unbuild
unbuild.usage = "npm unbuild <folder>\n(this is plumbing)"

var readJson = require("./utils/read-json.js")
, rm = require("./utils/rm-rf.js")
, rm = require("rimraf")
, npm = require("../npm.js")
, path = require("path")
, fs = require("graceful-fs")
Expand Down Expand Up @@ -53,7 +53,9 @@ function rmBins (pkg, folder, parent, top, cb) {
: path.resolve(parent, ".bin")
log.verbose([binRoot, pkg.bin], "binRoot")
asyncMap(Object.keys(pkg.bin), function (b, cb) {
rm(path.resolve(binRoot, b), !npm.config.get("force") && folder, cb)
rm( path.resolve(binRoot, b)
, { gently: !npm.config.get("force") && folder }
, cb )
}, cb)
}

Expand All @@ -72,6 +74,8 @@ function rmMans (pkg, folder, parent, top, cb) {
: pkg.name + "-" + bn)
+ "." + sxn + gz
)
rm(manDest, !npm.config.get("force") && folder, cb)
rm( manDest
, { gently: !npm.config.get("force") && folder }
, cb )
}, cb)
}
3 changes: 1 addition & 2 deletions lib/uninstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ uninstall.usage = "npm uninstall <name>[@<version> [<name>[@<version>] ...]"

uninstall.completion = require("./utils/completion/installed-shallow.js")

var rm = require("./utils/rm-rf.js")
, fs = require("graceful-fs")
var fs = require("graceful-fs")
, log = require("./utils/log.js")
, readJson = require("./utils/read-json.js")
, path = require("path")
Expand Down
6 changes: 2 additions & 4 deletions lib/utils/error-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = errorHandler
var cbCalled = false
, log = require("./log.js")
, npm = require("../../npm.js")
, rm = require("./rm-rf.js")
, rm = require("rimraf")
, constants = require("constants")
, itWorked = false
, path = require("path")
Expand Down Expand Up @@ -165,9 +165,7 @@ function exit (code) {
log.verbose([code, doExit], "exit")

if (code) writeLogFile(reallyExit)
else {
rm("npm-debug.log", function () { rm(npm.tmp, reallyExit) })
}
else rm("npm-debug.log", function () { rm(npm.tmp, reallyExit) })

function reallyExit() {
itWorked = !code
Expand Down
4 changes: 2 additions & 2 deletions lib/utils/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ link.ifExists = linkIfExists
var fs = require("graceful-fs")
, chain = require("slide").chain
, mkdir = require("./mkdir-p.js")
, rm = require("./rm-rf.js")
, rm = require("rimraf")
, log = require("./log.js")
, path = require("path")
, relativize = require("./relativize.js")
Expand All @@ -23,7 +23,7 @@ function link (from, to, gently, cb) {
if (npm.config.get("force")) gently = false
chain
( [ [fs, "stat", from]
, [rm, to, gently]
, [rm, to, { gently: gently }]
, [mkdir, path.dirname(to)]
, [fs, "symlink", relativize(from, to), to] ]
, cb)
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/npm-registry-client/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var npm = require("../../../npm.js")
, log = require("../log.js")
, ini = require("../ini.js")
, fs = require("graceful-fs")
, rm = require("../rm-rf.js")
, rm = require("rimraf")
, asyncMap = require("slide").asyncMap
, proxyify = require("../proxyify.js")
, warnedAuth = false
Expand Down
100 changes: 0 additions & 100 deletions lib/utils/rm-rf.js

This file was deleted.

2 changes: 1 addition & 1 deletion lib/utils/tar.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var FMODE = exports.FMODE = 0644
, path = require("path")
, log = require("./log.js")
, uidNumber = require("./uid-number.js")
, rm = require("./rm-rf.js")
, rm = require("rimraf")
, readJson = require("./read-json.js")
, relativize = require("./relativize.js")
, cache = require("../cache.js")
Expand Down

0 comments on commit 963cdb2

Please sign in to comment.