homebrew-core/Formula/aliyun-cli.rb
2019-10-16 13:16:37 -04:00

42 lines
1.7 KiB
Ruby

class AliyunCli < Formula
desc "Universal Command-Line Interface for Alibaba Cloud"
homepage "https://github.com/aliyun/aliyun-cli"
url "https://github.com/aliyun/aliyun-cli/archive/v3.0.29.tar.gz"
sha256 "11c6b62b3f13a5b9770186c155ff29fb7af30efd82547278c08eaa138e05631f"
bottle do
cellar :any_skip_relocation
sha256 "14a843db82b5c7e9ad0d29a65d4c30284b8c5d6cd78e33e3a349881adc4d7d4a" => :catalina
sha256 "511c16b3fec01eccb5dc389131b324a03611e6f24cb3e80ab3db8ceb7a18e8fd" => :mojave
sha256 "178df7640f2902eb910e9aa10b69d211fec68368f824d6705f88042b33c87476" => :high_sierra
end
depends_on "go" => :build
def install
ENV["GO111MODULE"] = "off"
ENV["GOPATH"] = buildpath
ENV["PATH"] = "#{ENV["PATH"]}:#{buildpath}/bin"
(buildpath/"src/github.com/aliyun/aliyun-cli").install buildpath.children
cd "src/github.com/aliyun/aliyun-cli" do
system "make", "metas"
system "go", "build", "-o", bin/"aliyun", "-ldflags", "-X 'github.com/aliyun/aliyun-cli/cli.Version=#{version}'", "main/main.go"
prefix.install_metafiles
end
end
test do
version_out = shell_output("#{bin}/aliyun version")
assert_match version.to_s, version_out
help_out = shell_output("#{bin}/aliyun --help")
assert_match "Alibaba Cloud Command Line Interface Version #{version}", help_out
assert_match "", help_out
assert_match "Usage:", help_out
assert_match "aliyun <product> <operation> [--parameter1 value1 --parameter2 value2 ...]", help_out
oss_out = shell_output("#{bin}/aliyun oss")
assert_match "Object Storage Service", oss_out
assert_match "aliyun oss [command] [args...] [options...]", oss_out
end
end