mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-10 10:17:11 +03:00
43 lines
1.2 KiB
JavaScript
Executable File
43 lines
1.2 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
var safeExec = require('./utils/child-process-wrapper.js').safeExec;
|
|
var exec = require('child_process').exec;
|
|
var path = require('path');
|
|
|
|
// Executes an array of commands one by one.
|
|
function executeCommands(commands, done, index) {
|
|
index = (index == undefined ? 0 : index);
|
|
if (index < commands.length)
|
|
safeExec(commands[index], executeCommands.bind(this, commands, done, index + 1));
|
|
else
|
|
done(null);
|
|
}
|
|
|
|
// Join multiple commands into one line.
|
|
function joinCommands() {
|
|
var commandSeparator = process.platform == 'win32' ? '&' : ';';
|
|
return Array.prototype.slice.call(arguments, 0).join(commandSeparator);
|
|
}
|
|
|
|
function checkDependencies() {
|
|
exec("cmake -h", function(error) {
|
|
if (error) {
|
|
console.error("Error: cmake is required to build Atom.")
|
|
process.exit(1);
|
|
}
|
|
});
|
|
}
|
|
|
|
var echoNewLine = process.platform == 'win32' ? 'echo.' : 'echo';
|
|
var commands = [
|
|
'git submodule --quiet sync',
|
|
'git submodule --quiet update --recursive --init',
|
|
joinCommands('cd vendor/apm', 'npm install --silent .'),
|
|
'npm install --silent vendor/apm',
|
|
echoNewLine,
|
|
'node node_modules/.bin/apm install --silent'
|
|
];
|
|
|
|
checkDependencies()
|
|
process.chdir(path.dirname(__dirname));
|
|
executeCommands(commands, process.exit);
|