Skip to content
This repository has been archived by the owner on Feb 17, 2022. It is now read-only.

Commit

Permalink
[apis] regnerate
Browse files Browse the repository at this point in the history
  • Loading branch information
jbudz committed Jan 15, 2020
1 parent b326e5f commit d322a95
Show file tree
Hide file tree
Showing 8 changed files with 12,685 additions and 228 deletions.
394 changes: 197 additions & 197 deletions docs/api_methods.asciidoc

Large diffs are not rendered by default.

5,353 changes: 5,353 additions & 0 deletions docs/api_methods_7_4.asciidoc

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions docs/configuration.asciidoc
Expand Up @@ -52,27 +52,28 @@ Default in Node:::
+
WARNING: This default will track the latest version of Elasticsearch, and is only intended to be used during development. It is highly recommended that you set this parameter in all code that is headed to production.

Default ::: `'7.4'`
Default ::: `'7.5'`

Options in node :::
* `'7.5'`
* `'7.4'`
* `'7.3'`
* `'7.2'`
* `'7.1'`
* `'7.0'`
* `'6.8'`
* `'5.6'`
* `'7.5'` (unstable)
* `'7.6'` (unstable)
* `'7.x'` (unstable)
* `'master'` (unstable)

Options in the browser :::
* `'7.5'`
* `'7.4'`
* `'7.3'`
* `'7.2'`
* `'7.1'`
* `'7.0'`
* `'7.5'` (unstable)
* `'7.6'` (unstable)
* `'7.x'` (unstable)
* `'master'` (unstable)

Expand Down
2 changes: 2 additions & 0 deletions docs/index.asciidoc
Expand Up @@ -22,6 +22,8 @@ include::development.asciidoc[]

include::api_methods.asciidoc[]

include::api_methods_7_4.asciidoc[]

include::api_methods_7_3.asciidoc[]

include::api_methods_7_2.asciidoc[]
Expand Down
46 changes: 24 additions & 22 deletions scripts/generate/index.js
Expand Up @@ -54,13 +54,13 @@ var paths = {
docs: fromRoot('docs'),
docsIndex: fromRoot('docs/index.asciidoc'),
apiSrc: 'src/lib/apis',
getArchiveDir: function(branch) {
getArchiveDir: function (branch) {
return fromRoot('src/_elasticsearch_' + utils.snakeCase(branch));
},
getArchiveTarball: function(branch) {
getArchiveTarball: function (branch) {
return fromRoot('src/_elasticsearch_' + utils.snakeCase(branch) + '.tar');
},
getSpecPathInRepo: function(branch) {
getSpecPathInRepo: function (branch) {
return /^v?(master|[2-9]\.)/.test(branch)
? 'rest-api-spec/src/main/resources/rest-api-spec'
: 'rest-api-spec';
Expand All @@ -71,18 +71,18 @@ function isDirectory(dir) {
var stat;
try {
stat = fs.statSync(dir);
} catch (e) {}
} catch (e) { }
return stat && stat.isDirectory();
}

function dirFilter(dir, fn) {
try {
return fs
.readdirSync(dir)
.filter(function(name) {
.filter(function (name) {
return name !== '.' && name !== '..' && fn(name);
})
.map(function(filename) {
.map(function (filename) {
return path.join(dir, filename);
});
} catch (e) {
Expand All @@ -91,36 +91,36 @@ function dirFilter(dir, fn) {
}

function dirRegex(dir, regexp) {
return dirFilter(dir, function(name) {
return dirFilter(dir, function (name) {
return name.match(regexp);
});
}

function dirOpts(dir, opts) {
opts = _.isArray(opts) ? opts : [opts];
return dirFilter(dir, function(name) {
return dirFilter(dir, function (name) {
return _.includes(opts, name);
});
}

function spawnStep(cmd, args, cwd) {
return function(done) {
return function (done) {
spawn(
cmd,
args,
{
verbose: argv.verbose,
cwd: cwd,
},
function(status) {
function (status) {
done(status ? new Error('Non-zero exit code: ' + status) : void 0);
}
);
};
}

function initStep() {
return function(done) {
return function (done) {
if (isDirectory(paths.esSrc)) {
async.series(
[spawnStep('git', ['remote', 'set-url', 'origin', esUrl], paths.esSrc)],
Expand All @@ -139,7 +139,7 @@ function initStep() {
}

function fetchBranchesStep() {
var branchArgs = branches.map(function(b) {
var branchArgs = branches.map(function (b) {
return b + ':' + b;
});
return spawnStep(
Expand All @@ -161,7 +161,7 @@ function findGeneratedApiFiles() {
];
}

return branches.reduce(function(files, branch) {
return branches.reduce(function (files, branch) {
var b = utils.snakeCase(branch);

files.push(dirOpts(paths.docs, 'api_methods_' + b + '.asciidoc'));
Expand Down Expand Up @@ -190,14 +190,14 @@ function clearGeneratedFiles() {
var rmSteps = _.chain(generatedFiles)
.flattenDeep()
.uniq()
.map(function(path) {
.map(function (path) {
return spawnStep('rm', ['-rf', path]);
})
.value();

if (!rmSteps.length) return;

return function(done) {
return function (done) {
return async.series(rmSteps, done);
};
}
Expand All @@ -224,6 +224,8 @@ function convertToCommit(branch) {
return 'c31cddf27e9618582b3cd175e4e0bce320af6a14^1';
case '7.5':
return 'c31cddf27e9618582b3cd175e4e0bce320af6a14^1';
case '7.6':
return 'c31cddf27e9618582b3cd175e4e0bce320af6a14^1';
case '7.x':
return 'c31cddf27e9618582b3cd175e4e0bce320af6a14^1';
case 'master':
Expand All @@ -232,7 +234,7 @@ function convertToCommit(branch) {
}

function createArchive(branch) {
return function(done) {
return function (done) {
var dir = paths.getArchiveDir(branch);
var tarball = paths.getArchiveTarball(branch);
var specPathInRepo = paths.getSpecPathInRepo(branch);
Expand Down Expand Up @@ -276,7 +278,7 @@ function createArchive(branch) {
}

function generateStep(branch) {
return function(done) {
return function (done) {
async.parallel(
[argv.api && async.apply(require('./js_api'), branch)].filter(Boolean),
done
Expand All @@ -288,7 +290,7 @@ var steps = [initStep(), clearGeneratedFiles(), fetchBranchesStep()].filter(
Boolean
);

branches.forEach(function(branch) {
branches.forEach(function (branch) {
steps.push(
_.partial(
async.series,
Expand All @@ -310,15 +312,15 @@ if (argv.api) {
}

async.series(
steps.map(function(step) {
return function(done) {
step(function(err) {
steps.map(function (step) {
return function (done) {
step(function (err) {
console.log('----\n');
done(err);
});
};
}),
function(err) {
function (err) {
if (err) {
throw err;
}
Expand Down

0 comments on commit d322a95

Please sign in to comment.