Modified the classnames for the test cases so that they work a bit better in Jenkins. Also adjusted the generate scripts to pull the latest commit sha from github.

This commit is contained in:
Spencer Alger
2013-11-14 09:45:19 -07:00
parent 39a3611849
commit 9ff959e1e6
6 changed files with 80 additions and 25 deletions

View File

@ -0,0 +1,64 @@
var https = require('https');
var lastCommitUrl = 'https://api.github.com/repos/elasticsearch/elasticsearch-rest-api-spec/commits/HEAD';
var fs = require('fs');
var lastRestSpecUpdateFile = __dirname + '/last_rest_spec_update.sha';
var lastRestSpecUpdate;
var updated;
if (fs.existsSync(lastRestSpecUpdateFile)) {
lastRestSpecUpdate = fs.readFileSync(lastRestSpecUpdateFile, 'utf8');
}
var req = https.get(lastCommitUrl, function (incoming) {
if (incoming.statusCode !== 200) {
req.abort();
console.error('request for last commit failed', incoming.statusCode, incoming.headers);
return;
}
var body = '';
incoming.on('data', onData);
incoming.on('end', onEnd);
function onData(chunk) {
body += chunk;
}
function onEnd() {
incoming.removeListener('data', onData);
incoming.removeListener('end', onEnd);
var _req = req;
req = null;
var resp;
try {
resp = JSON.parse(body);
} catch (e) {
console.log('unable to parse response from github');
_req.emit('ready');
return;
}
if (lastRestSpecUpdate === resp.sha) {
updated = false;
} else {
updated = true;
fs.writeFileSync(lastRestSpecUpdateFile, resp.sha);
}
_req.emit('ready');
}
});
module.exports = function (cb) {
function done() {
cb(null, updated);
}
if (req) {
req.on('ready', done);
} else {
process.nextTick(done);
}
};