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.13.tar.gz"
|
|
sha256 "876c4ddc8c4129054196e6420735c600556710df03265cf72291840909a0d9e1"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "3c40d0c1097ba545b7cdfae4e3d1ca813786b840eb8dcece6303eb5790e1a3a0" => :mojave
|
|
sha256 "af4c2c0ac4a4216b7b5c56ab1c3e453c83c978c7e3bb0224a6aef6674456265e" => :high_sierra
|
|
sha256 "1b4348fda79b013d82539258912092cc3c5c43ac21e62ac78b19c832b1f1c270" => :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
|