69 lines
2.0 KiB
Ruby
69 lines
2.0 KiB
Ruby
class Coredns < Formula
|
|
desc "DNS server that chains plugins"
|
|
homepage "https://coredns.io/"
|
|
url "https://github.com/coredns/coredns/archive/v1.8.0.tar.gz"
|
|
sha256 "74bdfdd0bc314d2191159b6782f678989aa0cff1af993a1d384f62d1585070d8"
|
|
license "Apache-2.0"
|
|
head "https://github.com/coredns/coredns.git"
|
|
|
|
livecheck do
|
|
url "https://github.com/coredns/coredns/releases/latest"
|
|
regex(%r{href=.*?/tag/v?(\d+(?:\.\d+)+)["' >]}i)
|
|
end
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "effbd42542b71878967de42c4eaee916fa45bd245704cf5507b9310b552c89e1" => :catalina
|
|
sha256 "13cdbec577e0c594c58899e00d11b49253797e7516d74859eb11179e51658480" => :mojave
|
|
sha256 "ee162e739ebe97f27833680c2da6cd2b3a4578897207ff9e3513a4c1a2987f6f" => :high_sierra
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
|
|
def install
|
|
system "make"
|
|
bin.install "coredns"
|
|
end
|
|
|
|
plist_options startup: true
|
|
|
|
def plist
|
|
<<~EOS
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
<plist version="1.0">
|
|
<dict>
|
|
<key>Label</key>
|
|
<string>#{plist_name}</string>
|
|
<key>ProgramArguments</key>
|
|
<array>
|
|
<string>#{opt_bin}/coredns</string>
|
|
<string>-conf</string>
|
|
<string>#{etc}/coredns/Corefile</string>
|
|
</array>
|
|
<key>RunAtLoad</key>
|
|
<true/>
|
|
<key>KeepAlive</key>
|
|
<true/>
|
|
<key>StandardErrorPath</key>
|
|
<string>#{var}/log/coredns.log</string>
|
|
<key>StandardOutPath</key>
|
|
<string>#{var}/log/coredns.log</string>
|
|
<key>WorkingDirectory</key>
|
|
<string>#{HOMEBREW_PREFIX}</string>
|
|
</dict>
|
|
</plist>
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
port = free_port
|
|
fork do
|
|
exec bin/"coredns", "-dns.port=#{port}"
|
|
end
|
|
sleep(2)
|
|
output = shell_output("dig @127.0.0.1 -p #{port} example.com.")
|
|
assert_match(/example\.com\.\t\t0\tIN\tA\t127\.0\.0\.1\n/, output)
|
|
end
|
|
end
|