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.7.0.tar.gz"
|
|
sha256 "7e436e9d0c0b84af863685e05d701b84247bb0f12b6dbf05ea87e165c1398b2b"
|
|
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 "717eb60a8e16116051725b2717cad72aa288038c08087981a4afdbf707bbec7f" => :catalina
|
|
sha256 "f9cea81b5c945bdf7201d9104236a71a624816093a5479fe695de727eff5682e" => :mojave
|
|
sha256 "9de8f7e481877045fdb18aad99723773a18f5a7de5c0aea1965ddece445e5092" => :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
|