in webindex/modules/integration/src/main/java/webindex/integration/DevServer.java [152:186]
public static void main(String[] args) throws Exception {
DevServerOpts opts = new DevServerOpts();
JCommander commander = new JCommander(opts);
commander.setProgramName("webindex dev");
try {
commander.parse(args);
} catch (ParameterException e) {
System.out.println(e.getMessage() + "\n");
commander.usage();
System.exit(1);
}
if (opts.help) {
commander.usage();
System.exit(1);
}
Path dataPath = Paths.get(String.format("data/%d-pages.txt", opts.numPages));
if (Files.notExists(dataPath)) {
log.info("Generating sample data at {} for dev server", dataPath);
SampleData.generate(dataPath, opts.numPages);
}
log.info("Loading data at {}", dataPath);
Path templatePath = Paths.get(opts.templateDir);
if (Files.notExists(templatePath)) {
log.info("Template location {} does not exits", templatePath);
throw new IllegalArgumentException("Template location does not exist");
}
Path baseDir = Files.createTempDirectory(Paths.get("target"), "webindex-dev-");
DevServer devServer = new DevServer(dataPath, 4567, templatePath, baseDir, opts.metrics);
devServer.start();
}