moved away from submodules

This commit is contained in:
Spencer Alger
2014-02-04 11:21:07 -07:00
parent 7268fdc412
commit 5ff4b6f855
9 changed files with 91 additions and 69 deletions

View File

@ -3,14 +3,16 @@ module.exports = function (branch, done) {
* Creates a JSON version of the YAML test suite that can be simply bundled for use in the browser.
*/
var jsYaml = require('js-yaml');
var fs = require('relative-fs').relativeTo(__dirname);
var fs = require('fs');
var async = require('async');
var chalk = require('chalk');
var _ = require('../../src/lib/utils');
var path = require('path');
var fromRoot = path.join.bind(path, require('find-root')(__dirname));
var _ = require(fromRoot('src/lib/utils'));
var tests = {}; // populated in readYamlTests
var branchSuffix = branch === 'master' ? '' : '_' + _.snakeCase(branch);
var esDir = fromRoot('src/elasticsearch' + branchSuffix);
// generate the yaml tests
async.series([
@ -19,7 +21,7 @@ module.exports = function (branch, done) {
], done);
function readYamlTests(done) {
var testDir = path.join(__dirname, '../../src/elasticsearch/rest-api-spec/test/');
var testDir = path.join(esDir, 'rest-api-spec/test/');
function readDirectories(dir) {
fs.readdirSync(dir).forEach(function (filename) {
@ -41,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');
var testFile = fromRoot('test/integration/yaml_suite/yaml_tests' + branchSuffix + '.json');
fs.writeFileSync(testFile, JSON.stringify(tests, null, ' '), 'utf8');
console.log(chalk.white.bold('wrote') + ' YAML tests as JSON to', testFile);
done();