pulsar/script/cibuild

41 lines
1.3 KiB
Plaintext
Raw Normal View History

#!/usr/bin/env node
2013-10-14 12:29:26 +04:00
var cp = require('./utils/child-process-wrapper.js');
var fs = require('fs');
var path = require('path');
2012-08-31 21:43:21 +04:00
2013-10-14 12:29:26 +04:00
process.chdir(path.dirname(__dirname));
2013-06-21 02:26:00 +04:00
2013-10-14 12:29:26 +04:00
if (process.platform != 'darwin')
throw new Error('cibuild can not run on ' + process.platform + ' yet!');
2013-06-21 02:26:00 +04:00
2013-10-14 12:29:26 +04:00
var homeDir = process.platform == 'win32' ? process.env.USERPROFILE : process.env.HOME;
2013-06-21 02:41:23 +04:00
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;
2013-10-14 12:29:26 +04:00
}
} catch(error) { }
2013-10-14 12:29:26 +04:00
}
2013-10-04 08:42:15 +04:00
2013-10-27 02:03:21 +04:00
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);
});
2013-10-27 02:07:20 +04:00
})();