Open vogella opened 8 years ago
Thanks for the PR!
Unfortunately I get the following error when trying to run the sample.
Failed to generate image: Could not find the 'dot' executable in PATH; add it to the PATH or specify its location using the 'dot' document attribute
The examples should require no additional setup. Can you outline what needs to be done and perhaps we can discuss a way that this can be automated?
dot just happens to be a prerequisite for using many of the diagrams supported by Asciidoctor Diagram and there isn't an obvious way to get around that. On the one hand, we could get Gradle to download graphviz, then tell Asciidoctor Diagram which path to use using the an AsciiDoc attribute (e.g., -a graphvizdot=/path/to/dot
). However, since graphviz is a compiled C program, the right binary would need to be downloaded by system and architecture.
Graphviz requires a local installation. Should like you want to have the examples working out of the box. Should I drop this PR?
I don't mind having the example in there. In fact, I think it will bring awareness to its use. But we just need a guard to protect a broken build.
Here's how that guard would work. The Gradle build would detect if the dot command is available. If so, it passes an attribute to AsciiDoc indicating this is the case. Something like graphviz-available
.
Then, in the AsciiDoc, you'd use:
ifdef::dot-available[]
<diagram block goes here>
endif::[]
In other words, fail gracefully.
We might even have an else statement explaining how to install dot properly.
I did not realized first that I need to install graphviz manually on my system. An example in the Gradle example repo would have helped me.