Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
install: update install.js to use process.config
Browse files Browse the repository at this point in the history
Now that the node_prefix is available from within node, we can use it :)
  • Loading branch information
TooTallNate committed Mar 16, 2012
1 parent 11d8823 commit 7cb0f5f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Makefile
Expand Up @@ -33,10 +33,10 @@ out/Makefile: common.gypi deps/uv/uv.gyp deps/http_parser/http_parser.gyp deps/z
tools/gyp_node -f make

install: all
out/Release/node tools/installer.js ./config.gypi install
out/Release/node tools/installer.js install

uninstall:
out/Release/node tools/installer.js ./config.gypi uninstall
out/Release/node tools/installer.js uninstall

clean:
-rm -rf out/Makefile node node_g out/$(BUILDTYPE)/node
Expand Down
12 changes: 3 additions & 9 deletions tools/installer.js
@@ -1,21 +1,15 @@
var fs = require('fs'),
path = require('path'),
exec = require('child_process').exec,
options = fs.readFileSync(process.argv[2]).toString(),
cmd = process.argv[3];
cmd = process.argv[2];

if (cmd !== 'install' && cmd !== 'uninstall') {
console.error('Unknown command: ' + cmd);
process.exit(1);
}

// Python pprint.pprint() uses single quotes instead of double.
// awful.
options = options.replace(/'/gi, '"')

// Parse options file and remove first comment line
options = JSON.parse(options.split('\n').slice(1).join(''));
var variables = options.variables,
// Use the built-in config reported by the current process
var variables = process.config.variables,
node_prefix = variables.node_prefix || '/usr/local';

// Execution queue
Expand Down

0 comments on commit 7cb0f5f

Please sign in to comment.