Created
July 12, 2012 15:26
-
-
Save ovaillancourt/3098859 to your computer and use it in GitHub Desktop.
Run all
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
var env = require('./env'); | |
var cfg = env.cfg; | |
var cp = require('child_process'); | |
var fs = require('fs'); | |
var path = require('path'); | |
var processes = []; | |
//Loop through all the modules that must be executed and run them. | |
for( var i in cfg.executed ) { | |
var cur = path.join(cfg.basepath, cfg.executed[i]); | |
//Extract the entry point for each module to execute. | |
var pkg = fs.readFileSync(path.join(cur,'package.json'), 'utf8'); | |
var main = JSON.parse(pkg).main; | |
//Fork process to run entry points. | |
var proc = cp.fork(path.join(cur, main), [], { | |
cwd : cur, | |
env: { | |
NODE_ENV : process.env.NODE_ENV | |
} | |
}); | |
processes.push(proc); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment