class Algernon < Formula desc "Pure Go web server with Lua, Markdown, HTTP/2 and template support" homepage "https://algernon.roboticoverlords.org/" url "https://github.com/xyproto/algernon.git", :tag => "1.12.4", :revision => "fd4412ebb5a233b34073a9cebebf131ab7ee6433" version_scheme 1 head "https://github.com/xyproto/algernon.git" bottle do cellar :any_skip_relocation sha256 "ac2fac7c0662d6864f2dc2e99fbae53041463a67b5e55bb3922deb487daf7382" => :mojave sha256 "db60d68e16302c740d2581fb113bbee08438ecf2706ce5cb91abc04b643d1ccc" => :high_sierra sha256 "0f97251244c9138256f5bb9a5cc6ee367ee56e68bef2a1c174fd1e45a8965119" => :sierra end depends_on "go" => :build def install ENV["GOPATH"] = buildpath (buildpath/"src/github.com/xyproto/algernon").install buildpath.children cd "src/github.com/xyproto/algernon" do system "go", "build", "-o", "algernon" bin.install "desktop/mdview" bin.install "algernon" prefix.install_metafiles end end test do begin pid = fork do exec "#{bin}/algernon", "-s", "-q", "--httponly", "--boltdb", "tmp.db", "--addr", ":45678" end sleep 20 output = shell_output("curl -sIm3 -o- http://localhost:45678") assert_match /200 OK.*Server: Algernon/m, output ensure Process.kill("HUP", pid) end end end