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" url "https://github.com/scaleway/scaleway-cli/archive/v1.8.0.tar.gz" sha256 "5f09f335f90686fad7973f721586173a68445d94099cc794a6270b171b0081b3" head "https://github.com/scaleway/scaleway-cli.git" bottle do cellar :any_skip_relocation sha256 "80aeacf21861e70429b6faa0ab644735318f81a70ab99fa47e0ee1769ede46c8" => :el_capitan sha256 "13734f51932668e43423df09e8b4b8976c251f9466154ccdc1d3aa37bc55eda6" => :yosemite sha256 "dadda460440d1c8e74596af69d0bebdbbc7cdabd6ecbb2b8ceae581b4d61981b" => :mavericks end depends_on "go" => :build def install ENV["GOPATH"] = buildpath ENV["GOBIN"] = buildpath (buildpath/"src/github.com/scaleway/scaleway-cli").install Dir["*"] system "go", "build", "-o", "#{bin}/scw", "-v", "-ldflags", "-X github.com/scaleway/scaleway-cli/pkg/scwversion.GITCOMMIT=homebrew", "github.com/scaleway/scaleway-cli/cmd/scw/" bash_completion.install "src/github.com/scaleway/scaleway-cli/contrib/completion/bash/scw" zsh_completion.install "src/github.com/scaleway/scaleway-cli/contrib/completion/zsh/_scw" end test do output = shell_output(bin/"scw version") assert_match "OS/Arch (client): darwin/amd64", output end end