Skip to content

Commit

Permalink
Generate docs/examples from tests only when configured.
Browse files Browse the repository at this point in the history
  • Loading branch information
nmihajlovski committed Jul 19, 2017
1 parent aa639b9 commit da41b11
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bin/build.sh
@@ -1,3 +1,5 @@
#!/usr/bin/env bash

export DOCS=true

mvn clean install
Expand Up @@ -26,6 +26,7 @@
import org.rapidoid.http.IsolatedIntegrationTest;
import org.rapidoid.io.FileSearchResult;
import org.rapidoid.io.IO;
import org.rapidoid.log.GlobalCfg;
import org.rapidoid.test.Doc;
import org.rapidoid.u.U;
import org.rapidoid.util.Msc;
Expand Down Expand Up @@ -97,6 +98,12 @@ private void generateAsciiDoc(Doc doc, String id, String asciidoc, Map<String, S

IO.save(Msc.path(asciidoc, filename), sb.toString());

if (GlobalCfg.is("DOCS")) {
appendToIndex(asciidoc, filename);
}
}

private void appendToIndex(String asciidoc, String filename) {
String toIndex = U.frmt("include::%s[]\n\n", filename);

String index = Msc.path(asciidoc, "index.adoc");
Expand Down

0 comments on commit da41b11

Please sign in to comment.