|
| 1 | +require "language/go" |
| 2 | + |
| 3 | +class Scw < Formula |
| 4 | + homepage "https://github.com/scaleway/scaleway-cli" |
| 5 | + url "https://github.com/scaleway/scaleway-cli/archive/v1.0.0.tar.gz" |
| 6 | + sha256 "7a674320bc3298bf50dd2b50a9312c5baa159d5c2bf6f9abae539c9fc931fdce" |
| 7 | + |
| 8 | + head "https://github.com/scaleway/scaleway-cli.git" |
| 9 | + |
| 10 | + depends_on "go" => :build |
| 11 | + |
| 12 | + go_resource "github.com/tools/godep" do |
| 13 | + url "https://github.com/tools/godep.git", :revision => "58d90f262c13357d3203e67a33c6f7a9382f9223" |
| 14 | + end |
| 15 | + |
| 16 | + go_resource "github.com/kr/fs" do |
| 17 | + url "https://github.com/kr/fs.git", :revision => "2788f0dbd16903de03cb8186e5c7d97b69ad387b" |
| 18 | + end |
| 19 | + |
| 20 | + go_resource "golang.org/x/tools" do |
| 21 | + url "https://github.com/golang/tools.git", :revision => "473fd854f8276c0b22f17fb458aa8f1a0e2cf5f5" |
| 22 | + end |
| 23 | + |
| 24 | + #go_resource "golang.org/x/crypto" do |
| 25 | + # url "https://github.com/golang/crypto.git", :revision => "8b27f58b78dbd60e9a26b60b0d908ea642974b6d" |
| 26 | + #end |
| 27 | + |
| 28 | + #go_resource "github.com/scaleway/scaleway-cli" do |
| 29 | + # url "https://github.com/scaleway/scaleway-cli.git", :revision => "799e3bcdd7c72fdbb5d6dcf65f99654fc0fffc0b" |
| 30 | + #end |
| 31 | + |
| 32 | + |
| 33 | + def install |
| 34 | + ENV["GOPATH"] = buildpath |
| 35 | + ENV["CGO_ENABLED"] = "0" |
| 36 | + ENV.prepend_create_path "PATH", buildpath/"bin" |
| 37 | + |
| 38 | + #mkdir_p buildpath/"Godeps/_workspace/src/github.com/scaleway" |
| 39 | + #ln_s buildpath, buildpath/"Godeps/_workspace/src/github.com/scaleway/scaleway-cli" |
| 40 | + |
| 41 | + mkdir_p buildpath/"src/github.com/scaleway" |
| 42 | + ln_s buildpath, buildpath/"src/github.com/scaleway/scaleway-cli" |
| 43 | + Language::Go.stage_deps resources, buildpath/"src" |
| 44 | + |
| 45 | + cd "src/github.com/tools/godep" do |
| 46 | + system "go", "install" |
| 47 | + end |
| 48 | + |
| 49 | + system "make scwversion/version.go" |
| 50 | + system "./bin/godep", "get" |
| 51 | + system "./bin/godep", "go", "build", "-o", "scw" |
| 52 | + bin.install "scw" |
| 53 | + |
| 54 | + bash_completion.install "contrib/completion/bash/scw" |
| 55 | + zsh_completion.install "contrib/completion/zsh/_scw" |
| 56 | + end |
| 57 | + |
| 58 | + test do |
| 59 | + output = shell_output(bin/"scw version") |
| 60 | + assert output.include? "Client version: v1.0.0" |
| 61 | + assert output.include? "Git commit (client): 799e3bcdd7c72fdbb5d6dcf65f99654fc0fffc0b" |
| 62 | + end |
| 63 | +end |
0 commit comments