Files
atom/script/bootstrap
2013-10-14 14:18:04 +08:00

38 lines
882 B
JavaScript
Executable File

#!/usr/bin/env node
var exec = require('child_process').exec;
var path = require('path');
function safeSpawn(command, options, callback) {
if (!callback) {
callback = options;
options = {};
}
var child = exec(command, options, function(error, stdout, stderr) {
if (error)
process.exit(error.code);
else
callback();
});
child.stderr.pipe(process.stderr);
child.stdout.pipe(process.stdout);
}
var apmDir = path.join('vendor', 'apm');
var commands = [
'git submodule --quiet sync',
'git submodule --quiet update --recursive --init',
'cd vendor/apm; npm install --silent .',
'npm install --silent vendor/apm',
'echo',
'node node_modules/.bin/apm install --silent',
];
var i = 0;
var startCommands = function() {
if (i < commands.length)
safeSpawn(commands[i++], startCommands);
else
process.exit(0);
}
startCommands();