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.2-bin.tar.gz" sha256 "9dc1f9d1cb9acf5b3352116924c0b7678a88703b1214d537bc027c6867ec4dfe" 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