homebrew-core/Formula/werf.rb

77 lines
2.6 KiB
Ruby

class Werf < Formula
desc "Consistent delivery tool for Kubernetes"
homepage "https://werf.io/"
url "https://github.com/werf/werf/archive/refs/tags/v1.2.144.tar.gz"
sha256 "785035eda4192adf12fc78414f1ea125f90c59183387ec4f5580aadde4d28391"
license "Apache-2.0"
head "https://github.com/werf/werf.git", branch: "main"
# This repository has some tagged versions that are higher than the newest
# stable release (e.g., `v1.5.2`) and the `GithubLatest` strategy is
# currently necessary to identify the correct latest version.
livecheck do
url :stable
strategy :github_latest
end
bottle do
sha256 cellar: :any_skip_relocation, arm64_monterey: "48e68a9ab129a833a56afe5ae47c6306544575f52621ba7d46c1a42e5d6b77aa"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "78f4e593f8777df900c879a04fb1ca7258e38c802d097f461e4fbceba05c15ac"
sha256 cellar: :any_skip_relocation, monterey: "7d9d8456563dedaea3209005ed310616c39ded228d690656a69cc61b3d9c9d2b"
sha256 cellar: :any_skip_relocation, big_sur: "750732593158e8ea4a65b12138908336ad74c3ab422bba99142216c4732e8c5f"
sha256 cellar: :any_skip_relocation, catalina: "62104a3934f4a864427c3f8b5a365a684b1bc938f7137fa51891e9518673b8d2"
end
depends_on "go" => :build
# due to missing libbtrfs headers, only supports macos at the moment
depends_on :macos
def install
ldflags = "-s -w -X github.com/werf/werf/pkg/werf.Version=#{version}"
tags = "dfrunmount dfssh containers_image_openpgp"
system "go", "build", *std_go_args(ldflags: ldflags), "-tags", tags, "./cmd/werf"
bash_output = Utils.safe_popen_read(bin/"werf", "completion", "bash")
(bash_completion/"werf").write bash_output
zsh_output = Utils.safe_popen_read(bin/"werf", "completion", "zsh")
(zsh_completion/"_werf").write zsh_output
fish_output = Utils.safe_popen_read(bin/"werf", "completion", "fish")
(fish_completion/"werf.fish").write fish_output
end
test do
werf_config = testpath/"werf.yaml"
werf_config.write <<~EOS
configVersion: 1
project: quickstart-application
---
image: vote
dockerfile: Dockerfile
context: vote
---
image: result
dockerfile: Dockerfile
context: result
---
image: worker
dockerfile: Dockerfile
context: worker
EOS
output = <<~EOS
- image: vote
- image: result
- image: worker
EOS
system "git", "init"
system "git", "add", werf_config
system "git", "commit", "-m", "Initial commit"
assert_equal output, shell_output("#{bin}/werf config graph")
assert_match version.to_s, shell_output("#{bin}/werf version")
end
end