From 70b51dfa6d13ac071d03601083a9d42d2ae06cb3 Mon Sep 17 00:00:00 2001 From: Spencer Alger Date: Wed, 5 Feb 2014 09:46:53 -0700 Subject: [PATCH] stopped using an empty suffix for test/branch stuff, so that things are less confusing down the road when versions change --- .gitignore | 1 + grunt/config/mochacov.js | 6 ++++-- grunt/config/run.js | 2 +- scripts/_utils.sh | 1 - scripts/generate/index.js | 3 ++- scripts/generate/js_api.js | 2 +- scripts/generate/yaml_tests.js | 11 +++++------ test/integration/yaml_suite/index.js | 1 - test/integration/yaml_suite/index_0_90.js | 1 - test/integration/yaml_suite/index_1_0.js | 1 - test/integration/yaml_suite/index_1_x.js | 1 - test/integration/yaml_suite/index_master.js | 1 - test/integration/yaml_suite/run.js | 3 +-- 13 files changed, 15 insertions(+), 19 deletions(-) delete mode 100644 test/integration/yaml_suite/index.js delete mode 100644 test/integration/yaml_suite/index_0_90.js delete mode 100644 test/integration/yaml_suite/index_1_0.js delete mode 100644 test/integration/yaml_suite/index_1_x.js delete mode 100644 test/integration/yaml_suite/index_master.js diff --git a/.gitignore b/.gitignore index a1cd486e0..39702844a 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ test/integration/yaml_suite/log ## generated files test/integration/yaml_suite/yaml_tests*.json +test/integration/yaml_suite/index*.js src/elasticsearch*/ junit-*.xml elasticsearch*.log diff --git a/grunt/config/mochacov.js b/grunt/config/mochacov.js index d287d869d..a6f6302d4 100644 --- a/grunt/config/mochacov.js +++ b/grunt/config/mochacov.js @@ -1,5 +1,7 @@ var root = require('find-root')(__dirname); -var utils = require(root + '/grunt/utils'); +var rootReq = function (p) { return require(require('path').resolve(root, p)); }; +var utils = rootReq('grunt/utils'); +var _ = rootReq('src/lib/utils'); var config = { unit: { @@ -29,7 +31,7 @@ var config = { utils.branches.forEach(function (branch) { config['integration_' + branch] = { - src: 'test/integration/yaml_suite/index' + utils.branchSuffix(branch) + '.js' + src: 'test/integration/yaml_suite/index' + _.snakeCase(branch) + '.js' }; }); diff --git a/grunt/config/run.js b/grunt/config/run.js index d05f2a3b4..ca19cbe26 100644 --- a/grunt/config/run.js +++ b/grunt/config/run.js @@ -31,7 +31,7 @@ var config = { }, clone_bower_repo: { exec: [ - 'test -d src/elasticsearch', + 'test -d src/bower_es_js', 'git clone git@github.com:elasticsearch/bower-elasticsearch-js.git src/bower_es_js' ].join(' || '), options: { diff --git a/scripts/_utils.sh b/scripts/_utils.sh index e432c974d..8a3dca11f 100644 --- a/scripts/_utils.sh +++ b/scripts/_utils.sh @@ -57,7 +57,6 @@ function manage_es { local ES_RELEASE=$3 local ROOT="$PWD" - local ES_SUBMODULE="$ROOT/src/elasticsearch" local SNAPSHOTS="$ROOT/.snapshots" local PIDS="$ROOT/.snapshots/pids" diff --git a/scripts/generate/index.js b/scripts/generate/index.js index a717740f8..9558897c1 100644 --- a/scripts/generate/index.js +++ b/scripts/generate/index.js @@ -30,6 +30,7 @@ var path = require('path'); var root = require('find-root')(__dirname); var fromRoot = path.join.bind(path, root); var utils = require(fromRoot('grunt/utils')); +var _ = require(fromRoot('src/lib/utils')); var esUrl = 'https://github.com/elasticsearch/elasticsearch.git'; var branches; @@ -55,7 +56,7 @@ function isDirectory(dir) { } function storeDir(branch) { - return fromRoot('src/elasticsearch' + utils.branchSuffix(branch)); + return fromRoot('src/elasticsearch_' + _.snakeCase(branch)); } function spawnStep(cmd, args, cwd) { diff --git a/scripts/generate/js_api.js b/scripts/generate/js_api.js index e49283e4d..72b7b1826 100644 --- a/scripts/generate/js_api.js +++ b/scripts/generate/js_api.js @@ -18,7 +18,7 @@ module.exports = function (branch, done) { var docVars; // slightly modified clone of apiSpec for the docs var branchSuffix = utils.branchSuffix(branch); - var esDir = fromRoot('src/elasticsearch' + branchSuffix); + var esDir = fromRoot('src/elasticsearch_' + _.snakeCase(branch)); var aliases; try { aliases = require('./aliases_' + _.snakeCase(branch)); diff --git a/scripts/generate/yaml_tests.js b/scripts/generate/yaml_tests.js index d693c50ae..1684473a4 100644 --- a/scripts/generate/yaml_tests.js +++ b/scripts/generate/yaml_tests.js @@ -8,11 +8,10 @@ module.exports = function (branch, done) { var chalk = require('chalk'); var path = require('path'); var fromRoot = path.join.bind(path, require('find-root')(__dirname)); - var utils = require(fromRoot('grunt/utils')); + var _ = require(fromRoot('src/lib/utils')); var tests = {}; // populated in readYamlTests - var branchSuffix = utils.branchSuffix(branch); - var esDir = fromRoot('src/elasticsearch' + branchSuffix); + var esDir = fromRoot('src/elasticsearch_' + _.snakeCase(branch)); // generate the yaml tests async.series([ @@ -44,14 +43,14 @@ module.exports = function (branch, done) { } function writeYamlTests(done) { - var testFile = fromRoot('test/integration/yaml_suite/yaml_tests' + branchSuffix + '.json'); - fs.writeFileSync(testFile, JSON.stringify(tests, null, ' '), 'utf8'); + var testFile = fromRoot('test/integration/yaml_suite/yaml_tests_' + _.snakeCase(branch) + '.json'); + fs.writeFileSync(testFile, JSON.stringify(tests, null, ' '), 'utf8'); console.log(chalk.white.bold('wrote') + ' YAML tests as JSON to', testFile); done(); } function writeTestIndex(done) { - var file = fromRoot('test/integration/yaml_suite/index' + branchSuffix + '.js'); + var file = fromRoot('test/integration/yaml_suite/index_' + _.snakeCase(branch) + '.js'); fs.writeFileSync(file, 'require(\'./run\')(\'' + branch + '\');', 'utf8'); console.log(chalk.white.bold('wrote') + ' YAML index to', file); done(); diff --git a/test/integration/yaml_suite/index.js b/test/integration/yaml_suite/index.js deleted file mode 100644 index d5a5156a6..000000000 --- a/test/integration/yaml_suite/index.js +++ /dev/null @@ -1 +0,0 @@ -require('./run')('0.90'); \ No newline at end of file diff --git a/test/integration/yaml_suite/index_0_90.js b/test/integration/yaml_suite/index_0_90.js deleted file mode 100644 index d5a5156a6..000000000 --- a/test/integration/yaml_suite/index_0_90.js +++ /dev/null @@ -1 +0,0 @@ -require('./run')('0.90'); \ No newline at end of file diff --git a/test/integration/yaml_suite/index_1_0.js b/test/integration/yaml_suite/index_1_0.js deleted file mode 100644 index 88c8a03e9..000000000 --- a/test/integration/yaml_suite/index_1_0.js +++ /dev/null @@ -1 +0,0 @@ -require('./run')('1.0'); \ No newline at end of file diff --git a/test/integration/yaml_suite/index_1_x.js b/test/integration/yaml_suite/index_1_x.js deleted file mode 100644 index e83cac0f4..000000000 --- a/test/integration/yaml_suite/index_1_x.js +++ /dev/null @@ -1 +0,0 @@ -require('./run')('1.x'); \ No newline at end of file diff --git a/test/integration/yaml_suite/index_master.js b/test/integration/yaml_suite/index_master.js deleted file mode 100644 index 71dbc08c3..000000000 --- a/test/integration/yaml_suite/index_master.js +++ /dev/null @@ -1 +0,0 @@ -require('./run')('master'); \ No newline at end of file diff --git a/test/integration/yaml_suite/run.js b/test/integration/yaml_suite/run.js index a123547dd..7aab3b77f 100644 --- a/test/integration/yaml_suite/run.js +++ b/test/integration/yaml_suite/run.js @@ -10,7 +10,6 @@ module.exports = function (branch) { var es = rootReq('src/elasticsearch'); var clientManager = require('./client_manager'); var argv = require('./argv'); - var branchSuffix = utils.branchSuffix(branch); describe('integration', function () { this.timeout(30000); @@ -30,7 +29,7 @@ module.exports = function (branch) { }, done); }); - var files = _.map(require('./yaml_tests' + branchSuffix + '.json'), function (docs, filename) { + var files = _.map(require('./yaml_tests_' + _.snakeCase(branch) + '.json'), function (docs, filename) { return new YamlFile(filename, docs); });