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.22.tar.gz"
|
|
sha256 "878288818de5cd517c5c12c34bb43716d49057ed9bd9c35f0410d9b12a687cd3"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "a13aee3ce53b22fb15d02a9e34fb797d233324066eca0b02f4b835247a8d6a8f" => :mojave
|
|
sha256 "58819878b6834afb7c074d3c71882dbf6dbe508ed63bc61a24035cf754f29d6d" => :high_sierra
|
|
sha256 "18df9905c1f0f02d6668542d3fcc65994775ed0b9f46f9b037b8d6612b74b06e" => :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
|