homebrew-core/Formula/aliyun-cli.rb
2019-12-21 21:08:36 +01: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.31.tar.gz"
sha256 "bbb43571c716623d5e22744013e7c41d1abea072995e435c533b2ee5aef979b1"
bottle do
cellar :any_skip_relocation
sha256 "0536f343bcc6510a24d4f890164bdd7878a10b752325e0c4b5bc00c64e868357" => :catalina
sha256 "1dcae7e7eca09153b07121218423b079a9f127744a58c59d3f0fff25c56b0210" => :mojave
sha256 "f056931cc0c0aa271fad502d0ec95898b1a49a5726e704d82e6146f070755dda" => :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