homebrew-core/Formula/aliyun-cli.rb
2019-10-02 20:51:17 -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.26.tar.gz"
sha256 "fd5f9e32b408414f822468879d5926f264ce1d019ae7ab7c8732f0da89af64ca"
bottle do
cellar :any_skip_relocation
sha256 "29d933e6b78c1a577cb0f099d4eb4d8d84b707dfb073ba6eaea3701dc96a835f" => :catalina
sha256 "adf31a680a4423aa113eba2c7ca1e5483c1710a26b0523b456657d06da344160" => :mojave
sha256 "b2b36c1d5d5acc31d0fee6a1999e68aa2aa20c0d590ff353d629ee8ab04e0384" => :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