Generates index file by copying index.js from template directory to model directory. These locations come from
config.
@private
@param next
164258
function generateUtilityFiles(next) {
    fs.copy(path.join(getConfig('template.folder'), 'index.js'), path.join(getConfig('output.folder'), 'index.js'), function (err) {
        if (err) { next(err); return; }
        if (getConfig('output.log')) { logger.info('(Created) Index file: ' + path.resolve(path.join(getConfig('output.folder'), 'index.js'))); }
        fs.copy(path.join(getConfig('template.folder'), '..', 'utils.js'), path.join(getConfig('output.folder'), 'utils.js'), function (err) {
            if (err) { next(err); return; }
            next(null);
        });
    });
    try {
        overriddenAliases = require(path.join(process.cwd(), getConfig('output.folder'), 'alias.json'));
    } catch (ignore) {}
}
949908
function( grunt, options, callback ) {
  this.callback          = callback;
  this.diffCount         = 0;
  this.grunt             = grunt;
  this.options           = options;
  this.options.indexPath = this.getIndexPath();
  this.pictureCount      = 0;

  if ( typeof options.template === 'string' ) {
    this.template = options.template;
  } else if ( typeof options.template === 'object' ) {
    this.template = options.template.name;
  }

  this.movePictures();
  this.pictures = this.getPreparedPictures();
}
1331205
function createIndices(callback) {
      const q = queue();
      geojson_files.forEach((gj) => {
        q.defer(createIndex, gj);
      });

      q.awaitAll((err) => {
        if (err) return callback(err);
        return callback();
      });
    }
1107077
public static void generate(ConfigurationImpl configuration,
            IndexBuilder indexBuilder) throws DocFileIOException {
        if (configuration.frames) {
            generate(configuration, indexBuilder, DocPaths.ALLCLASSES_FRAME, true);
            generate(configuration, indexBuilder, DocPaths.ALLCLASSES_NOFRAME, false);
        } else {
            generate(configuration, indexBuilder, DocPaths.ALLCLASSES, false);
        }
    }
219872
function (next) {

        async.each(input, function (path, done) {
            fs.stat(path, function (err, stats) {
                if (err) return done(err);
                if (stats.isDirectory())
                    return done("Cannot have a directory as input");
                done();
            });
        }, next);

    }
792421
function createIndex(dirPath) {
    const dirName = path.basename(dirPath)
    return format(`/** DON'T EDIT THIS FILE; was created by scripts. */
    "use strict"

    module.exports = {
        ${fs
            .readdirSync(dirPath)
            .map(file => path.basename(file, ".js"))
            .map(id => `"${id}": require("./${dirName}/${id}"),`)
            .join("\n    ")}
    }
    `)
}
900401
function buildIndexFile(isProd) {
			return new Promise((resolve) => {
				files.readFile(path.resolve(__dirname, ".includes/index.html"), (err, html) => {
					if (err) throw err;
					html = html.replace("$appDesc$", wapitisConfig.appDesc);
					html = html.replace("$themeColor$", wapitisConfig.themeColor);
					html = html.replace("$appName$", wapitisConfig.appName);
					if (isProd) {
						const quantumFile = JSON.parse(files.readFileSync(completeDistPath + "/quantum.json", "utf8"));
						html = html.replace("$bundle$", `<script src="${quantumFile.bundle.relativePath}"></script>`);
						files.remove(completeDistPath + "/quantum.json");
					} else html = html.replace("$bundle$", '<script src="bundle.js"></script>');
					files.appendFile(completeDistPath + "/index.html", html, true).then(() => resolve());
				});
			});
		}
146781
function(step, next) {
      var currentStep;
      step.steps = copyArray(step.steps);
      currentStep = -1;
      step.next = function() {
        var args;
        currentStep++;
        args = [step].concat(copyArray(arguments));
        if (currentStep >= step.steps.length) {
          return step.callback.apply(null, args);
        } else {
          return step.steps[currentStep].apply(null, args);
        }
      };
      return next();
    }
957502
function(next) {
          // Here destination is allways a file.
          // Only the parent folder is required
          var dir = dirname(dest);
          if(dirExists[dir]) {
            return next();
          }

          grunt.verbose.writeln('  Make directory %s', dir.blue);
          mkdirp(dir, function(err) {
            if(err) {
              return next(err);
            }
            tally.dirs++;
            dirExists[dir] = true;
            return next();
          });

        }
523060
function (templatePath, path, data, name) {
    var templateString = fs.readFileSync(templatePath);

    // generate scenarioData.js contents by inserting data into template
    var templateData = {scenarioData: data};
    templateData.scenarioDataName = name || '';

    var output = _.template(templateString)(templateData);

    mkdirp.sync(getDirName(path));
    fs.writeFileSync(path, output);
  }
1117483
function (next) {

            // index creation options
            var body = {
                settings: {
                    number_of_shards : 3,
                    number_of_replicas : 2,
                    analysis: {
                        // analyzer definitions go here
                        analyzer: {
                            // default analyzer used for search & indexing
                            default: {
                                tokenizer: 'uax_url_email',
                                // indexing/search analysis:
                                // - trims leading/trailing whitespace
                                // - is case-insensitive
                                // - transforms non ascii characters into ascii character equivalents
                                // - splits on word/number boundaries and other delimiter rules
                                filter: [ 'trim', 'lowercase', 'asciifolding', 'word_delimiter_1' ]
                            },
                            // analyzer to use in indexing for autocomplete - we want ngrams of our data to be indexed
                            autocomplete_index: {
                                type: 'custom',
                                // use our own own ngram tokenizer
                                tokenizer: 'autocomplete_ngram',
                                filter: [ 'trim', 'lowercase', 'asciifolding', 'word_delimiter_1' ]
                            },
                            // analyzer to use in analyzing autocomplete search queries (don't generate ngrams from search queries)
                            autocomplete_search: {
                                type: 'custom',
                                tokenizer: 'keyword',
                                filter: [ 'trim', 'lowercase', 'asciifolding' ]
                            }
                        },
                        // filter definitions go here
                        filter: {
                            // custom word_delimiter filter to preserve original input as well as tokenize it
                            word_delimiter_1: {
                                type: 'word_delimiter',
                                preserve_original: true
                            }
                        },
                        // tokenizer definitions go here
                        tokenizer: {
                            // tokenizer to use for generating ngrams of our indexed data
                            autocomplete_ngram: {
                                type: 'edgeNGram',
                                // min and max ngram length
                                min_gram: 1,
                                max_gram: 50,
                                // generate ngrams that start from the front of the token only (eg. c, ca, cat)
                                side: 'front'
                            }
                        }
                    }
                }
            }

            // if non-default mapping info was defined on the schema (e.g. autocomplete), apply the mappings to the index
            body.mappings = {}
            body.mappings[options.type] = indexMap

            // console.log('mapping for', options.type, util.inspect(indexMap, true, 10, true))

            var reqOpts = {
                method: 'PUT',
                url: versionedUri,
                body: JSON.stringify(body)
            }

            if(options.auth) {
                reqOpts.auth = {
                    user: options.auth.user,
                    pass: options.auth.password,
                    sendImmediately: false
                };
            }

            // console.log('versionedUri', versionedUri)

            helpers.backOffRequest(reqOpts, function (err, res, body) {
                if (err) {
                    return cb(err)
                }

                if (!helpers.elasticsearchBodyOk(body)) {
                    var error = new Error('Unexpected index creation reply: '+util.inspect(body, true, 10, true))
                    error.body = body

                    return next(error)
                }

                return next()
            })
        }
935794
function createIndex() {
  var directory = 'src/views'
  var directories = fs.readdirSync(directory)

  try {
    var lines = ['// This is a generated file, do not edit, or disable "prebuild" command in package.json if you want to take control']
    for (var i = 0; i < directories.length; i++) {
      var path = directory + '/' + directories[i];
      if (fs.existsSync(path) && fs.lstatSync(path).isDirectory()) {
        var file = directories[i] + '.js'
        if (fs.existsSync(directory + '/' + directories[i] + '/' + file)) {
          lines.push('export { default as ' + directories[i] + ' } from \'./' + directories[i] + '/' + directories[i] + '\'')
        }
      }
    }

    fs.writeFileSync(directory + '/index.js', lines.join('\n') + '\n');
  } catch (err) {
    console.log(err)
  }
}
76536
function __express(filepath, data, next) {
  data = Benchpress.addGlobals(data);
  data._locals = null;

  if (Benchpress.cache[filepath]) {
    render(filepath, data, Benchpress.cache[filepath], next);
    return;
  }

  fs.readFile(filepath, 'utf-8', (err, code) => {
    if (err) {
      next(err);
      return;
    }

    let template;
    try {
      template = Benchpress.cache[filepath] = evaluate(code);
    } catch (e) {
      e.message = `Evaluate failed for template ${filepath}:\n ${e.message}`;
      e.stack = `Evaluate failed for template ${filepath}:\n ${e.stack}`;

      process.nextTick(next, e);
      return;
    }

    render(filepath, data, template, next);
  });
}
1227480
function(props) {
        var files = {};
        // Iterate over all source files.
        grunt.task.expandFiles({dot: true}, pathPrefix + '**').forEach(function(obj) {
          // Get the path relative to the template root.
          var relpath = obj.rel.slice(pathPrefix.length);
          var rule = init.renames[relpath];
          // Omit files that have an empty / false rule value.
          if (!rule && relpath in init.renames) { return; }
          // Create a property for this file.
          files[rule ? grunt.template.process(rule, props, 'init') : relpath] = obj.rel;
        });
        return files;
      }
1234773
public static void generate(ConfigurationImpl configuration,
                                IndexBuilder indexbuilder) throws DocFileIOException {
        DocPath filename = DocPaths.INDEX_ALL;
        SingleIndexWriter indexgen = new SingleIndexWriter(configuration,
                                         filename, indexbuilder);
        indexgen.generateIndexFile();
    }
171629
function interceptIndex(request, response, next) {
	if (args.index === true && request.path === '/') {
		request.path = '/index.json';
	}
	return next();
}
471555
function generateLayers () {
			grunt.log.write("Generating layers...");

			var config = lang.extend({}, requireConfig, {
				isPrepareStage: true,
				optimize: "none",
				optimizeCss: "none",
				appDir: buildDir,
				dir: tempDir,
				baseUrl: "./",
				logLevel: 2, // WARN
				removeCombined: false,
				skipDirOptimize: true,
				keepBuildDir: false,
				skipSemiColonInsertion: true,
				pragmas: {
					prepare: true,
					build: true
				},
				// Pragmas for rjs plugins:
				pragmasOnSave: {
					prepareSave: true
				},
				// main (root) modules:
				modules: modules.map(function (module) { return { name: module }; }),
				onBuildWrite: function (moduleName, modulePath, contents) {
					// put moduleName into some layer basing on its path
					layers.some(function (layer) {
						var relPath = path.relative(path.resolve(config.dir), modulePath);
						var layerDir = layer.dir;
						if (!Array.isArray(layerDir)) {
							layerDir = [layerDir];
						}
						layerDir.forEach(function(dir) {
							if (relPath.indexOf(dir) === 0) {
								if (options.ignoreModules) {
									if (options.ignoreModules.some(function (m) {
										return m === moduleName;
									})) {
										return;
									}
								}
								layer.modules[moduleName] = true;
							}
						});
					});
					if (moduleName.indexOf('xhtmpl!') === 0) {
						modulesToDelete.push(path.join(outputDir, modulePath.slice('xhtmpl!'.length)));

						// Manually save pre-compiled template back into buildDir as
						// we're currently saving into tempDir (that's why we can't rely on returning content)

						// NOTE: manually remove leading semicolon
						// TODO: the code should be removed after migrating on 2.1.9 (with skipSemiColonInsertion support)
						if (contents.charAt(contents.length-1) === ";") {
							contents = contents.slice(0, contents.length-1);
						}
						file.saveFile(path.join(buildDir, modulePath.slice('xhtmpl!'.length)), contents);
					}
					//return contents;
					return "// this is a stub for finding layer's dependencies: moduleName=" + moduleName;
				}
			});

			requirejs.optimize(
				config,
				lang.safeCallback(function () {
					// create layer modules using 'layers' structure created in onBuildWrite:
					// every 'layer module' is an empty RJS module with imports (via define([..])) of all modules inside this layer
					layers.forEach(function (layer) {
						var modules = Object.keys(layer.modules).sort(),
							content = "define([\n\t\"" + modules.join("\",\n\t\"") + "\"\n], function () {});";
						file.saveFile(path.join(buildDir, layer.name) + ".js", content);
					});

					grunt.log.writeln('OK'.green);

					// Go to next step
					optimizeModules();
				}),
				lang.errorCallback
			);
		}