github.com/scaleway/scaleway-cli@v1.11.1/contrib/homebrew/scw.rb (about)

     1  require "language/go"
     2  
     3  class Scw < Formula
     4    desc "Manage BareMetal Servers from Command Line (as easily as with Docker)"
     5    homepage "https://github.com/scaleway/scaleway-cli"
     6    url "https://github.com/scaleway/scaleway-cli/archive/v1.11.tar.gz"
     7    sha256 "4d27d0b0dc0dc28dd8df36c10e4afc7e3f884b26926dcdf7b889525025209ff6"
     8    version "1.11"
     9  
    10    head "https://github.com/scaleway/scaleway-cli.git"
    11  
    12    depends_on "go" => :build
    13  
    14    def install
    15      ENV["GOPATH"] = buildpath
    16      ENV["GOBIN"] = buildpath
    17      ENV["GO15VENDOREXPERIMENT"] = "1"
    18      (buildpath/"src/github.com/scaleway/scaleway-cli").install Dir["*"]
    19  
    20      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/"
    21   # we remove our .scw-cache.db file, to clean the cache of scw
    22   # this file is created and handled by scw
    23      rm_f "~/.scw-cache.db"
    24  
    25      bash_completion.install "src/github.com/scaleway/scaleway-cli/contrib/completion/bash/scw"
    26      zsh_completion.install "src/github.com/scaleway/scaleway-cli/contrib/completion/zsh/_scw"
    27    end
    28  
    29    def caveats
    30      "Use `scw login` to set up the correct environment to use scaleway-cli."
    31    end
    32  
    33    test do
    34      output = shell_output(bin/"scw version")
    35      assert_match "OS/Arch (client): darwin/amd64", output
    36    end
    37  end