pulsar/script/cibuild
Kevin Sawicki 2a98ccec8d Don't require async before bootstrapping
async won't be available on the very first run of script/build
until it runs script/bootstrap for the first time so defer requiring
it until script/bootstrap completes.
2013-10-26 15:01:19 -07:00

41 lines
1.3 KiB
JavaScript
Executable File

#!/usr/bin/env node
var cp = require('./utils/child-process-wrapper.js');
var fs = require('fs');
var path = require('path');
process.chdir(path.dirname(__dirname));
if (process.platform != 'darwin')
throw new Error('cibuild can not run on ' + process.platform + ' yet!');
var homeDir = process.platform == 'win32' ? process.env.USERPROFILE : process.env.HOME;
function readEnvironmentVariables() {
var credentialsPath = '/var/lib/jenkins/config/atomcredentials';
try {
var credentials = fs.readFileSync(credentialsPath, 'utf8');
var lines = crendentials.trim().split('\n');
for (i in lines) {
var parts = lines[i].split('=');
var key = parts[0].trim();
var value = parts[1].trim().substr(1, parts[1].length - 2);
process.env[key] = value;
}
} catch(error) { }
}
readEnvironmentVariables()
cp.safeExec.bind(global, 'node script/bootstrap', function(error) {
if (error)
process.exit(1);
var async = require('async');
async.series([
require('rimraf').bind(global, path.join(homeDir, '.atom')),
cp.safeExec.bind(global, 'git clean -dff'),
cp.safeExec.bind(global, 'node node_modules/.bin/apm clean'),
cp.safeExec.bind(global, 'node node_modules/.bin/grunt ci --stack --no-color'),
], function(error) {
process.exit(error ? 1 : 0);
});
});