homebrew-core/Formula/aliyun-cli.rb
2019-05-24 21:07:56 +08:00

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.16.tar.gz"
sha256 "4f603bcfe61a58ba362c0b3f8961769d67c28bb4334b24026103a6964eacbf19"
bottle do
cellar :any_skip_relocation
sha256 "be3f50fb2614baf8b786cb4244c0c0808c94f2a3789017d1ec538ef5f179dbd5" => :mojave
sha256 "458e62a796a99a9b96bf9f81c5f1a0002b93bb0ca28835c09b0e74128fe53565" => :high_sierra
sha256 "77fa499720f4a8dbe1b189d9664f3c3c710f8b6766f8d053c875e05a3347d8f0" => :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