41 lines
1.5 KiB
Ruby
41 lines
1.5 KiB
Ruby
class Doctl < Formula
|
|
desc "Command-line tool for DigitalOcean"
|
|
homepage "https://github.com/digitalocean/doctl"
|
|
url "https://github.com/digitalocean/doctl/archive/v1.8.0.tar.gz"
|
|
sha256 "061cb88758d20a3736161716b6846fbf1973efba804849b4f829c749a23afa0e"
|
|
head "https://github.com/digitalocean/doctl.git"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "e6c8a1363871602fd03f687061c3832431b0c34573fc28532b6a94ab3bc5061b" => :high_sierra
|
|
sha256 "64a0c9ec87233d7cc9ea8f62d2e1b5affbaa5dc3cf016eae42e57579019c058e" => :sierra
|
|
sha256 "cd850c8e9e8302dcd68d6dae577ead99fe4c693e0f6f4fab11e83deb93345746" => :el_capitan
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
|
|
def install
|
|
ENV["GOPATH"] = buildpath
|
|
|
|
mkdir_p buildpath/"src/github.com/digitalocean/"
|
|
ln_sf buildpath, buildpath/"src/github.com/digitalocean/doctl"
|
|
|
|
doctl_version = version.to_s.split(/\./)
|
|
base_flag = "-X github.com/digitalocean/doctl"
|
|
ldflags = %W[
|
|
#{base_flag}.Major=#{doctl_version[0]}
|
|
#{base_flag}.Minor=#{doctl_version[1]}
|
|
#{base_flag}.Patch=#{doctl_version[2]}
|
|
#{base_flag}.Label=release
|
|
].join(" ")
|
|
system "go", "build", "-ldflags", ldflags, "github.com/digitalocean/doctl/cmd/doctl"
|
|
bin.install "doctl"
|
|
|
|
(bash_completion/"doctl").write `#{bin}/doctl completion bash`
|
|
(zsh_completion/"doctl").write `#{bin}/doctl completion zsh`
|
|
end
|
|
|
|
test do
|
|
assert_match "doctl version #{version}-release", shell_output("#{bin}/doctl version")
|
|
end
|
|
end
|