homebrew-core/Formula/mmctl.rb

42 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.21.0",
:revision => "2be537e89bd395a85643520eb1d5c28d7a6c93cf"
head "https://github.com/mattermost/mmctl.git"
bottle do
cellar :any_skip_relocation
sha256 "8305ed8770d1f84ed3bd5022a872e34b10ced136e6b11667be8afd9ae4552e78" => :catalina
sha256 "2ad46f59adc0624a21d8e58995915ac14b0c0d0285f4ec74cf1b64b0ab8c22dd" => :mojave
sha256 "81163ac683788d2f9d49913f20113bc1c50c39a9e68c3322314192390598b9cb" => :high_sierra
end
depends_on "go" => :build
def install
ENV["GOBIN"] = buildpath/bin
ENV["ADVANCED_VET"] = "FALSE"
ENV["BUILD_HASH"] = Utils.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.popen_read("#{bin}/mmctl completion bash")
(bash_completion/"mmctl").write output
output = Utils.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