forked from Homebrew/homebrew-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
algernon.rb
47 lines (42 loc) · 1.55 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
46
47
class Algernon < Formula
desc "HTTP/2 web server with built-in support for Lua and templates"
homepage "http://algernon.roboticoverlords.org/"
url "https://github.com/xyproto/algernon/archive/1.3.tar.gz"
sha256 "46577afcd255f9c4f193f2408c418e0ca5a66db9c9b4e553058fd4bef28631c1"
sha256 "a5a5976ce75c58b0a1ec10ee8185457fa590bc4e7473f061053bba85474208cc"
version_scheme 1
head "https://github.com/xyproto/algernon.git"
bottle do
sha256 "32f30f262a19cb122d1817f11dcdb9485e36f9fbc05e823e391e3ee59260d9a6" => :sierra
sha256 "46f66205f6de057ffc28e1739f50fe2a18029bccdcae8aa96930641d772e8cbd" => :el_capitan
sha256 "083a19038dc8025ddc0228211600e5dd5331a81e014e76976ae9282b4286d2ff" => :yosemite
end
depends_on "glide" => :build
depends_on "go" => :build
depends_on "readline"
def install
ENV["GLIDE_HOME"] = buildpath/"glide_home"
ENV["GOPATH"] = buildpath
(buildpath/"src/github.com/xyproto/algernon").install buildpath.children
cd "src/github.com/xyproto/algernon" do
system "glide", "install"
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", "my.db",
"--addr", ":45678"
end
sleep(1)
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