diff options
author | isaacs <i@izs.me> | 2010-05-02 04:02:41 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2010-05-02 04:10:33 +0400 |
commit | bbc2cd346302a53f852dbd4100b48defccbe2bae (patch) | |
tree | 1ea41643fb1ea2b6e22abb490b02d52e4d09e7a7 /lib | |
parent | 82676f554911b56267df8ca1ade8122f665f1384 (diff) |
Remove the 'conf' argument that all the commands were taking, now that they can just look at npm.config.get
Diffstat (limited to 'lib')
-rw-r--r-- | lib/activate.js | 4 | ||||
-rw-r--r-- | lib/adduser.js | 2 | ||||
-rw-r--r-- | lib/build.js | 4 | ||||
-rw-r--r-- | lib/config.js | 4 | ||||
-rw-r--r-- | lib/deactivate.js | 10 | ||||
-rw-r--r-- | lib/help.js | 2 | ||||
-rw-r--r-- | lib/install.js | 10 | ||||
-rw-r--r-- | lib/link.js | 15 | ||||
-rw-r--r-- | lib/ls.js | 2 | ||||
-rw-r--r-- | lib/publish.js | 6 | ||||
-rw-r--r-- | lib/tag.js | 2 | ||||
-rw-r--r-- | lib/uninstall.js | 2 |
12 files changed, 30 insertions, 33 deletions
diff --git a/lib/activate.js b/lib/activate.js index a3c9e9887..94b58b619 100644 --- a/lib/activate.js +++ b/lib/activate.js @@ -16,7 +16,7 @@ var mkdir = require("./utils/mkdir-p") module.exports = activate -function activate (args, flags, cb) { +function activate (args, cb) { // make sure package and version exists. // If there's already an active version, then deactivate it. // first, link .npm/{pkg}/{version} to .npm/{pkg}/{active} @@ -38,7 +38,7 @@ function activate (args, flags, cb) { // TODO: If "to" already exists, then do deactivate step implicitly chain - ( function (cb) { npm.commands.deactivate([pkg], {}, function () { cb() }) } + ( function (cb) { npm.commands.deactivate([pkg], function () { cb() }) } , function (cb) { fs.lstat(to, function (er, stat) { if (!er) return fs.readlink(to, function (active) { diff --git a/lib/adduser.js b/lib/adduser.js index 5f83228ea..39d4c0c2b 100644 --- a/lib/adduser.js +++ b/lib/adduser.js @@ -3,7 +3,7 @@ var registry = require('./utils/registry') , log = require("./utils/log") , base64 = require("./utils/base64") -var adduser = function (args, conf, callback) { +var adduser = function (args, callback) { var username = args.shift() , password = args.shift() , email = args.shift() diff --git a/lib/build.js b/lib/build.js index 86689124d..67a0930c2 100644 --- a/lib/build.js +++ b/lib/build.js @@ -25,7 +25,7 @@ module.exports = build // pkg is either a "package" folder, or a package.json data obj, or an // object that has the package.json data on the _data member. -function build (args, conf, cb) { +function build (args, cb) { var pkg = args[0] // if pkg isn't an object, then parse the package.json inside it, and build with that. @@ -96,7 +96,7 @@ function autoActivate (pkg, cb) { return cb() } log(pkg.name+" "+pkg.version, "activate") - npm.commands.activate([pkg.name, pkg.version], {}, cb) + npm.commands.activate([pkg.name, pkg.version], cb) }) } diff --git a/lib/config.js b/lib/config.js index 746e939cb..1e92eb710 100644 --- a/lib/config.js +++ b/lib/config.js @@ -1,5 +1,5 @@ -module.exports = config; +module.exports = config var ini = require("./utils/ini") , log = require("./utils/log") @@ -39,7 +39,7 @@ function set (key, val, cb) { if (val === "true") val = true if (val === "false") val = false - ini.set(key, val); + ini.set(key, val) ini.save(cb) } diff --git a/lib/deactivate.js b/lib/deactivate.js index 915469551..880cebcdf 100644 --- a/lib/deactivate.js +++ b/lib/deactivate.js @@ -9,9 +9,9 @@ var mkdir = require("./utils/mkdir-p") , lifecycle = require("./utils/lifecycle") , readJson = require("./utils/read-json") -module.exports = deactivate; +module.exports = deactivate -function deactivate (args, conf, cb) { +function deactivate (args, cb) { // run the "deactivate" lifecycle event // unlink the "active" folder // unlink the libs and main.js from the npm.root @@ -33,11 +33,11 @@ function deactivate (args, conf, cb) { , function (cb) { rm(activeMain, function () { cb() }) } , function (cb) { rm(activeLib, function () { cb() }) } , function (cb) { - if (!data.bin) return cb(); + if (!data.bin) return cb() chain(Object.getOwnPropertyNames(data.bin) .map(function (bin) { - return [rm, path.join(process.installPrefix, "bin", bin)]; - }).concat(cb)); + return [rm, path.join(process.installPrefix, "bin", bin)] + }).concat(cb)) } , [lifecycle, data, "postdeactivate"] , cb diff --git a/lib/help.js b/lib/help.js index 3adb54302..0e8482103 100644 --- a/lib/help.js +++ b/lib/help.js @@ -10,7 +10,7 @@ var npm = require("../npm") module.exports = help -function help (args, conf, cb) { +function help (args, cb) { var command = args.shift() fs.stat(path.join(__dirname, "../man/"+command+".1"), function (e, o) { if (e) { diff --git a/lib/install.js b/lib/install.js index db1806a6c..7f53e216f 100644 --- a/lib/install.js +++ b/lib/install.js @@ -14,7 +14,7 @@ var npm = require("../npm") module.exports = install // cb called with (er, ok) args. -function install (args, conf, cb) { +function install (args, cb) { var tarball = args.shift() // fetch the tarball if (tarball.match(/^https?:\/\//)) { @@ -51,7 +51,7 @@ function install (args, conf, cb) { } // move to ROOT/.npm/{name}/{version}/package , [moveIntoPlace, unpackTargetDir, pkg] - , [npm.commands, "build", [pkg], {}] + , [npm.commands, "build", [pkg]] , cb ) } @@ -85,7 +85,7 @@ function moveIntoPlace (dir, pkg, cb) { , [mkdir, target] , function (cb) { pkg._npmPackage = target = path.join(target, "package"); cb() } , function (cb) { fs.rename(dir, target, cb) } - , function (cb) { log("done", "moveIntoPlace"); cb() } + , [log, "done", "moveIntoPlace"] , cb ) } @@ -99,9 +99,9 @@ function fetchAndInstall (tarball, cb) { fetch(tarball, target, function (er, ok) { if (er) return cb(er, ok) chain - ( [install, [target], {}] + ( [install, [target]] // clean up - , function (cb) { log(target, "deleting"); cb() } + , [log, target, "deleting"] , [fs, "unlink", target] , cb ) diff --git a/lib/link.js b/lib/link.js index b7b9669c8..f627613ab 100644 --- a/lib/link.js +++ b/lib/link.js @@ -10,16 +10,13 @@ var npm = require("../npm") , mkdir = require("./utils/mkdir-p") , path = require("path") -module.exports = link; +module.exports = link -function link (args, conf, cb) { - log(args, "link") - log(conf, "link") - log(cb, "link") +function link (args, cb) { var folder = args.shift() // folder's root MUST contain a package.json // read that for package info, then link it in, clobbering if necessary. - if (folder.charAt(0) !== "/") folder = path.join(process.cwd(), folder); + if (folder.charAt(0) !== "/") folder = path.join(process.cwd(), folder) var pkg = {} , jsonFile = path.join(folder, "package.json") log(folder, "link") @@ -40,15 +37,15 @@ function link (args, conf, cb) { cb() })} , [link_, folder, pkg] - , [npm.commands, "build", [pkg], {}] + , [npm.commands, "build", [pkg]] , cb ) } function link_ (folder, pkg, cb) { - pkg = pkg && pkg._data || pkg; + pkg = pkg && pkg._data || pkg if (!pkg) cb(new Error( - "Invalid package data")); + "Invalid package data")) var pkgRoot = path.join(npm.dir, pkg.name, pkg.version) , pkgDir = path.join(pkgRoot, "package") chain @@ -7,7 +7,7 @@ var npm = require("../npm") , fs = require("fs") , log = require("./utils/log") -function ls (args, conf, cb) { +function ls (args, cb) { var pkg = args.shift() fs.readdir(npm.dir, function (er, packages) { if (er) return cb(er) diff --git a/lib/publish.js b/lib/publish.js index 298db4242..ee4e569ae 100644 --- a/lib/publish.js +++ b/lib/publish.js @@ -18,12 +18,12 @@ var fs = require("fs") , npm = require("../npm") , url = require("url") -function publish (args, conf, cb) { +function publish (args, cb) { var tarball = args.shift() , u = url.parse(tarball) if (!(u && u.protocol && u.host)) { - return cb(new Error("Invalid remote tarball url: "+tarball)); + return cb(new Error("Invalid remote tarball url: "+tarball)) } var targetDir = path.join(npm.tmp, @@ -48,5 +48,5 @@ function publish (args, conf, cb) { } function unpackTar (tarball, unpackTarget, cb) { - exec("tar", ["xzvf", tarball, "--strip", "1", "-C", unpackTarget], cb); + exec("tar", ["xzvf", tarball, "--strip", "1", "-C", unpackTarget], cb) } diff --git a/lib/tag.js b/lib/tag.js index 965dfeaf5..cf5ac6f18 100644 --- a/lib/tag.js +++ b/lib/tag.js @@ -3,6 +3,6 @@ // turns out tagging isn't very complicated // all the smarts are in the couch. -module.exports = function (args, conf, cb) { +module.exports = function (args, cb) { require("./utils/registry").tag(args.shift(), args.shift(), args.shift(), cb) } diff --git a/lib/uninstall.js b/lib/uninstall.js index 10951eb5f..fddffd8b8 100644 --- a/lib/uninstall.js +++ b/lib/uninstall.js @@ -15,7 +15,7 @@ var rm = require("./utils/rm-rf") , lifecycle = require("./utils/lifecycle") , semver = require("./utils/semver") -function uninstall (args, conf, cb) { +function uninstall (args, cb) { var name = args.shift() , version = args.shift() , pkgdir = path.join(npm.dir, name, version) |