forked from Homebrew/homebrew-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
algernon.rb
44 lines (39 loc) · 1.38 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
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.2",
:revision => "4abf8d33c32ceb7d0f4af5121e882711911bc2ea"
version_scheme 1
head "https://github.com/xyproto/algernon.git"
bottle do
cellar :any_skip_relocation
sha256 "7b9f694b5c771282fa28a0b50dbaacfae57f3622ee88e0420a72e8d4cc10216f" => :mojave
sha256 "5d4e14ec6c1327a0e84e9a1b44526da83a3cfac754c1ced0766cb93f7bf83aae" => :high_sierra
sha256 "82dd9f21ce4693dc92edc3db57946a465a87e7ad5acbb4d049dfb3879bc1aa12" => :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