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.30.tar.gz" sha256 "e530eed28207bfd338973eeab5d9bc55848461f945428239cb541e2b9129e2b0" bottle do cellar :any_skip_relocation sha256 "f1aae3b84678badbab6ea0e3bc86891064435a7e54dfe7a859cc2ef33385309e" => :catalina sha256 "1daf5054177eeff3d121300dcbd5446ab8fd94e4c0fc33eddd6d92cb2ba61d0e" => :mojave sha256 "07a50033728c3e827b1eab78e91aa284aad2c8d12a6ff6ba0a8210461fda90e3" => :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" 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 [--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