summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/node-gyp/lib/node-gyp.js
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2012-04-17 17:14:25 -0700
committerisaacs <i@izs.me>2012-04-18 09:36:40 -0700
commitc8bbd13ea8d692f9f28f69cbb7ff321d7b998126 (patch)
treefb7074902b3332d2179c1e461277ada29016b531 /deps/npm/node_modules/node-gyp/lib/node-gyp.js
parentd8b33dc14787213a47a0f10f37137ec476d92952 (diff)
downloadnode-c8bbd13ea8d692f9f28f69cbb7ff321d7b998126.tar.gz
Upgrade npm to 1.1.17
Diffstat (limited to 'deps/npm/node_modules/node-gyp/lib/node-gyp.js')
-rw-r--r--deps/npm/node_modules/node-gyp/lib/node-gyp.js48
1 files changed, 44 insertions, 4 deletions
diff --git a/deps/npm/node_modules/node-gyp/lib/node-gyp.js b/deps/npm/node_modules/node-gyp/lib/node-gyp.js
index efa53435e..1b014e6cd 100644
--- a/deps/npm/node_modules/node-gyp/lib/node-gyp.js
+++ b/deps/npm/node_modules/node-gyp/lib/node-gyp.js
@@ -5,7 +5,7 @@ module.exports = exports = gyp
* Module dependencies.
*/
-var fs = require('fs')
+var fs = require('graceful-fs')
, path = require('path')
, nopt = require('nopt')
, child_process = require('child_process')
@@ -38,13 +38,24 @@ function gyp () {
function Gyp () {
var me = this
+ // set the dir where node-gyp dev files get installed
+ // TODO: make this configurable?
+ // see: https://github.com/TooTallNate/node-gyp/issues/21
+ var homeDir = process.env.HOME || process.env.USERPROFILE
+ this.devDir = path.resolve(homeDir, '.node-gyp')
+
this.commands = {}
+
commands.forEach(function (command) {
me.commands[command] = function (argv, callback) {
me.verbose('command', command, argv)
return require('./' + command)(me, argv, callback)
}
})
+
+ Object.keys(aliases).forEach(function (alias) {
+ me.commands[alias] = me.commands[aliases[alias]]
+ })
}
inherits(Gyp, EE)
exports.Gyp = Gyp
@@ -56,9 +67,14 @@ var proto = Gyp.prototype
proto.package = require('../package')
+/**
+ * nopt configuration definitions
+ */
+
proto.configDefs = {
help: Boolean // everywhere
, arch: String // 'configure'
+ , directory: String // bin
, msvs_version: String // 'configure'
, debug: Boolean // 'build'
, ensure: Boolean // 'install'
@@ -67,14 +83,33 @@ proto.configDefs = {
, proxy: String // 'install'
}
-proto.shorthands = {}
+/**
+ * nopt shorthands
+ */
+
+proto.shorthands = {
+ release: '--no-debug'
+ , C: '--directory'
+}
+
+/**
+ * Parses the given argv array and sets the 'opts',
+ * 'argv' and 'command' properties.
+ */
proto.parseArgv = function parseOpts (argv) {
this.opts = nopt(this.configDefs, this.shorthands, argv)
this.argv = this.opts.argv.remain.slice()
- var command = this.argv.shift()
- this.command = aliases[command] || command
+ var commands = []
+ this.argv.slice().forEach(function (arg) {
+ if (arg in this.commands) {
+ this.argv.splice(this.argv.indexOf(arg), 1)
+ commands.push(arg)
+ }
+ }, this)
+
+ this.todo = commands
}
/**
@@ -100,6 +135,11 @@ proto.info = function info () {
args.unshift('info')
this.emit.apply(this, args)
}
+proto.warn = function warn () {
+ var args = Array.prototype.slice.call(arguments)
+ args.unshift('warn')
+ this.emit.apply(this, args)
+}
proto.verbose = function verbose () {
var args = Array.prototype.slice.call(arguments)