homebrew-core/Formula/plantuml.rb

36 lines
939 B
Ruby

class Plantuml < Formula
desc "Draw UML diagrams"
homepage "https://plantuml.com/"
url "https://downloads.sourceforge.net/project/plantuml/1.2020.16/plantuml.1.2020.16.jar"
sha256 "f772e3d1a5410cc56374b7ec931e5a337c0475babccc443362532cb05ea42d4d"
license "GPL-3.0-or-later"
version_scheme 1
livecheck do
url :stable
regex(%r{url=.*?/plantuml[._-]v?(\d+(?:\.\d+)+)\.t}i)
end
bottle :unneeded
depends_on "graphviz"
depends_on "openjdk"
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 "#{Formula["openjdk"].opt_bin}/java" $VMARGS -jar #{libexec}/#{jar} "$@"
EOS
chmod 0755, bin/"plantuml"
end
test do
system bin/"plantuml", "-testdot"
end
end