Comparing version 0.0.6 to 0.1.0
@@ -90,14 +90,8 @@ #!/usr/bin/env node | ||
var versions = arguments[1] | ||
, current = arguments[2] | ||
if (versions.length > 0) { | ||
versions.forEach(function (version) { | ||
if (version == current) { | ||
cursor.green().write(' \u2022 ').reset() | ||
} else { | ||
cursor.write(' ') | ||
} | ||
cursor.write(version + '\n') | ||
cursor.write(' ' + version + '\n') | ||
}) | ||
} else { | ||
prog.info('No node development files installed. Use `node-gyp use x.x` to install a version.') | ||
prog.info('No node development files installed. Use `node-gyp install` to install a version.') | ||
} | ||
@@ -104,0 +98,0 @@ } else if (arguments.length >= 2) { |
@@ -22,22 +22,12 @@ | ||
if (gyp.opts.target) { | ||
// if '--target=x.x' was given, then ensure that version is installed | ||
// if --target was given, then ensure that version is installed | ||
version = parseFloat(gyp.opts.target) | ||
gyp.opts.ensure = true | ||
gyp.commands.install([ version ], next) | ||
gyp.verbose('compiling against --target node version', version) | ||
} else { | ||
// otherwise look up the 'current' version | ||
gyp.commands.current([], function (err, _version) { | ||
if (err) return callback(err) | ||
if (_version) { | ||
gyp.verbose('using "current" installed dev files. version', _version) | ||
version = _version | ||
next() | ||
} else { | ||
version = parseFloat(process.versions.node) | ||
gyp.verbose('no dev files installed, falling back to host node version', version) | ||
gyp.opts.ensure = true | ||
gyp.commands.install([ version ], next) | ||
} | ||
}) | ||
// if no --target was specified then use the current host node version | ||
version = parseFloat(process.versions.node) | ||
gyp.verbose('no --target version specified, falling back to host node version', version) | ||
} | ||
gyp.opts.ensure = true | ||
gyp.commands.install([ version ], next) | ||
@@ -44,0 +34,0 @@ /** |
@@ -150,5 +150,2 @@ | ||
async++ | ||
checkVersion(deref) | ||
if (version < 0.7) { | ||
@@ -176,2 +173,7 @@ // copy over gyp_addon, addon.gypi and common.gypi | ||
if (async === 0) { | ||
// no async tasks required | ||
cb() | ||
} | ||
function deref (err) { | ||
@@ -183,21 +185,2 @@ if (err) return cb(err) | ||
function checkVersion (done) { | ||
// now check the current version, if one isn't set, then "use" | ||
// this newly installed version | ||
gyp.verbose('now checking to see if a version needs to be set') | ||
gyp.commands.current([], function (err, cur) { | ||
if (err) return done(err) | ||
if (typeof cur == 'undefined') { | ||
gyp.verbose('there\'s no version currently in "use", setting to', version) | ||
gyp.commands.use([ version ], function (err) { | ||
if (err) return done(err) | ||
done() | ||
}) | ||
} else { | ||
gyp.verbose('already set to another version, forget about it', cur) | ||
done() | ||
} | ||
}) | ||
} | ||
function copyLegacy (done) { | ||
@@ -204,0 +187,0 @@ // node 0.6.x doesn't come with the needed addon.gypi or gyp_addon |
@@ -17,42 +17,19 @@ | ||
var nodeGypDir = path.join(process.env.HOME, '.node-gyp') | ||
, currentPath = path.join(nodeGypDir, 'current') | ||
gyp.verbose('using node-gyp dir', nodeGypDir) | ||
// Read the 'current' version, and readdir the node-gyp dir | ||
fs.readFile(currentPath, 'ascii', oncurrent) | ||
// readdir the node-gyp dir | ||
fs.readdir(nodeGypDir, onreaddir) | ||
var gotCurrent = false | ||
, gotReaddir = false | ||
, versions | ||
, current | ||
function oncurrent (err, _current) { | ||
function onreaddir (err, versions) { | ||
if (err && err.code != 'ENOENT') { | ||
return callback(err) | ||
} | ||
gotCurrent = true | ||
if (typeof _current == 'string') { | ||
current = parseFloat(_current.trim()) | ||
} | ||
if (gotReaddir) go() | ||
} | ||
function onreaddir (err, _versions) { | ||
if (err && err.code != 'ENOENT') { | ||
return callback(err) | ||
} | ||
gotReaddir = true | ||
if (_versions) { | ||
versions = _versions.filter(function (v) { return v != 'current' }) | ||
if (versions) { | ||
versions = versions.filter(function (v) { return v != 'current' }) | ||
} else { | ||
versions = [] | ||
} | ||
if (gotCurrent) go() | ||
callback(null, versions) | ||
} | ||
function go () { | ||
callback(null, versions, current) | ||
} | ||
} |
@@ -24,4 +24,2 @@ | ||
, 'remove' | ||
, 'use' | ||
, 'current' | ||
] | ||
@@ -28,0 +26,0 @@ , aliases = { |
@@ -37,40 +37,5 @@ | ||
// Go ahead and delete the dir | ||
rm(versionPath, afterRm) | ||
rm(versionPath, callback) | ||
}) | ||
function afterRm (err) { | ||
if (err) return callback(err) | ||
// Get the current version, if the match, then delete the version | ||
gyp.commands.current([], onCurrent) | ||
} | ||
function onCurrent (err, cur) { | ||
if (err) return callback(err) | ||
if (cur == version) { | ||
gyp.verbose('"current" version matches, removing `current` file') | ||
// Versions match, delete the 'current' file | ||
var currentPath = path.join(nodeGypDir, 'current') | ||
rm(currentPath, function (err) { | ||
if (err) return callback(err) | ||
// Now that there's no 'current', "use" the first installed version, if | ||
// available | ||
gyp.commands.list([], function (err, versions) { | ||
if (err) return callback(err) | ||
if (versions.length === 0) { | ||
gyp.verbose('no other dev versions installed to "use"') | ||
callback() | ||
return | ||
} | ||
gyp.verbose('changing the "use" other version', versions[0]) | ||
gyp.commands.use([ versions[0] ], function (err) { | ||
if (err) return callback(err) | ||
callback() | ||
}) | ||
}) | ||
}) | ||
} else { | ||
// no match, so were done | ||
callback() | ||
} | ||
} | ||
} |
{ "name": "node-gyp" | ||
, "description": "Node.js native addon build tool" | ||
, "keywords": [ "native", "addon", "module", "c", "c++", "bindings", "gyp" ] | ||
, "version": "0.0.6" | ||
, "version": "0.1.0" | ||
, "author": "Nathan Rajlich <nathan@tootallnate.net> (http://tootallnate.net)" | ||
@@ -6,0 +6,0 @@ , "repository": { "type": "git", "url": "git://github.com/TooTallNate/node-gyp.git" } |
@@ -56,3 +56,3 @@ node-gyp | ||
``` bash | ||
$ node-gyp configure --target=0.7 | ||
$ node-gyp configure | ||
``` | ||
@@ -128,2 +128,4 @@ | ||
* `install` - Installs node development files for the given version | ||
* `list` - Lists the currently installed node development file versions | ||
* `remove` - Removes a node development files for a given version | ||
@@ -130,0 +132,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
161
14
1
40606
16
852