63 lines
2.2 KiB
Ruby
63 lines
2.2 KiB
Ruby
class OperatorSdk < Formula
|
|
desc "SDK for building Kubernetes applications"
|
|
homepage "https://coreos.com/operators/"
|
|
url "https://github.com/operator-framework/operator-sdk.git",
|
|
:tag => "v0.13.0",
|
|
:revision => "1af9c95bb51420c55a7f7f2b7fabebda24451276"
|
|
head "https://github.com/operator-framework/operator-sdk.git"
|
|
|
|
bottle do
|
|
sha256 "5f0df35407d0935355d8ca3b3f4a88dd369cb9577128b710b706292b89851091" => :catalina
|
|
sha256 "058eb7ae1a7d751896fa6d446e40052b2dc129c978b79e52a6443183523736f5" => :mojave
|
|
sha256 "dc6af1ae6f031379060a1c547c2122e68ff64c7959e6f9526f6717cb38b62499" => :high_sierra
|
|
end
|
|
|
|
depends_on "go"
|
|
|
|
def install
|
|
# TODO: Do not set GOROOT. This is a fix for failing tests when compiled with Go 1.13.
|
|
# See https://github.com/Homebrew/homebrew-core/pull/43820.
|
|
ENV["GOROOT"] = Formula["go"].opt_libexec
|
|
|
|
ENV["GOPATH"] = buildpath
|
|
|
|
dir = buildpath/"src/github.com/operator-framework/operator-sdk"
|
|
dir.install buildpath.children - [buildpath/".brew_home"]
|
|
dir.cd do
|
|
# Make binary
|
|
system "make", "install"
|
|
bin.install buildpath/"bin/operator-sdk"
|
|
|
|
# Install bash completion
|
|
output = Utils.popen_read("#{bin}/operator-sdk completion bash")
|
|
(bash_completion/"operator-sdk").write output
|
|
|
|
# Install zsh completion
|
|
output = Utils.popen_read("#{bin}/operator-sdk completion zsh")
|
|
(zsh_completion/"_operator-sdk").write output
|
|
|
|
prefix.install_metafiles
|
|
end
|
|
end
|
|
|
|
test do
|
|
# Use the offical golang module cache to prevent network flakes and allow
|
|
# this test to complete before timing out.
|
|
ENV["GOPROXY"] = "https://proxy.golang.org"
|
|
|
|
if build.stable?
|
|
version_output = shell_output("#{bin}/operator-sdk version")
|
|
assert_match "version: \"v#{version}\"", version_output
|
|
assert_match stable.specs[:revision], version_output
|
|
end
|
|
|
|
# Create a new, blank operator
|
|
system "#{bin}/operator-sdk", "new", "test", "--repo=github.com/example-inc/app-operator"
|
|
|
|
cd "test" do
|
|
# Add an example API resource. This exercises most of the various pieces
|
|
# of generation logic.
|
|
system "#{bin}/operator-sdk", "add", "api", "--api-version=app.example.com/v1alpha1", "--kind=AppService"
|
|
end
|
|
end
|
|
end
|