Skip to content

Loading…

Fixes bug where the man field is an array #3234

Closed
wants to merge 1 commit into from

2 participants

@ralt

Fixes #2918

Couldn't run the tests because of failures in peer-deps though.

@domenic
npm member

Merged as 441b785, thanks!

@domenic domenic closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 10, 2013
  1. @ralt
This page is out of date. Refresh to see the latest.
Showing with 22 additions and 14 deletions.
  1. +22 −14 lib/unbuild.js
View
36 lib/unbuild.js
@@ -76,19 +76,27 @@ function rmMans (pkg, folder, parent, top, cb) {
}
var manRoot = path.resolve(npm.config.get("prefix"), "share", "man")
asyncMap(pkg.man, function (man, cb) {
- var parseMan = man.match(/(.*)\.([0-9]+)(\.gz)?$/)
- , stem = parseMan[1]
- , sxn = parseMan[2]
- , gz = parseMan[3] || ""
- , bn = path.basename(stem)
- , manDest = path.join( manRoot
- , "man"+sxn
- , (bn.indexOf(pkg.name) === 0 ? bn
- : pkg.name + "-" + bn)
- + "." + sxn + gz
- )
- gentlyRm( manDest
- , !npm.config.get("force") && folder
- , cb )
+ if (Array.isArray(man)) {
+ man.forEach(rm)
+ } else {
+ rm(man)
+ }
+
+ function rm(man) {
+ var parseMan = man.match(/(.*)\.([0-9]+)(\.gz)?$/)
+ , stem = parseMan[1]
+ , sxn = parseMan[2]
+ , gz = parseMan[3] || ""
+ , bn = path.basename(stem)
+ , manDest = path.join( manRoot
+ , "man"+sxn
+ , (bn.indexOf(pkg.name) === 0 ? bn
+ : pkg.name + "-" + bn)
+ + "." + sxn + gz
+ )
+ gentlyRm( manDest
+ , !npm.config.get("force") && folder
+ , cb )
+ }
}, cb)
}
Something went wrong with that request. Please try again.