switched submodule back to elasticsearch/elasticsearch, updated the generator to properly pull updates from the related branch

This commit is contained in:
Spencer Alger
2014-01-16 11:58:35 -07:00
parent 34f3d3ce28
commit 980163dfb2
12 changed files with 2318 additions and 792 deletions

View File

@ -91,5 +91,8 @@ module.exports = {
'/{index}/_stats/indexing',
'/{index}/_stats/search/{search_groups}',
'/{index}/_stats/fielddata/{fields}'
],
'cluster.createSnapshot': [
'/_snapshot/{repository}/{snapshot}/_create'
]
};

View File

@ -64,22 +64,27 @@ function spawn(cmd, args) {
return proc;
}
function generateBranch(branch, i, done) {
function initSubmodule(done) {
spawn('git', ['submodule', 'update', '--init'])
.on('exit', function (status) {
done(status ? new Error('Unable to init submodules.') : void 0);
});
return;
}
function fetch(done) {
spawn('git', ['submodule', 'foreach', 'git fetch origin'])
.on('exit', function (status) {
done(status ? new Error('Unable fetch lastest changes.') : void 0);
});
return;
}
function generateBranch(branch, done) {
async.series([
function (done) {
if (i === 0) {
spawn('git', ['submodule', 'update', '--init'])
.on('exit', function (status) {
done(status ? new Error('Unable to init submodules.') : void 0);
});
return;
}
done();
},
function (done) {
spawn('git', ['submodule', 'foreach', [
'git fetch origin master', 'git reset --hard', 'git clean -fdx', 'git checkout origin/' + branch
'git reset --hard', 'git clean -fdx', 'git checkout origin/' + branch
].join(' && ')])
.on('exit', function (status) {
done(status ? new Error('Unable to checkout ' + branch) : void 0);
@ -105,8 +110,10 @@ function generateBranch(branch, i, done) {
}
async.series([
async.apply(generateBranch, '0.90', 0),
async.apply(generateBranch, 'master', 1)
initSubmodule,
fetch,
async.apply(generateBranch, '0.90'),
async.apply(generateBranch, 'master')
], function (err) {
if (err) {
throw err;

View File

@ -6,6 +6,8 @@ module.exports = function (branch, done) {
var _ = require('../../src/lib/utils');
var fs = require('relative-fs').relativeTo(__dirname);
var async = require('async');
var chalk = require('chalk');
var path = require('path');
var templates = require('./templates');
var castExistsRE = /exists/;
var usesBulkBodyRE = /^(bulk|msearch)$/;
@ -26,7 +28,10 @@ module.exports = function (branch, done) {
ensureDocsDir,
formatDocVars,
writeMethodDocs
], done);
], function (err) {
console.log('');
done(err);
});
function readSpecFiles(done) {
var apiDir = require('path').join(__dirname, '../../src/elasticsearch/rest-api-spec/api/');
@ -73,7 +78,7 @@ module.exports = function (branch, done) {
function writeApiFile(done) {
var outputPath = require('path').join(__dirname, '../../src/lib/api' + branchSuffix + '.js');
fs.writeFileSync(outputPath, templates.apiFile(apiSpec));
console.log('wrote', apiSpec.actions.length, 'api actions to', outputPath);
console.log(chalk.white.bold('wrote'), apiSpec.actions.length, 'api actions to', outputPath);
done();
}
@ -107,10 +112,16 @@ module.exports = function (branch, done) {
}
function writeMethodDocs(done) {
var filename = path.resolve(__dirname, '../../docs/api_methods' + branchSuffix + '.asciidoc');
fs.writeFile(
'../../docs/api_methods' + branchSuffix + '.asciidoc',
filename,
templates.apiMethods(docVars),
done
function (err) {
if (!err) {
console.log(chalk.white.bold('wrote'), branch + ' method docs to', filename);
}
done(err);
}
);
}

View File

@ -5,6 +5,7 @@ module.exports = function (branch, done) {
var jsYaml = require('js-yaml');
var fs = require('relative-fs').relativeTo(__dirname);
var async = require('async');
var chalk = require('chalk');
var _ = require('../../src/lib/utils');
var path = require('path');
var tests = {}; // populated in readYamlTests
@ -42,7 +43,7 @@ module.exports = function (branch, done) {
function writeYamlTests(done) {
var testFile = require('path').resolve(__dirname, '../../test/integration/yaml_suite/yaml_tests' + branchSuffix + '.json');
fs.writeFileSync(testFile, JSON.stringify(tests, null, ' '), 'utf8');
console.log('wrote YAML tests as JSON to', testFile);
console.log(chalk.white.bold('wrote') + ' YAML tests as JSON to', testFile);
done();
}
};