2018-10-09 11:41:01 +00:00
|
|
|
class Fluxctl < Formula
|
|
|
|
desc "Command-line tool to access Weave Flux, the Kubernetes GitOps operator"
|
|
|
|
homepage "https://github.com/weaveworks/flux"
|
|
|
|
url "https://github.com/weaveworks/flux.git",
|
2018-12-20 10:09:15 +00:00
|
|
|
:tag => "1.8.2",
|
|
|
|
:revision => "e3baeeb98fcbb7b267bf94ca5184833e75ec779c"
|
2018-10-09 11:41:01 +00:00
|
|
|
|
2018-11-01 13:59:27 +00:00
|
|
|
bottle do
|
|
|
|
cellar :any_skip_relocation
|
2018-12-20 12:47:15 +00:00
|
|
|
sha256 "91bbddffb277989db8712eb26f76e7d81a18ff5caaef4d8ad37fd5493faf6d97" => :mojave
|
|
|
|
sha256 "f0ef0358d27ee89d14367863a3161be73933f1d3a8563fcb15171dbe2bbc4821" => :high_sierra
|
|
|
|
sha256 "c72d112d9567103a79da77e21e7c25df6fb6e2f8fc2ae6aa5a89dd24e85ff59e" => :sierra
|
2018-11-01 13:59:27 +00:00
|
|
|
end
|
|
|
|
|
2018-10-09 11:41:01 +00:00
|
|
|
depends_on "dep" => :build
|
|
|
|
depends_on "go" => :build
|
|
|
|
|
|
|
|
def install
|
|
|
|
ENV["GOPATH"] = buildpath
|
|
|
|
dir = buildpath/"src/github.com/weaveworks/flux"
|
|
|
|
dir.install buildpath.children - [buildpath/".brew_home"]
|
|
|
|
|
|
|
|
cd dir do
|
|
|
|
system "dep", "ensure", "-vendor-only"
|
|
|
|
system "make", "release-bins"
|
|
|
|
bin.install "build/fluxctl_darwin_amd64" => "fluxctl"
|
|
|
|
prefix.install_metafiles
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
|
|
|
run_output = shell_output("#{bin}/fluxctl 2>&1")
|
|
|
|
assert_match "fluxctl helps you deploy your code.", run_output
|
|
|
|
|
|
|
|
version_output = shell_output("#{bin}/fluxctl version 2>&1")
|
|
|
|
assert_match version.to_s, version_output
|
|
|
|
|
|
|
|
# As we can't bring up a Kubernetes cluster in this test, we simply
|
|
|
|
# run "fluxctl sync" and check that it 1) errors out, and 2) complains
|
|
|
|
# about a missing .kube/config file.
|
|
|
|
require "pty"
|
|
|
|
require "timeout"
|
|
|
|
r, _w, pid = PTY.spawn("#{bin}/fluxctl sync", :err=>:out)
|
|
|
|
begin
|
|
|
|
Timeout.timeout(5) do
|
|
|
|
assert r.gets.chomp =~ %r{Error: stat .*\/.kube\/config: no such file or directory}
|
|
|
|
Process.wait pid
|
|
|
|
assert_equal 1, $CHILD_STATUS.exitstatus
|
|
|
|
end
|
|
|
|
rescue Timeout::Error
|
|
|
|
puts "process not finished in time, killing it"
|
|
|
|
Process.kill("TERM", pid)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|