homebrew-core/Formula/operator-sdk.rb
2019-05-23 08:28:39 +08:00

50 lines
1.5 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.8.1"
head "https://github.com/operator-framework/operator-sdk.git"
bottle do
cellar :any_skip_relocation
sha256 "9f11a93f335489bd5ed27b3e296ea947e772efebfc434fa96af9fc567603277f" => :mojave
sha256 "11f706a313d0af27e25e816abd89e94fabc022f00f88f36c420d4d35829c3ecb" => :high_sierra
sha256 "13d461d6b758400847271eeeb681a61417dce9ac5734ac9fc90db41647c567f8" => :sierra
end
depends_on "dep"
depends_on "go"
def install
ENV["GOPATH"] = buildpath
dir = buildpath/"src/github.com/operator-framework/operator-sdk"
dir.install buildpath.children - [buildpath/".brew_home"]
cd dir 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
ENV["GOPATH"] = testpath
ENV["GO111MODULE"] = "on"
dir = testpath/"src/example.com/test-operator"
dir.mkpath
cd dir do
# Create a new, blank operator framework
system "#{bin}/operator-sdk", "new", "test"
end
end
end