44 lines
1.7 KiB
Ruby
44 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.56.tar.gz"
|
|
sha256 "2c8aa50d18702c8b8066b58272f143fc7c742d50335a25841ea319270be1135b"
|
|
license "Apache-2.0"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "268ee78cc8af1c93a96cf6082f03bf627aa7f772058f17cf7e2129981c957a90" => :catalina
|
|
sha256 "e0df3220e590dd96a26947c6f5830a6dca22633e78c3eef1e51aa2a9cde3f422" => :mojave
|
|
sha256 "227461d864a15bf3217a177f00c1a80ce2c33490ee3b39cc776307421982e918" => :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"
|
|
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
|