homebrew-core/Formula/mmctl.rb

43 lines
1.5 KiB
Ruby

class Mmctl < Formula
desc "Remote CLI tool for Mattermost server"
homepage "https://github.com/mattermost/mmctl"
url "https://github.com/mattermost/mmctl.git",
:tag => "v5.25.0",
:revision => "c81bdf8d687f76c5da0205f8f612dc7f48969ca0"
head "https://github.com/mattermost/mmctl.git"
bottle do
cellar :any_skip_relocation
rebuild 1
sha256 "415f9f7185ece2cade017d9e5ace6843d60e9d298cac1e3159f954bd8cdf7da6" => :catalina
sha256 "b9516986947dcbe5bb62707b68d8b831dd0423d722f01151bef3e31582edae47" => :mojave
sha256 "5ca91ee16f3a798b7c9b68f589d5dc76b5b89ef01035f77871c2c03f087783a5" => :high_sierra
end
depends_on "go" => :build
def install
ENV["GOBIN"] = buildpath/bin
ENV["ADVANCED_VET"] = "FALSE"
ENV["BUILD_HASH"] = Utils.safe_popen_read("git", "rev-parse", "HEAD").chomp
ENV["BUILD_VERSION"] = version.to_s
(buildpath/"src/github.com/mattermost/mmctl").install buildpath.children
cd "src/github.com/mattermost/mmctl" do
system "make", "install"
# Install the zsh and bash completions
output = Utils.safe_popen_read("#{bin}/mmctl", "completion", "bash")
(bash_completion/"mmctl").write output
output = Utils.safe_popen_read("#{bin}/mmctl", "completion", "zsh")
(zsh_completion/"_mmctl").write output
end
end
test do
output = pipe_output("#{bin}/mmctl help 2>&1")
assert_no_match /.*No such file or directory.*/, output
assert_no_match /.*command not found.*/, output
assert_match /.*mmctl \[command\].*/, output
end
end