2015-09-10 23:35:22 +00:00
|
|
|
class Doctl < Formula
|
|
|
|
desc "Command-line tool for DigitalOcean"
|
|
|
|
homepage "https://github.com/digitalocean/doctl"
|
2016-08-02 17:22:41 +00:00
|
|
|
url "https://github.com/digitalocean/doctl/archive/v1.4.0.tar.gz"
|
|
|
|
sha256 "02c1f9a4fe7c954077f64ca95082e58a366ee4c69a745b9e23a1576c17cd56fa"
|
2015-09-10 23:35:22 +00:00
|
|
|
head "https://github.com/digitalocean/doctl.git"
|
|
|
|
|
2015-10-11 15:01:07 +00:00
|
|
|
bottle do
|
|
|
|
cellar :any_skip_relocation
|
2016-09-17 07:08:36 +00:00
|
|
|
sha256 "145dd12baa5b95270997b8c2c148cd50e229e35155bccb1cab41fa11048b4d5f" => :sierra
|
2016-08-02 18:09:21 +00:00
|
|
|
sha256 "d49767c9c7c1ada9f1e5698905294b059181f4b2a8873a17efd37c39f2293a50" => :el_capitan
|
|
|
|
sha256 "fb15026d64104ae934c2de11d259b03073645307de481321140fb6070a06f167" => :yosemite
|
|
|
|
sha256 "5c1796da8e8efb8e6cb9a16d8ed2ad8bab3b34a20b27d096f544f9e70c1adcfb" => :mavericks
|
2015-10-11 15:01:07 +00:00
|
|
|
end
|
|
|
|
|
2015-09-10 23:35:22 +00:00
|
|
|
depends_on "go" => :build
|
|
|
|
|
|
|
|
def install
|
2016-03-26 17:52:26 +00:00
|
|
|
ENV["GOPATH"] = buildpath
|
|
|
|
|
2015-09-10 23:35:22 +00:00
|
|
|
mkdir_p buildpath/"src/github.com/digitalocean/"
|
|
|
|
ln_sf buildpath, buildpath/"src/github.com/digitalocean/doctl"
|
|
|
|
|
2016-04-14 13:49:33 +00:00
|
|
|
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"
|
2015-09-10 23:35:22 +00:00
|
|
|
bin.install "doctl"
|
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
2016-06-07 19:36:16 +00:00
|
|
|
assert_match "doctl version #{version}-release", shell_output("#{bin}/doctl version")
|
2015-09-10 23:35:22 +00:00
|
|
|
end
|
|
|
|
end
|