forked from Homebrew/homebrew-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
algernon.rb
45 lines (40 loc) · 1.45 KB
/
algernon.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
class Algernon < Formula
desc "Pure Go web server with Lua, Markdown, HTTP/2 and template support"
homepage "http://algernon.roboticoverlords.org/"
url "https://github.com/xyproto/algernon.git",
:tag => "1.8",
:revision => "93349dfc4d3daa5351c51551e8a8b9f0633bdc90"
sha256 "f1627ed11e84890befbf244828aff7a56a17157f721b445804e18b5461e3b8f3"
version_scheme 1
head "https://github.com/xyproto/algernon.git"
bottle do
cellar :any_skip_relocation
sha256 "75251e63866d6e338b1a81ee6d5d007e9f4f6f80801cabe80a918be7cea976b7" => :high_sierra
sha256 "1435aa8e578bc70ef7847ae191747e75140d04150b1cbf6d2f9f318f326e7453" => :sierra
sha256 "b2a1778124b34030e3bf5aaf4f9356f8a07b4d0db9841a4cadd1b70e4e380fad" => :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