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.cgi?path=/xmlgraphics/fop/binaries/fop-2.3-bin.tar.gz" sha256 "1d1984f3679ca165075d71e7c18679f00f97e21b453bf561c2847c3119c35993" bottle :unneeded depends_on :java => "1.6+" resource "hyph" do url "https://downloads.sourceforge.net/project/offo/offo-hyphenation-utf8/0.1/offo-hyphenation-fop-stable-utf8.zip" sha256 "0b4e074635605b47a7b82892d68e90b6ba90fd2af83142d05878d75762510128" end def install rm_rf Dir["fop/*.bat"] # Remove Windows files. libexec.install Dir["*"] executable = libexec/"fop/fop" executable.chmod 0555 bin.write_exec_script executable resource("hyph").stage do (libexec/"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