jackett 0.22.1382
[Homebrew/homebrew-core.git] / Formula / c / coredns.rb
blobf1d115ea4811e4af6dcf62f6ff52d3813b820bc2
1 class Coredns < Formula
2   desc "DNS server that chains plugins"
3   homepage "https://coredns.io/"
4   url "https://github.com/coredns/coredns/archive/refs/tags/v1.12.0.tar.gz"
5   sha256 "71a585f7d41cd07a0839788bd3bb17bcc26501711c857eeae7cae2f1f654eeac"
6   license "Apache-2.0"
7   head "https://github.com/coredns/coredns.git", branch: "master"
9   livecheck do
10     url :stable
11     strategy :github_latest
12   end
14   bottle do
15     sha256 cellar: :any_skip_relocation, arm64_sequoia: "47e98345265be947d8eb69e60109b0c5b535f692d43e4ec9b26d2a898fea5fa8"
16     sha256 cellar: :any_skip_relocation, arm64_sonoma:  "6c2d80376e5c7ced1d827d68db8323403c3caf7779da4f68d294dfe218da4653"
17     sha256 cellar: :any_skip_relocation, arm64_ventura: "445eb9d1d7d1954be13d9d627ac524a281a2c395f19b48f88f3f6dc6739799c7"
18     sha256 cellar: :any_skip_relocation, sonoma:        "416cba4b07cdd04de0fadab927cc1e37352d845e20790b60f6df33b45bf41f39"
19     sha256 cellar: :any_skip_relocation, ventura:       "24f74e3e5580f6619ad9c570e607d7ae4ce2df25f084c04cbe43a194bfd3a5a1"
20     sha256 cellar: :any_skip_relocation, x86_64_linux:  "49e825e0683e588c2aa18f28de5818412ea819d0e98319fa81e5fdf9d255d94f"
21   end
23   depends_on "go" => :build
25   on_linux do
26     depends_on "bind" => :test # for `dig`
27   end
29   def install
30     system "make"
31     bin.install "coredns"
32   end
34   service do
35     run [opt_bin/"coredns", "-conf", etc/"coredns/Corefile"]
36     keep_alive true
37     require_root true
38     working_dir HOMEBREW_PREFIX
39     log_path var/"log/coredns.log"
40     error_log_path var/"log/coredns.log"
41   end
43   test do
44     port = free_port
45     fork do
46       exec bin/"coredns", "-dns.port=#{port}"
47     end
48     sleep(2)
49     output = shell_output("dig @127.0.0.1 -p #{port} example.com.")
50     assert_match(/example\.com\.\t\t0\tIN\tA\t127\.0\.0\.1\n/, output)
51   end
52 end