From 85b9250b9a56f8b7ca5a817bd97da17f640a01cc Mon Sep 17 00:00:00 2001 From: Alex Whitman Date: Sat, 17 Aug 2013 12:04:38 +0100 Subject: [PATCH] Add `-t|--temp` option to specify location for node.js sources --- bin/nexe | 11 ++++++++--- lib/index.js | 6 +++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/bin/nexe b/bin/nexe index a36dfc9..ab76723 100755 --- a/bin/nexe +++ b/bin/nexe @@ -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); -}); \ No newline at end of file +}); diff --git a/lib/index.js b/lib/index.js index 7f3a6a0..cfd9e50 100644 --- a/lib/index.js +++ b/lib/index.js @@ -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 {