Skip to content

Commit

Permalink
tika: fix server jar script
Browse files Browse the repository at this point in the history
fixes Homebrew#169663

tika: ensure resource in sync

tika: revision bump

Signed-off-by: Rui Chen <rui@chenrui.dev>

tika: add server start check

Signed-off-by: Rui Chen <rui@chenrui.dev>

tika: bump sleep time

Signed-off-by: Rui Chen <rui@chenrui.dev>
  • Loading branch information
andreasnef authored and branchvincent committed May 20, 2024
1 parent 454acf3 commit 24fc424
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion Formula/t/tika.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class Tika < Formula
mirror "https://archive.apache.org/dist/tika/2.9.2/tika-app-2.9.2.jar"
sha256 "87e06f88c801fcb2beae5f15e707241edb14da468a154ad78be4e31ff982c3da"
license "Apache-2.0"
revision 1

bottle do
sha256 cellar: :any_skip_relocation, all: "ef11546bb8c34e9bf78871f9838b5d9afc65c0bae5ba1ddcab64d9211e834ed2"
Expand All @@ -23,11 +24,24 @@ def install
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"
bin.write_jar_script libexec/"tika-server-standard-#{version}.jar", "tika-rest-server"
end

test do
assert_match version.to_s, resource("server").version.to_s, "server resource out of sync with formula"
pdf = test_fixtures("test.pdf")
assert_equal "application/pdf\n", shell_output("#{bin}/tika --detect #{pdf}")

port = free_port
pid = fork do
exec "#{bin}/tika-rest-server", "--port=#{port}"
end

sleep 10
response = shell_output("curl -s -i http://localhost:#{port}")
assert_match "HTTP/1.1 200 OK", response
ensure
Process.kill("TERM", pid)
Process.wait(pid)
end
end

0 comments on commit 24fc424

Please sign in to comment.