forked from Homebrew/homebrew-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdep.rb
57 lines (50 loc) · 1.89 KB
/
dep.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
class Dep < Formula
desc "Go dependency management tool"
homepage "https://github.com/golang/dep"
url "https://github.com/golang/dep.git",
:tag => "v0.5.4",
:revision => "1f7c19e5f52f49ffb9f956f64c010be14683468b"
head "https://github.com/golang/dep.git"
bottle do
cellar :any_skip_relocation
sha256 "33200b5422fac00416ac44c7c28ad5aa627b845cd4d9aeb7002f7d41304deab0" => :mojave
sha256 "29cfe5b8c29bfbb09a93087dfbd30a9894ed596d3a4219072f022a001d2975cd" => :high_sierra
sha256 "ef9a0a978cbf2d4e537d21c4ff7b89a75b66228697b0aa348daa2284bc7362a9" => :sierra
end
depends_on "go"
conflicts_with "deployer", :because => "both install `dep` binaries"
def install
ENV["GOPATH"] = buildpath
(buildpath/"src/github.com/golang/dep").install buildpath.children
cd "src/github.com/golang/dep" do
ENV["DEP_BUILD_PLATFORMS"] = "darwin"
ENV["DEP_BUILD_ARCHS"] = "amd64"
system "hack/build-all.bash"
bin.install "release/dep-darwin-amd64" => "dep"
prefix.install_metafiles
end
end
test do
# Default HOMEBREW_TEMP is /tmp, which is actually a symlink to /private/tmp.
# `dep` bails without `.realpath` as it expects $GOPATH to be a "real" path.
ENV["GOPATH"] = testpath.realpath
project = testpath/"src/github.com/project/testing"
(project/"hello.go").write <<~EOS
package main
import "fmt"
import "github.com/Masterminds/vcs"
func main() {
fmt.Println("Hello World")
}
EOS
cd project do
system bin/"dep", "init"
assert_predicate project/"vendor", :exist?, "Failed to init!"
inreplace "Gopkg.toml", /(version = ).*/, "\\1\"=1.11.0\""
system bin/"dep", "ensure"
assert_match "795e20f90", (project/"Gopkg.lock").read
output = shell_output("#{bin}/dep status")
assert_match %r{github.com/Masterminds/vcs\s+1.11.0\s}, output
end
end
end