homebrew-core/Formula/ucloud.rb
2019-03-15 18:48:20 +01:00

31 lines
1.1 KiB
Ruby

class Ucloud < Formula
desc "The official tool to managment your ucloud services"
homepage "https://www.ucloud.cn"
url "https://github.com/ucloud/ucloud-cli/archive/0.1.13.tar.gz"
sha256 "0bd2a5a1bebc5b9e64979a1ad8b10e4ee4acc0e73954f489cd6e78378d1010d2"
bottle do
cellar :any_skip_relocation
sha256 "3625008f28ebed6dce908ed40f23b77603d8718cf2f075cf8ab55af4171291e9" => :mojave
sha256 "f6eb0a195170653990d3ccd1e2409d3f33520a12f91a5dfda32c6697951445c4" => :high_sierra
sha256 "eeedf3b122ec46f6c4507deece4a4a35ea13c669c7ea54d8772fcdd905c3d311" => :sierra
end
depends_on "go" => :build
def install
dir = buildpath/"src/github.com/ucloud/ucloud-cli"
dir.install buildpath.children
cd dir do
system "go", "build", "-o", bin/"ucloud"
prefix.install_metafiles
end
end
test do
system "#{bin}/ucloud", "config", "--project-id", "org-test", "--profile", "default"
config_json = (testpath/".ucloud/config.json").read
assert_match '"project_id":"org-test"', config_json
assert_match version.to_s, shell_output("#{bin}/ucloud --version")
end
end