and finally, return to standard mo
This commit is contained in:
@ -9,21 +9,21 @@ var api = module.exports = {};
|
||||
|
||||
api._namespaces = <%= stringify(namespaces) %>;<%
|
||||
|
||||
_v4.each(actions, function (action) {
|
||||
_.each(actions, function (action) {
|
||||
var namespace = action.location.split('.').shift();
|
||||
if (_.includes(namespaces, namespace)) {
|
||||
_v4.pull(namespaces, namespace);
|
||||
_.pull(namespaces, namespace);
|
||||
%>
|
||||
|
||||
api.<%= namespace %> = namespace();<%
|
||||
}%>
|
||||
|
||||
<%= _v4.trimEnd(partials.client_action(action)) %><%
|
||||
<%= _.trimEnd(partials.client_action(action)) %><%
|
||||
|
||||
});
|
||||
|
||||
_v4.each(proxies, function (action) {%>
|
||||
_.each(proxies, function (action) {%>
|
||||
|
||||
<%= _v4.trimEnd(partials.client_action_proxy(action)) %><%
|
||||
<%= _.trimEnd(partials.client_action_proxy(action)) %><%
|
||||
});
|
||||
%>
|
||||
|
||||
@ -2,7 +2,7 @@ module.exports = {
|
||||
<%
|
||||
|
||||
branches.forEach(function (branch, i, list) {
|
||||
var req = "require('./" + _v4.snakeCase(branch) + "')";
|
||||
var req = "require('./" + _.snakeCase(branch) + "')";
|
||||
if (branch === utils.branches._default) {
|
||||
print(" '_default': " + req + ',\n');
|
||||
}
|
||||
|
||||
@ -7,8 +7,8 @@ NOTE: This is currently the default API, but in upcoming versions that will chan
|
||||
NOTE: At this time, you must opt into the <%= branch %> API by setting the `apiVersion` config parameter.
|
||||
<% }
|
||||
|
||||
actions = _v4.sortBy(actions, 'namespace');
|
||||
_v4.each(actions, function (action) {
|
||||
actions = _.sortBy(actions, 'namespace');
|
||||
_.each(actions, function (action) {
|
||||
action.index = 'api-' + action.name.toLowerCase().replace(/[^\w]+/g, '-') + branchSuffix;
|
||||
|
||||
%>
|
||||
@ -27,16 +27,16 @@ The default method is `<%= action.spec.method || 'GET' %>` and the usual <<api-c
|
||||
|
||||
<%= action.examples %>
|
||||
|
||||
<% if (_v4.size(action.allParams)) { %>
|
||||
<% if (_.size(action.allParams)) { %>
|
||||
*Params*
|
||||
|
||||
[horizontal]<%
|
||||
_v4.each(action.allParams, function (param, paramName) { %>
|
||||
_.each(action.allParams, function (param, paramName) { %>
|
||||
`<%= paramWithDefault(paramName, param.default) %>`::
|
||||
`<%= paramType(param.type) %>` -- <%= joinParagraphs(param.description || '', 4) %><%
|
||||
if (param.type === 'enum') {%>
|
||||
Options:::<%
|
||||
_v4.each(param.options, function (opt) {%>
|
||||
_.each(param.options, function (opt) {%>
|
||||
* `"<%= opt %>"`<%
|
||||
});%>
|
||||
<%
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* Perform a [<%= name %>](<%= docUrl %>) request
|
||||
*
|
||||
* @param {Object} params - An object with parameters used to carry out this action<%
|
||||
_v4.each(allParams, function(param, paramName) { %>
|
||||
_.each(allParams, function(param, paramName) { %>
|
||||
* @param {<%= paramType(param.type) %>} <%= paramWithDefault('params.' + paramName, param.default) %><%
|
||||
if (param.description) {
|
||||
%> - <%= param.description %><%
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* Perform a [<%= name %>](<%= docUrl %>) request
|
||||
*
|
||||
* @param {Object} params - An object with parameters used to carry out this action<%
|
||||
_v4.each(allParams, function(param, paramName) { %>
|
||||
_.each(allParams, function(param, paramName) { %>
|
||||
* @param {<%= paramType(param.type) %>} <%= paramWithDefault('params.' + paramName, param.default) %><%
|
||||
if (param.description) {
|
||||
%> - <%= param.description %><%
|
||||
|
||||
@ -303,7 +303,7 @@ var client = new elasticsearch.Client({
|
||||
selector: function (hosts) {
|
||||
var myCountry = process.env.COUNTRY;
|
||||
// first try to find a node that is in the same country
|
||||
var selection = _v4.find(nodes, function (node) {
|
||||
var selection = _.find(nodes, function (node) {
|
||||
return node.host.country === myCountry;
|
||||
});
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
|
||||
// var _ = require('../../../src/lib/utils');
|
||||
var _ = require('../../../src/lib/utils');
|
||||
var utils = require('../../../grunt/utils');
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
@ -41,10 +41,10 @@ var templateGlobals = {
|
||||
|
||||
stringify: stringify,
|
||||
|
||||
_v4: _v4,
|
||||
_: _,
|
||||
|
||||
indent: function (block, spaces) {
|
||||
var indent = _v4.repeat(' ', spaces);
|
||||
var indent = _.repeat(' ', spaces);
|
||||
return block.split('\n').map(function (line) {
|
||||
return indent + line;
|
||||
}).join('\n');
|
||||
@ -77,7 +77,7 @@ var templateGlobals = {
|
||||
case 'list':
|
||||
return 'String, String[], Boolean';
|
||||
default:
|
||||
return _v4.ucfirst(type);
|
||||
return _.ucfirst(type);
|
||||
}
|
||||
},
|
||||
|
||||
@ -97,7 +97,7 @@ var templateGlobals = {
|
||||
fs.readdirSync(path.resolve(__dirname)).forEach(function (filename) {
|
||||
var name = filename.replace(/\..+$/, '');
|
||||
if (name !== 'index') {
|
||||
templates[name] = _v4.template(
|
||||
templates[name] = _.template(
|
||||
fs.readFileSync(path.resolve(__dirname, filename), 'utf8'),
|
||||
{
|
||||
imports: templateGlobals
|
||||
|
||||
Reference in New Issue
Block a user