2015-07-01 17:49:26 +00:00
|
|
|
require "language/go"
|
|
|
|
|
|
|
|
class Scw < Formula
|
|
|
|
desc "Manage BareMetal Servers from Command Line (as easily as with Docker)"
|
|
|
|
homepage "https://github.com/scaleway/scaleway-cli"
|
2015-08-29 01:19:22 +00:00
|
|
|
url "https://github.com/scaleway/scaleway-cli/archive/v1.4.0.tar.gz"
|
|
|
|
sha256 "ab7ee002be9557eb2b8075e3b0df340f5e379545152049f2512f1dc2b47b7b8a"
|
2015-07-01 17:49:26 +00:00
|
|
|
|
|
|
|
head "https://github.com/scaleway/scaleway-cli.git"
|
|
|
|
|
2015-07-13 04:37:33 +00:00
|
|
|
bottle do
|
|
|
|
cellar :any
|
2015-08-30 06:45:55 +00:00
|
|
|
sha256 "6685d169c38c3e629edec78b900a53e24a3d0096ff90d38c7d57ac42026de4ef" => :yosemite
|
|
|
|
sha256 "2c3c748e2c755820bb710caa7461b53483d4f17314e17997fb33e239e3d20014" => :mavericks
|
|
|
|
sha256 "3be8334bace6d1bb8a7ddc69e30f87bbff362264b81a40f3f8f487310c1f9186" => :mountain_lion
|
2015-07-13 04:37:33 +00:00
|
|
|
end
|
|
|
|
|
2015-07-01 17:49:26 +00:00
|
|
|
depends_on "go" => :build
|
|
|
|
|
|
|
|
def install
|
|
|
|
ENV["GOPATH"] = buildpath
|
|
|
|
ENV["CGO_ENABLED"] = "0"
|
|
|
|
ENV.prepend_create_path "PATH", buildpath/"bin"
|
|
|
|
|
|
|
|
mkdir_p buildpath/"src/github.com/scaleway"
|
|
|
|
ln_s buildpath, buildpath/"src/github.com/scaleway/scaleway-cli"
|
|
|
|
Language::Go.stage_deps resources, buildpath/"src"
|
|
|
|
|
2015-08-29 01:19:22 +00:00
|
|
|
inreplace "pkg/scwversion/placeholder.go" do |s|
|
|
|
|
s.gsub! /VERSION = "master"/, "VERSION = \"v#{version}\""
|
|
|
|
s.gsub! /GITCOMMIT = "master"/, "GITCOMMIT = \"v#{version}\""
|
|
|
|
end
|
|
|
|
system "go", "build", "-o", "scw", "./cmd/scw"
|
2015-07-01 17:49:26 +00:00
|
|
|
bin.install "scw"
|
|
|
|
|
|
|
|
bash_completion.install "contrib/completion/bash/scw"
|
|
|
|
zsh_completion.install "contrib/completion/zsh/_scw"
|
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
|
|
|
output = shell_output(bin/"scw version")
|
2015-07-20 12:57:17 +00:00
|
|
|
assert_match "OS/Arch (client): darwin/amd64", output
|
2015-07-01 17:49:26 +00:00
|
|
|
end
|
|
|
|
end
|