Skip to content
Browse files

[fix] better handling of the various "engine" properties in the wild

  • Loading branch information...
1 parent cac5af8 commit d453c2c8a8920753c426734eda8f4b4e48a4e6ef @bmeck bmeck committed Jan 12, 2012
Showing with 11 additions and 3 deletions.
  1. +6 −1 lib/haibu.js
  2. +4 −1 lib/haibu/common/chroot-npm-install.js
  3. +1 −1 lib/haibu/plugins/chroot.js
View
7 lib/haibu.js
@@ -51,10 +51,15 @@ haibu.getSpawnOptions = function getSpawnOptions (app) {
command = 'node',
nodeDir,
version,
+ engine,
cwd;
if (haibu.nodeVersions) {
- version = semver.maxSatisfying(haibu.nodeVersions, (app.engine || {}).node);
+ engine = (app.engines || app.engine || {node: app.engine}).node;
+ if (typeof engine !== 'string') {
+ engine = null;
+ }
+ version = semver.maxSatisfying(haibu.nodeVersions, engine);
nodeDir = path.join(haibu.engineDir, version);
}
View
5 lib/haibu/common/chroot-npm-install.js
@@ -11,7 +11,10 @@ var daemon = require('daemon'),
daemon.chroot(chrootDir);
var args = ['install'];
-if (process.installPrefix) {
+if (process.env.NODE_PREFIX) {
+ args.push('--prefix', process.env.NODE_PREFIX);
+}
+else if (process.installPrefix) {
args.push('--prefix', process.installPrefix);
}
View
2 lib/haibu/plugins/chroot.js
@@ -144,7 +144,7 @@ haibu.common.npm.install = function (dir, target, callback) {
args = [path.join(__dirname, '..', 'common', 'chroot-npm-install.js'), chrootDir, appDir];
haibu.emit('npm:install:args', 'info', { args: args })
- chroot = spawn('node', args, haibu.getSpawnOptions(target));
+ chroot = spawn(options.command || 'node', args, haibu.getSpawnOptions(target));
chroot.stdout.on('data', function (data) {
haibu.emit('npm:install:stdout', 'info', {
data: data+'',

0 comments on commit d453c2c

Please sign in to comment.
Something went wrong with that request. Please try again.