Permalink
Browse files

Handle gh shorthands that are not in the registry

  • Loading branch information...
1 parent 9b44c76 commit ce14e1792c9e5151568da2575d6b8466593b6a3f @isaacs isaacs committed Mar 12, 2013
Showing with 11 additions and 9 deletions.
  1. +11 −9 lib/cache.js
View
@@ -573,15 +573,24 @@ function addNamed (name, x, data, cb_) {
})
}
-function addNameTag (name, tag, data, cb) {
- if (typeof cb !== "function") cb = data, data = null
+function addNameTag (name, tag, data, cb_) {
+ if (typeof cb_ !== "function") cb_ = data, data = null
log.info("addNameTag", [name, tag])
var explicit = true
if (!tag) {
explicit = false
tag = npm.config.get("tag")
}
+ function cb(er) {
+ // might be username/project
+ // in that case, try it as a github url.
+ if (er && tag.split("/").length === 2) {
+ return maybeGithub(tag, name, er, cb_)
+ }
+ return cb_(er)
+ }
+
registry.get(name, function (er, data, json, response) {
if (er) return cb(er)
engineFilter(data)
@@ -595,13 +604,6 @@ function addNameTag (name, tag, data, cb) {
}
er = installTargetsError(tag, data)
-
- // might be username/project
- // in that case, try it as a github url.
- if (tag.split("/").length === 2) {
- return maybeGithub(tag, name, er, cb)
- }
-
return cb(er)
})
}

0 comments on commit ce14e17

Please sign in to comment.