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.10", :revision => "d718983ea2c005343d7ca3115b6a74fe7286acaa" sha256 "f1627ed11e84890befbf244828aff7a56a17157f721b445804e18b5461e3b8f3" version_scheme 1 head "https://github.com/xyproto/algernon.git" bottle do cellar :any_skip_relocation sha256 "be38f18dd05b157a3e0ea7fbd19d7f2cadf4d34ab92b445dcf768a2e86f899d4" => :high_sierra sha256 "771caea5e406490d3dfca57eaec4ef1bd9e0055cf6fb4b2e1546a7293f80b62f" => :sierra sha256 "642e81b999cdd906656d23ff1d502a7e2d0774a484d9c94d032833e60f62b867" => :el_capitan 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