homebrew-core/Formula/plantuml.rb
Paolo D'Apice 3f650b5aa5
plantuml: add JVM headless flag to plantuml if not using gui
Closes #38004.

Signed-off-by: Izaak Beekman <zbeekman@gmail.com>
2019-04-09 10:11:05 -04:00

29 lines
776 B
Ruby

class Plantuml < Formula
desc "Draw UML diagrams"
homepage "https://plantuml.com/"
url "https://downloads.sourceforge.net/project/plantuml/1.2019.3/plantuml.1.2019.3.jar"
sha256 "971ae4b333872cbf7e9d845f23352790240264818c05a947b08800b73005ac22"
version_scheme 1
bottle :unneeded
depends_on "graphviz"
depends_on :java
def install
jar = "plantuml.jar"
libexec.install "plantuml.#{version}.jar" => jar
(bin/"plantuml").write <<~EOS
#!/bin/bash
if [[ "$*" != *"-gui"* ]]; then
VMARGS="-Djava.awt.headless=true"
fi
GRAPHVIZ_DOT="#{Formula["graphviz"].opt_bin}/dot" exec java $VMARGS -jar #{libexec}/#{jar} "$@"
EOS
chmod 0555, bin/"plantuml"
end
test do
system bin/"plantuml", "-testdot"
end
end