Add -t|--temp option to specify location for node.js sources

This commit is contained in:
Alex Whitman
2013-08-17 12:04:38 +01:00
parent 684b285217
commit ca9fced819
2 changed files with 11 additions and 6 deletions
+8 -3
View File
@@ -20,6 +20,11 @@ options('r', {
alias: 'runtime',
default: '0.8.21',
description: 'The node.js runtime to use'
}).
options('t', {
alias: 'temp',
default: '/tmp/nexe',
description: 'The path to store node.js sources'
});
var argv = cli.argv;
@@ -38,7 +43,7 @@ function toRelative(pt) {
require('../lib').compile({ input: toRelative(argv.i), output: toRelative(argv.o), runtime: argv.r }, function(error) {
require('../lib').compile({ input: toRelative(argv.i), output: toRelative(argv.o), runtime: argv.r, temp: toRelative(argv.t) }, function(error) {
if(error) console.log(error.message);
});
});
+3 -3
View File
@@ -27,7 +27,7 @@ exports.compile = function(args, next) {
*/
function() {
downloadNode(args.runtime, this);
downloadNode(args.runtime, args.temp, this);
},
/**
@@ -93,9 +93,9 @@ exports.compile = function(args, next) {
/**
*/
function downloadNode(version, next) {
function downloadNode(version, temp, next) {
var tmpPath = path.join("/tmp/nexe", "node-v" + version + ".tar.gz"),
var tmpPath = path.join(temp, "node-v" + version + ".tar.gz"),
srcDr = tmpPath.replace(/\.tar.gz$/, "");
try {