class Tika < Formula desc "Content analysis toolkit" homepage "https://tika.apache.org/" url "https://www.apache.org/dyn/closer.cgi?path=tika/tika-app-1.18.jar" sha256 "edf6e18c805113385deeb1e7ede482d53e83d37c819f9697a43b73734f60ec21" bottle :unneeded depends_on :java => "1.7+" resource "server" do url "https://www.apache.org/dyn/closer.cgi?path=tika/tika-server-1.17.jar" sha256 "286c693134a115ac2bf452e5f1569dfa9eb928b9658c22a147f56cf01bfb4639" end def install libexec.install "tika-app-#{version}.jar" bin.write_jar_script libexec/"tika-app-#{version}.jar", "tika" libexec.install resource("server") bin.write_jar_script libexec/"tika-server-#{version}.jar", "tika-rest-server" end def caveats; <<~EOS To run Tika: tika To run Tika's REST server: tika-rest-server See the Tika homepage for more documentation: brew home tika EOS end test do pdf = test_fixtures("test.pdf") assert_equal "application/pdf\n", shell_output("#{bin}/tika --detect #{pdf}") end end