-
Notifications
You must be signed in to change notification settings - Fork 24
/
toxiproxy.rb
66 lines (59 loc) · 2.82 KB
/
toxiproxy.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Documentation: https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Formula-Cookbook.md
# /usr/local/Library/Contributions/example-formula.rb
# PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST!
class Toxiproxy < Formula
app_version = "2.11.0"
homepage "https://github.com/Shopify/toxiproxy"
license "MIT"
version app_version
case
when OS.mac? && Hardware::CPU.intel?
url "https://github.com/Shopify/toxiproxy/releases/download/v#{app_version}/toxiproxy-server-darwin-amd64"
sha256 "dd730397b252243aa196bdf0db8aacf73ed7c35a6386c46677da228c31652549"
when OS.mac? && Hardware::CPU.arm?
url "https://github.com/Shopify/toxiproxy/releases/download/v#{app_version}/toxiproxy-server-darwin-arm64"
sha256 "fb9085e232ffe7bfdae3a0be8da5f041cc66fb75740ec173173b5b3cc1b35750"
when OS.linux? && Hardware::CPU.intel?
url "https://github.com/Shopify/toxiproxy/releases/download/v#{app_version}/toxiproxy-server-linux-amd64"
sha256 "396d318e4c0b2703904edd112b6decaec5a61643ef172fdaf696fababe09fad3"
when OS.linux? && Hardware::CPU.arm?
url "https://github.com/Shopify/toxiproxy/releases/download/v#{app_version}/toxiproxy-server-linux-arm64"
sha256 "862228f3f4c440e8caad1b174a974698363091aec4f0f7237f61a0f290224962"
else
odie "Unexpected platform!"
end
resource "cli" do
case
when OS.mac? && Hardware::CPU.intel?
url "https://github.com/Shopify/toxiproxy/releases/download/v#{app_version}/toxiproxy-cli-darwin-amd64"
sha256 "b828766134cd6dbb0074ead7d6fbbc5312ef517fc8ca283b93e972491abfa2e7"
when OS.mac? && Hardware::CPU.arm?
url "https://github.com/Shopify/toxiproxy/releases/download/v#{app_version}/toxiproxy-cli-darwin-arm64"
sha256 "fb1cfef841dd5ddc85741122d965b87ae3ba8410b3d68cbb604eb345488f23b6"
when OS.linux? && Hardware::CPU.intel?
url "https://github.com/Shopify/toxiproxy/releases/download/v#{app_version}/toxiproxy-cli-linux-amd64"
sha256 "d0e219644aadc9210ebf355e054ebcace79a354bbc49d1a2d3bc48e6e527f329"
when OS.linux? && Hardware::CPU.arm?
url "https://github.com/Shopify/toxiproxy/releases/download/v#{app_version}/toxiproxy-cli-linux-arm64"
sha256 "445532bab56e9c7b1afe2bfd3c00cc69ff50b3e758604d2f29c7bd2ec4f7ab59"
end
end
test do
resource("cli").stage do
assert_match "toxiproxy-cli version #{app_version}", shell_output("#{bin}/toxiproxy-cli --version")
end
end
def install
host_os = OS.mac? ? "darwin" : "linux"
host_arch = Hardware::CPU.arm? ? "arm64" : "amd64"
platform = "#{host_os}-#{host_arch}"
bin.install "toxiproxy-server-#{platform}" => "toxiproxy-server"
resource("cli").stage do
bin.install "toxiproxy-cli-#{platform}" => "toxiproxy-cli"
end
end
service do
run [bin/"toxiproxy-server"]
keep_alive true
end
end