Skip to content
Permalink
Browse files

Merge pull request #88 from opsmezzo/external-deps

External deps
  • Loading branch information...
mmalecki committed Jul 10, 2013
2 parents d181142 + e7062b7 commit f7902f956399c06ca3171a13a95165ba217a0dea
Showing with 59 additions and 1 deletion.
  1. +56 −0 lib/quill/composer/lifecycle.js
  2. +3 −1 package.json
@@ -13,6 +13,8 @@ var assert = require('assert'),
fstream = require('fstream'),
semver = require('semver'),
wtfos = require('wtfos'),
wtfpm = require('wtfpm'),
pma = require('pma'),
composer = require('./index'),
quill = require('../../quill'),
common = quill.common,
@@ -264,6 +266,60 @@ exports.run = function (action, systems, callback) {
? next(null, runlist)
: next(null, composer.runlist.localize(runlist, installed, quill.log));
},
function installExternalDeps(runlist, next) {
wtfpm(function (err, managers) {
if (err) {
return next(err);
}

var externalRunlists = {};

quill.log.info('External package managers found: ' + managers.join(', '));

runlist.forEach(function (system) {
if (!system.externalDependencies) {
return;
}

Object.keys(system.externalDependencies).filter(function (manager) {
return managers.indexOf(manager) !== -1;
}).forEach(function (manager) {
if (!externalRunlists[manager]) {
externalRunlists[manager] = [];
}

Array.prototype.push.apply(
externalRunlists[manager],
system.externalDependencies[manager]
);
});
});

async.forEachSeries(Object.keys(externalRunlists), function (manager, next) {
var command = pma(manager, 'install', externalRunlists[manager]),
app = command[0],
args = command.slice(1),
child;

quill.log.info('Installing with ' + manager + ': ' + externalRunlists[manager]);

child = spawn(app, args);

child.stdout.on('data', quill.emit.bind(quill, ['run', 'stdout'], ''));
child.stderr.on('data', quill.emit.bind(quill, ['run', 'stderr'], ''));

child.on('exit', function (code) {
if (code !== 0) {
return next(new Error(app + ' exited while installing ' + args));
}

next();
});
}, function (err) {
next(err, runlist);
});
});
},
composer.installed.add
], function (err) {
if (err) {
@@ -32,7 +32,9 @@
"system.json": "~1.2.2",
"union": "0.3.6",
"wtfos": "0.0.3",
"rimraf": "2.2.x"
"rimraf": "2.2.x",
"wtfpm": "1.0.x",
"pma": "1.0.x"
},
"devDependencies": {
"nock": "0.16.x",

0 comments on commit f7902f9

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.