class Fop < Formula
desc "XSL-FO print formatter for making PDF or PS documents"
homepage "https://xmlgraphics.apache.org/fop/index.html"
url "https://www.apache.org/dyn/closer.lua?path=xmlgraphics/fop/binaries/fop-2.5-bin.tar.gz"
mirror "https://archive.apache.org/dist/xmlgraphics/fop/binaries/fop-2.5-bin.tar.gz"
sha256 "6a3c5f8915be5ef90fff202c818152d8252bb45b96d9c5d6550594903739e5ed"
license "Apache-2.0"
livecheck do
url :stable
end
bottle :unneeded
depends_on "openjdk"
resource "hyph" do
url "https://downloads.sourceforge.net/project/offo/offo-hyphenation/2.2/offo-hyphenation-compiled.zip"
sha256 "3b503122b488bd30f658e9757c3b3066dd7a59f56c3a9bbb3eaae2d23b7d883f"
end
def install
rm_rf Dir["fop/*.bat"] # Remove Windows files.
libexec.install Dir["*"]
executable = libexec/"fop/fop"
executable.chmod 0555
(bin/"fop").write_env_script executable, JAVA_HOME: Formula["openjdk"].opt_prefix
resource("hyph").stage do
(libexec/"fop/build").install "fop-hyph.jar"
end
end
test do
(testpath/"test.xml").write "Homebrew"
(testpath/"test.xsl").write <<~EOS
Hello, !
EOS
system bin/"fop", "-xml", "test.xml", "-xsl", "test.xsl", "-pdf", "test.pdf"
assert_predicate testpath/"test.pdf", :exist?
end
end