39 lines
918 B
Ruby
39 lines
918 B
Ruby
class Woof < Formula
|
|
include Language::Python::Shebang
|
|
|
|
desc "Ad-hoc single-file webserver"
|
|
homepage "http://www.home.unix-ag.org/simon/woof.html"
|
|
url "https://github.com/simon-budig/woof/archive/woof-20220202.tar.gz"
|
|
sha256 "cf29214aca196a1778e2f5df1f5cc653da9bee8fc2b19f01439c750c41ae83c1"
|
|
license "GPL-2.0-or-later"
|
|
|
|
bottle do
|
|
rebuild 1
|
|
sha256 cellar: :any_skip_relocation, all: "6f5ec883ad9fdb67965bc8a7a08318adcc1fa5a48e1da24f56cb85697bd28e0d"
|
|
end
|
|
|
|
depends_on "python@3.11"
|
|
|
|
def install
|
|
rewrite_shebang detected_python_shebang, "woof"
|
|
bin.install "woof"
|
|
end
|
|
|
|
test do
|
|
port = free_port
|
|
pid = fork do
|
|
exec "#{bin}/woof", "-s", "-p", port.to_s
|
|
end
|
|
|
|
sleep 2
|
|
|
|
begin
|
|
read = (bin/"woof").read
|
|
assert_equal read, shell_output("curl localhost:#{port}/woof")
|
|
ensure
|
|
Process.kill("SIGINT", pid)
|
|
Process.wait(pid)
|
|
end
|
|
end
|
|
end
|