42 lines
1.7 KiB
Ruby
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.32.tar.gz"
|
|
sha256 "1a147f0570d8c419fa28cb4aa7017ebf4f5ac628dd93a8f61890733b06d75585"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "3a9b28c46c8196061b543f798a1b8f8fe2f99baa0341ee39199542b1f3acbf8c" => :catalina
|
|
sha256 "75ce845adf1574aa34e3e0e664d893d933e47dc102d2068b9f2f80d803685926" => :mojave
|
|
sha256 "0baeae821616069c1d47c2b60f14891fbcb9ec3fb3b35368d9e64a663ac933e8" => :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
|