Files
elasticsearch-js/grunt/config/esvm.js
Dominykas Blyžė f1de944809 Upgrade to lodash v4 (#660)
* npm install lodash-2

Someone handily published a lodash-2 v4.17.4 - it is exactly the same as lodash v4.17.4, so it is safe to use during the migration.

* use lodash-2 in tests

* update tests to split utils vs lodash

* remove Utils.nextTick usage

Utils.nextTick with a single argument is the same as process.nextTick

* lowercase utils

Because it seems that this is the coding style in this repo

* upgrade lodash in grunt/*

* keep lodash-2 as a dev dep for now

* use lodash-2 in scripts

* use snakeCase from utils

It was a mistake in my previous commit to not update this usage

* fix naming gruntUtils vs utils

As all three - gruntUtils, utils and lodash (_) are getting passed into templates, it makes sense to keep the naming consistent

* fix naming gruntUtils vs utils

As all three - gruntUtils, utils and lodash (_) are getting passed into templates, it makes sense to keep the naming consistent

* split utils vs lodash in scripts/generate

Also use lodash-2 where it is easy to do so

* use utils.get until lodash upgrade

* remove lodash.isempty; lodash-2 now used in prod (in src/lib/apis/ code)

* unbundle lodash from utils

* upgrade to lodash 4

* remove lodash.get and lodash.trimEnd

* clean out unused code

* clean out unused code

* fix a breaking change listed under "notable changes" rather than under "breaking changes"...
2018-05-14 11:37:23 -07:00

117 lines
2.3 KiB
JavaScript

var _ = require('lodash');
var gruntUtils = require('../utils');
var fromRoot = require('path').join.bind(null, __dirname, '..', '..');
var release = process.env.ES_RELEASE;
var ref = process.env.ES_REF;
var port = parseFloat(_.get(process.env, 'ES_PORT', 9400));
var host = _.get(process.env, 'ES_HOST', 'localhost');
var Version = require('../../scripts/Version');
var versionedOpts = [
{
version: '*',
directory: fromRoot('esvm'),
nodes: 1,
quiet: false,
logLevel: 'ERROR',
config: {
'path.data': fromRoot('esvm/data_dir'),
'node.name': 'elasticsearch_js_test_runner',
'cluster.name': 'elasticsearch_js_test_runners',
'http.port': port,
'network.host': host,
'discovery.zen.minimum_master_nodes': 1
}
},
{
version: '<3',
config: {
'discovery.zen.ping.multicast.enabled': false
}
},
{
version: '<1.6',
config: {
'discovery.zen.ping_timeout': 1
}
},
{
version: '^1.2 <1.6',
config: {
'node.bench': true,
'script.disable_dynamic': false
}
},
{
version: '>=1.6 <5.0',
config: {
'node.bench': true
}
},
{
version: '>2.0 <5.0',
config: {
'node.testattr': 'test'
}
},
{
version: '>=5.0',
config: {
'node.attr.testattr': 'test'
}
},
{
version: '>=1.6 <5.0',
config: {
'script.indexed': true
}
},
{
version: '>=1.6',
config: {
'script.inline': true,
'path.repo': process.env.ES_PATH_REPO || fromRoot('.es-snapshot-repos'),
'repositories.url.allowed_urls': 'http://snapshot.*'
}
}
];
// targets for each branch
gruntUtils.branches.forEach(function (branch) {
exports[branch] = {
options: Version.fromBranch(branch).mergeOpts(versionedOpts, {
branch: branch,
fresh: true
})
};
});
// ci target, based on env variables
(function () {
var v;
var opts = {
config: {
'http.port': port
}
};
if (release) {
v = new Version(String(release).replace(/^v/, ''));
opts.version = v.version;
}
else if (ref) {
v = new Version.fromBranch(String(ref).replace(/v?(\d+\.\d+)\..+/, '$1'));
opts.branch = ref;
opts.fresh = true;
}
else {
return;
}
exports.ci_env = {
options: v.mergeOpts(versionedOpts, opts)
};
}());