@Test public void shouldRenderAllowIriReadWhenSpecifiedOnCommandLine() throws IOException { try { String generatedDoc = new CukedoctorMain().execute(new String[]{ "-allowUriRead", "" }); System.out.flush(); baos.close(); assertThat(generatedDoc).contains(":allow-uri-read:" + newLine()); } finally { FileUtil.removeFile("Living-Documentation.adoc"); FileUtil.removeFile("Living-Documentation.html"); } }
public String execute(String args[]) { JCommander commandLine = null; try { commandLine = new JCommander(this); commandLine.parse(args); } catch (ParameterException pe) { commandLine.usage(); throw pe; } if (!hasText(title)) { title = "Living Documentation"; } if (outputName == null) { outputName = title.replaceAll(" ", "-"); } if (format == null || (format.equals("html") && !format.equals("html5") && !format.equals("pdf") && !format.equals("all"))) { format = "html5"; } if (!hasText(path)) { path = ""; } if (!hasText(outputName)) { outputName = "documentation"; } if (!hasText(toc)) { toc = "right"; } if (!hasText(chapterLabel)) { chapterLabel = "Chapter"; } if (!hasText(versionLabel)) { versionLabel = "Version"; } if (numbered == null) { numbered = false; } if (hardBreaks == null) { hardBreaks = Boolean.TRUE; } System.out.println("Generating living documentation with args:"); System.out.println("-f" + ": " + format); System.out.println("-p" + ": " + path); System.out.println("-t" + ": " + title); System.out.println("-o" + ": " + outputName); List<Feature> features = null; if (cucumberResultPaths != null) { features = new ArrayList<Feature>(); String[] resultPaths = cucumberResultPaths.split(Pattern.quote(File.pathSeparator)); for (String resultPath : resultPaths) { List<Feature> tempList = searchPathAndScan(resultPath); if (tempList != null) { features.addAll(tempList); } } } else { features = searchPathAndScan(path); } if (features == null || features.isEmpty()) { System.out.println("No features found in path:" + path); return null; } else { System.out.println("Found " + features.size() + " feature(s)"); } DocumentAttributes documentAttributes = GlobalConfig.newInstance().getDocumentAttributes(). backend(format). toc(toc). revNumber(docVersion). hardBreaks(hardBreaks). numbered(numbered). chapterLabel(chapterLabel). versionLabel(versionLabel). stem(stem); if(sourceHighlighter != null){ documentAttributes.sourceHighlighter(sourceHighlighter); } if(allowUriRead != null) { documentAttributes.allowUriRead(allowUriRead); } if (outputName.contains(".")) { outputName = outputName.substring(0, outputName.lastIndexOf(".")) + ".adoc"; } else { outputName = outputName + ".adoc"; } documentAttributes.docTitle(title); String resultDoc = null; if ("all".equals(format)) { documentAttributes.backend("html5"); resultDoc = this.execute(features, documentAttributes, outputName); documentAttributes.backend("pdf"); this.execute(features, documentAttributes, outputName); } else { resultDoc = this.execute(features, documentAttributes, outputName); } return resultDoc; }
CukedoctorMain { public String execute(String args[]) { JCommander commandLine = null; try { commandLine = new JCommander(this); commandLine.parse(args); } catch (ParameterException pe) { commandLine.usage(); throw pe; } if (!hasText(title)) { title = "Living Documentation"; } if (outputName == null) { outputName = title.replaceAll(" ", "-"); } if (format == null || (format.equals("html") && !format.equals("html5") && !format.equals("pdf") && !format.equals("all"))) { format = "html5"; } if (!hasText(path)) { path = ""; } if (!hasText(outputName)) { outputName = "documentation"; } if (!hasText(toc)) { toc = "right"; } if (!hasText(chapterLabel)) { chapterLabel = "Chapter"; } if (!hasText(versionLabel)) { versionLabel = "Version"; } if (numbered == null) { numbered = false; } if (hardBreaks == null) { hardBreaks = Boolean.TRUE; } System.out.println("Generating living documentation with args:"); System.out.println("-f" + ": " + format); System.out.println("-p" + ": " + path); System.out.println("-t" + ": " + title); System.out.println("-o" + ": " + outputName); List<Feature> features = null; if (cucumberResultPaths != null) { features = new ArrayList<Feature>(); String[] resultPaths = cucumberResultPaths.split(Pattern.quote(File.pathSeparator)); for (String resultPath : resultPaths) { List<Feature> tempList = searchPathAndScan(resultPath); if (tempList != null) { features.addAll(tempList); } } } else { features = searchPathAndScan(path); } if (features == null || features.isEmpty()) { System.out.println("No features found in path:" + path); return null; } else { System.out.println("Found " + features.size() + " feature(s)"); } DocumentAttributes documentAttributes = GlobalConfig.newInstance().getDocumentAttributes(). backend(format). toc(toc). revNumber(docVersion). hardBreaks(hardBreaks). numbered(numbered). chapterLabel(chapterLabel). versionLabel(versionLabel). stem(stem); if(sourceHighlighter != null){ documentAttributes.sourceHighlighter(sourceHighlighter); } if(allowUriRead != null) { documentAttributes.allowUriRead(allowUriRead); } if (outputName.contains(".")) { outputName = outputName.substring(0, outputName.lastIndexOf(".")) + ".adoc"; } else { outputName = outputName + ".adoc"; } documentAttributes.docTitle(title); String resultDoc = null; if ("all".equals(format)) { documentAttributes.backend("html5"); resultDoc = this.execute(features, documentAttributes, outputName); documentAttributes.backend("pdf"); this.execute(features, documentAttributes, outputName); } else { resultDoc = this.execute(features, documentAttributes, outputName); } return resultDoc; } }
CukedoctorMain { public String execute(String args[]) { JCommander commandLine = null; try { commandLine = new JCommander(this); commandLine.parse(args); } catch (ParameterException pe) { commandLine.usage(); throw pe; } if (!hasText(title)) { title = "Living Documentation"; } if (outputName == null) { outputName = title.replaceAll(" ", "-"); } if (format == null || (format.equals("html") && !format.equals("html5") && !format.equals("pdf") && !format.equals("all"))) { format = "html5"; } if (!hasText(path)) { path = ""; } if (!hasText(outputName)) { outputName = "documentation"; } if (!hasText(toc)) { toc = "right"; } if (!hasText(chapterLabel)) { chapterLabel = "Chapter"; } if (!hasText(versionLabel)) { versionLabel = "Version"; } if (numbered == null) { numbered = false; } if (hardBreaks == null) { hardBreaks = Boolean.TRUE; } System.out.println("Generating living documentation with args:"); System.out.println("-f" + ": " + format); System.out.println("-p" + ": " + path); System.out.println("-t" + ": " + title); System.out.println("-o" + ": " + outputName); List<Feature> features = null; if (cucumberResultPaths != null) { features = new ArrayList<Feature>(); String[] resultPaths = cucumberResultPaths.split(Pattern.quote(File.pathSeparator)); for (String resultPath : resultPaths) { List<Feature> tempList = searchPathAndScan(resultPath); if (tempList != null) { features.addAll(tempList); } } } else { features = searchPathAndScan(path); } if (features == null || features.isEmpty()) { System.out.println("No features found in path:" + path); return null; } else { System.out.println("Found " + features.size() + " feature(s)"); } DocumentAttributes documentAttributes = GlobalConfig.newInstance().getDocumentAttributes(). backend(format). toc(toc). revNumber(docVersion). hardBreaks(hardBreaks). numbered(numbered). chapterLabel(chapterLabel). versionLabel(versionLabel). stem(stem); if(sourceHighlighter != null){ documentAttributes.sourceHighlighter(sourceHighlighter); } if(allowUriRead != null) { documentAttributes.allowUriRead(allowUriRead); } if (outputName.contains(".")) { outputName = outputName.substring(0, outputName.lastIndexOf(".")) + ".adoc"; } else { outputName = outputName + ".adoc"; } documentAttributes.docTitle(title); String resultDoc = null; if ("all".equals(format)) { documentAttributes.backend("html5"); resultDoc = this.execute(features, documentAttributes, outputName); documentAttributes.backend("pdf"); this.execute(features, documentAttributes, outputName); } else { resultDoc = this.execute(features, documentAttributes, outputName); } return resultDoc; }  }
CukedoctorMain { public String execute(String args[]) { JCommander commandLine = null; try { commandLine = new JCommander(this); commandLine.parse(args); } catch (ParameterException pe) { commandLine.usage(); throw pe; } if (!hasText(title)) { title = "Living Documentation"; } if (outputName == null) { outputName = title.replaceAll(" ", "-"); } if (format == null || (format.equals("html") && !format.equals("html5") && !format.equals("pdf") && !format.equals("all"))) { format = "html5"; } if (!hasText(path)) { path = ""; } if (!hasText(outputName)) { outputName = "documentation"; } if (!hasText(toc)) { toc = "right"; } if (!hasText(chapterLabel)) { chapterLabel = "Chapter"; } if (!hasText(versionLabel)) { versionLabel = "Version"; } if (numbered == null) { numbered = false; } if (hardBreaks == null) { hardBreaks = Boolean.TRUE; } System.out.println("Generating living documentation with args:"); System.out.println("-f" + ": " + format); System.out.println("-p" + ": " + path); System.out.println("-t" + ": " + title); System.out.println("-o" + ": " + outputName); List<Feature> features = null; if (cucumberResultPaths != null) { features = new ArrayList<Feature>(); String[] resultPaths = cucumberResultPaths.split(Pattern.quote(File.pathSeparator)); for (String resultPath : resultPaths) { List<Feature> tempList = searchPathAndScan(resultPath); if (tempList != null) { features.addAll(tempList); } } } else { features = searchPathAndScan(path); } if (features == null || features.isEmpty()) { System.out.println("No features found in path:" + path); return null; } else { System.out.println("Found " + features.size() + " feature(s)"); } DocumentAttributes documentAttributes = GlobalConfig.newInstance().getDocumentAttributes(). backend(format). toc(toc). revNumber(docVersion). hardBreaks(hardBreaks). numbered(numbered). chapterLabel(chapterLabel). versionLabel(versionLabel). stem(stem); if(sourceHighlighter != null){ documentAttributes.sourceHighlighter(sourceHighlighter); } if(allowUriRead != null) { documentAttributes.allowUriRead(allowUriRead); } if (outputName.contains(".")) { outputName = outputName.substring(0, outputName.lastIndexOf(".")) + ".adoc"; } else { outputName = outputName + ".adoc"; } documentAttributes.docTitle(title); String resultDoc = null; if ("all".equals(format)) { documentAttributes.backend("html5"); resultDoc = this.execute(features, documentAttributes, outputName); documentAttributes.backend("pdf"); this.execute(features, documentAttributes, outputName); } else { resultDoc = this.execute(features, documentAttributes, outputName); } return resultDoc; }  String execute(String args[]); static void main(String args[]); String execute(List<Feature> features, DocumentAttributes documentAttributes, String outputName); }
CukedoctorMain { public String execute(String args[]) { JCommander commandLine = null; try { commandLine = new JCommander(this); commandLine.parse(args); } catch (ParameterException pe) { commandLine.usage(); throw pe; } if (!hasText(title)) { title = "Living Documentation"; } if (outputName == null) { outputName = title.replaceAll(" ", "-"); } if (format == null || (format.equals("html") && !format.equals("html5") && !format.equals("pdf") && !format.equals("all"))) { format = "html5"; } if (!hasText(path)) { path = ""; } if (!hasText(outputName)) { outputName = "documentation"; } if (!hasText(toc)) { toc = "right"; } if (!hasText(chapterLabel)) { chapterLabel = "Chapter"; } if (!hasText(versionLabel)) { versionLabel = "Version"; } if (numbered == null) { numbered = false; } if (hardBreaks == null) { hardBreaks = Boolean.TRUE; } System.out.println("Generating living documentation with args:"); System.out.println("-f" + ": " + format); System.out.println("-p" + ": " + path); System.out.println("-t" + ": " + title); System.out.println("-o" + ": " + outputName); List<Feature> features = null; if (cucumberResultPaths != null) { features = new ArrayList<Feature>(); String[] resultPaths = cucumberResultPaths.split(Pattern.quote(File.pathSeparator)); for (String resultPath : resultPaths) { List<Feature> tempList = searchPathAndScan(resultPath); if (tempList != null) { features.addAll(tempList); } } } else { features = searchPathAndScan(path); } if (features == null || features.isEmpty()) { System.out.println("No features found in path:" + path); return null; } else { System.out.println("Found " + features.size() + " feature(s)"); } DocumentAttributes documentAttributes = GlobalConfig.newInstance().getDocumentAttributes(). backend(format). toc(toc). revNumber(docVersion). hardBreaks(hardBreaks). numbered(numbered). chapterLabel(chapterLabel). versionLabel(versionLabel). stem(stem); if(sourceHighlighter != null){ documentAttributes.sourceHighlighter(sourceHighlighter); } if(allowUriRead != null) { documentAttributes.allowUriRead(allowUriRead); } if (outputName.contains(".")) { outputName = outputName.substring(0, outputName.lastIndexOf(".")) + ".adoc"; } else { outputName = outputName + ".adoc"; } documentAttributes.docTitle(title); String resultDoc = null; if ("all".equals(format)) { documentAttributes.backend("html5"); resultDoc = this.execute(features, documentAttributes, outputName); documentAttributes.backend("pdf"); this.execute(features, documentAttributes, outputName); } else { resultDoc = this.execute(features, documentAttributes, outputName); } return resultDoc; }  String execute(String args[]); static void main(String args[]); String execute(List<Feature> features, DocumentAttributes documentAttributes, String outputName);  }