|
| 1 | +class WalG < Formula |
| 2 | + desc "Archival restoration tool for databases" |
| 3 | + homepage "https://github.com/wal-g/wal-g" |
| 4 | + url "https://github.com/wal-g/wal-g/archive/refs/tags/v3.0.7.tar.gz" |
| 5 | + sha256 "69368316b90fae7c040e489ad540f6018d0f00963c5bc94d262d530e83bdd4ce" |
| 6 | + license "Apache-2.0" |
| 7 | + |
| 8 | + bottle do |
| 9 | + sha256 cellar: :any, arm64_tahoe: "8aa6dcd7b9a17e0d53a37d54c020c88602e7e4e64712c6aeec5acd30047c4fa7" |
| 10 | + sha256 cellar: :any, arm64_sequoia: "c64d5ad15282efaf311ca082f96e4b190b0dd3f26df838c430f343ec00236356" |
| 11 | + sha256 cellar: :any, arm64_sonoma: "aee2c57633ed2939227c23d119a6f398345da14bd3f894ececdfb12218dd8853" |
| 12 | + sha256 cellar: :any, sonoma: "8c1cccbeff937880545db272acf046cc328ef1021e73d1d6694a9dbf06ccad3b" |
| 13 | + sha256 cellar: :any_skip_relocation, x86_64_linux: "d6f9f6d8dae5a52ba674f4bf21190df5e62dbc75222419da9e67b3c62213c781" |
| 14 | + end |
| 15 | + |
| 16 | + depends_on "go" => :build |
| 17 | + depends_on "brotli" |
| 18 | + depends_on "libsodium" |
| 19 | + depends_on "lzo" |
| 20 | + |
| 21 | + def install |
| 22 | + %w[etcd fdb gp mongo mysql pg redis sqlserver].each do |db| |
| 23 | + ldflags = %W[ |
| 24 | + -s -w |
| 25 | + -X github.com/wal-g/wal-g/cmd/#{db}.buildDate=#{time.iso8601} |
| 26 | + -X github.com/wal-g/wal-g/cmd/#{db}.gitRevision=#{tap.user} |
| 27 | + -X github.com/wal-g/wal-g/cmd/#{db}.walgVersion=#{version} |
| 28 | + ] |
| 29 | + output = bin/"wal-g-#{db}" |
| 30 | + tags = %w[brotli libsodium lzo] |
| 31 | + system "go", "build", *std_go_args(ldflags:, output:, tags:), "./main/#{db}" |
| 32 | + end |
| 33 | + end |
| 34 | + |
| 35 | + test do |
| 36 | + ENV["WALG_FILE_PREFIX"] = testpath |
| 37 | + |
| 38 | + %w[etcd fdb gp mongo mysql pg redis sqlserver].each do |db| |
| 39 | + assert_match version.to_s, shell_output("#{bin}/wal-g-#{db} --version") |
| 40 | + |
| 41 | + flags = case db |
| 42 | + when "gp" |
| 43 | + "--config #{testpath}" |
| 44 | + when "mongo" |
| 45 | + "--mongodb-uri mongodb://" |
| 46 | + end |
| 47 | + assert_match "No backups found", shell_output("#{bin}/wal-g-#{db} backup-list #{flags} 2>&1") |
| 48 | + end |
| 49 | + end |
| 50 | +end |
0 commit comments