41 lines
1.6 KiB
Ruby
41 lines
1.6 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.20.tar.gz"
|
|
sha256 "bd7dca93a1099ef6506a438a9b08d2b3781e61377f241a9797e02907f1f8b8f6"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "3b358db6eb574be04befe1f16d684850eceaaf1e354064f7283dfbacb0dada66" => :mojave
|
|
sha256 "89977e70a11a166c8fa46ff4fa4667af32bdef443d0f2b767242f6e279a98d16" => :high_sierra
|
|
sha256 "bea0d212abea8e92ba26a42ea0b1a9b7d215d7f73bd617ffd4564bd122fe4718" => :sierra
|
|
end
|
|
|
|
depends_on "go"
|
|
|
|
def install
|
|
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
|