Merge pull request #207012 from Homebrew/bump-tailwindcss-4.0.5
[Homebrew/homebrew-core.git] / Formula / t / traefik@2.rb
blobfe74bfcb3b6154e877617281f8bcdd6dccff8786
1 class TraefikAT2 < Formula
2   desc "Modern reverse proxy"
3   homepage "https://traefik.io/"
4   url "https://github.com/traefik/traefik/releases/download/v2.11.20/traefik-v2.11.20.src.tar.gz"
5   sha256 "3852b76dfc9053e3354649c76c1ef7c1e1dfb8123d7150281495bf25f93fcdce"
6   license "MIT"
8   livecheck do
9     url :stable
10     regex(/^v?(2\.\d+\.\d+)$/i)
11   end
13   bottle do
14     sha256 cellar: :any_skip_relocation, arm64_sequoia: "9e90ea9a97bd844f3a999e30d170d62a9d5a7bfe590d1b4734476b6263b5fcb5"
15     sha256 cellar: :any_skip_relocation, arm64_sonoma:  "b2eeff8b0ab8417d1ee7f5a034039305f0f63abe9c6612bbf8e3982e999ad519"
16     sha256 cellar: :any_skip_relocation, arm64_ventura: "2ec7f78e94a574ffe34af759a721161154a3879dd742d279d8049de2fa383639"
17     sha256 cellar: :any_skip_relocation, sonoma:        "c4f072468480597d3be732ab6b3b26fececba8991c9d04f328aa3c9a077d7afe"
18     sha256 cellar: :any_skip_relocation, ventura:       "0e369a24fc7d1362ba3799746bc0b77632a0f424742614d8fcd4d565eba111c1"
19     sha256 cellar: :any_skip_relocation, x86_64_linux:  "29a9e1ac043b5ec0f5cab9b517fd8f99a55bb835d198d06656090889e2ee861e"
20   end
22   keg_only :versioned_formula
24   # https://doc.traefik.io/traefik/deprecation/releases/
25   disable! date: "2025-04-30", because: :unmaintained
27   depends_on "go" => :build
29   def install
30     ldflags = %W[
31       -s -w
32       -X github.com/traefik/traefik/v#{version.major}/pkg/version.Version=#{version}
33     ]
34     system "go", "generate"
35     system "go", "build", *std_go_args(ldflags:, output: bin/"traefik"), "./cmd/traefik"
36   end
38   service do
39     run [opt_bin/"traefik", "--configfile=#{etc}/traefik/traefik.toml"]
40     keep_alive false
41     working_dir var
42     log_path var/"log/traefik.log"
43     error_log_path var/"log/traefik.log"
44   end
46   test do
47     ui_port = free_port
48     http_port = free_port
50     (testpath/"traefik.toml").write <<~TOML
51       [entryPoints]
52         [entryPoints.http]
53           address = ":#{http_port}"
54         [entryPoints.traefik]
55           address = ":#{ui_port}"
56       [api]
57         insecure = true
58         dashboard = true
59     TOML
61     begin
62       pid = fork do
63         exec bin/"traefik", "--configfile=#{testpath}/traefik.toml"
64       end
65       sleep 8
66       cmd_ui = "curl -sIm3 -XGET http://127.0.0.1:#{http_port}/"
67       assert_match "404 Not Found", shell_output(cmd_ui)
68       sleep 1
69       cmd_ui = "curl -sIm3 -XGET http://127.0.0.1:#{ui_port}/dashboard/"
70       assert_match "200 OK", shell_output(cmd_ui)
71     ensure
72       Process.kill(9, pid)
73       Process.wait(pid)
74     end
76     assert_match version.to_s, shell_output("#{bin}/traefik version 2>&1")
77   end
78 end