Manually incrementing the hardcoded master version to 6.0 (#535)

* Manually incrementing the hardcoded master version to 6.0

* Adding branch_versions to the package.json

* Modifying the way branch_versions work
This commit is contained in:
Brandon Kobel
2017-05-01 18:56:22 -04:00
committed by spalger
parent 63450501de
commit e9c34d8d4f
4 changed files with 45 additions and 9 deletions

View File

@ -36,7 +36,10 @@
"unstable_es_branches": [
"5.x",
"master"
]
],
"branch_versions": {
"master": "6.0"
}
},
"devDependencies": {
"@spalger/eslint-config-personal": "^0.4.0",

View File

@ -1,6 +1,7 @@
var _ = require('lodash');
var pkg = require('../package.json');
var branches = pkg.config.supported_es_branches;
var branchVersions = pkg.config.branch_versions;
var semver = require('semver');
var maxMinorVersion = function (majorV) {
@ -18,14 +19,14 @@ function Version(v) {
Version.fromBranch = function (branch) {
var m;
// master === the highest version number
if (branch === 'master') return new Version('5.0.0');
var branchVersion = branchVersions[branch];
var versionString = branchVersion ? branchVersion : branch;
// n.m -> n.m.0
if (m = branch.match(/^\d+\.\d+$/)) return new Version(branch + '.0');
if (m = versionString.match(/^\d+\.\d+$/)) return new Version(versionString + '.0');
// n.x -> n.(maxVersion + 1).0
if (m = branch.match(/^(\d+)\.x$/i)) return maxMinorVersion(m[1]).increment('minor');
if (m = versionString.match(/^(\d+)\.x$/i)) return maxMinorVersion(m[1]).increment('minor');
throw new Error('unable to convert branch "' + branch + '" to semver');
};

View File

@ -11,7 +11,7 @@ var ca = require('../client_action').makeFactoryWithModifier(function (spec) {
var namespace = require('../client_action').namespaceFactory;
var api = module.exports = {};
api._namespaces = ['cat', 'cluster', 'indices', 'ingest', 'nodes', 'snapshot', 'tasks'];
api._namespaces = ['cat', 'cluster', 'indices', 'ingest', 'nodes', 'remote', 'snapshot', 'tasks'];
/**
* Perform a [bulk](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/docs-bulk.html) request
@ -5990,6 +5990,19 @@ api.reindexRethrottle = ca({
method: 'POST'
});
api.remote = namespace();
/**
* Perform a [remote.info](http://www.elastic.co/guide/en/elasticsearch/reference/master/remote-info.html) request
*
* @param {Object} params - An object with parameters used to carry out this action
*/
api.remote.prototype.info = ca({
url: {
fmt: '/_remote/info'
}
});
/**
* Perform a [renderSearchTemplate](http://www.elasticsearch.org/guide/en/elasticsearch/reference/5.x/search-template.html) request
*

View File

@ -11,7 +11,7 @@ var ca = require('../client_action').makeFactoryWithModifier(function (spec) {
var namespace = require('../client_action').namespaceFactory;
var api = module.exports = {};
api._namespaces = ['cat', 'cluster', 'indices', 'ingest', 'nodes', 'snapshot', 'tasks'];
api._namespaces = ['cat', 'cluster', 'indices', 'ingest', 'nodes', 'remote', 'snapshot', 'tasks'];
/**
* Perform a [bulk](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-bulk.html) request
@ -1206,7 +1206,10 @@ api.clearScroll = ca({
fmt: '/_search/scroll'
}
],
paramAsBody: 'scrollId',
paramAsBody: {
param: 'scrollId',
body: 'scroll_id'
},
method: 'DELETE'
});
@ -5679,6 +5682,19 @@ api.reindexRethrottle = ca({
method: 'POST'
});
api.remote = namespace();
/**
* Perform a [remote.info](http://www.elastic.co/guide/en/elasticsearch/reference/master/remote-info.html) request
*
* @param {Object} params - An object with parameters used to carry out this action
*/
api.remote.prototype.info = ca({
url: {
fmt: '/_remote/info'
}
});
/**
* Perform a [renderSearchTemplate](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-template.html) request
*
@ -5732,7 +5748,10 @@ api.scroll = ca({
fmt: '/_search/scroll'
}
],
paramAsBody: 'scrollId',
paramAsBody: {
param: 'scrollId',
body: 'scroll_id'
},
method: 'POST'
});