2017-08-02 23:07:04 +00:00
|
|
|
class Dep < Formula
|
|
|
|
desc "Go dependency management tool"
|
|
|
|
homepage "https://github.com/golang/dep"
|
2018-01-27 18:30:12 +00:00
|
|
|
url "https://github.com/golang/dep.git",
|
|
|
|
:tag => "v0.4.1",
|
|
|
|
:revision => "37d9ea0ac16f0e0a05afc3b60e1ac8c364b6c329"
|
|
|
|
revision 1
|
2017-08-02 23:07:04 +00:00
|
|
|
head "https://github.com/golang/dep.git"
|
|
|
|
|
2017-08-03 06:22:00 +00:00
|
|
|
bottle do
|
|
|
|
cellar :any_skip_relocation
|
2018-01-27 18:34:15 +00:00
|
|
|
sha256 "0b974c08cfb94c31a652908312620e6dac1a617ffd2d21816c5e9c8f259ea559" => :high_sierra
|
|
|
|
sha256 "4e6e39bb9678fd4ddf200a80ba657f09d3d91bd133f5795775153a3aa12688eb" => :sierra
|
|
|
|
sha256 "4e95ecf37819ce91f1e52a6b11e6c875c2e9b3b17edba1b919c55ffc98ba95cf" => :el_capitan
|
2017-08-03 06:22:00 +00:00
|
|
|
end
|
|
|
|
|
2017-08-02 23:07:04 +00:00
|
|
|
depends_on "go"
|
|
|
|
|
|
|
|
def install
|
|
|
|
ENV["GOPATH"] = buildpath
|
2018-01-27 18:30:12 +00:00
|
|
|
arch = MacOS.prefer_64_bit? ? "amd64" : "386"
|
2017-08-02 23:07:04 +00:00
|
|
|
(buildpath/"src/github.com/golang/dep").install buildpath.children
|
|
|
|
cd "src/github.com/golang/dep" do
|
2018-01-27 18:30:12 +00:00
|
|
|
ENV["DEP_BUILD_PLATFORMS"] = "darwin"
|
|
|
|
ENV["DEP_BUILD_ARCHS"] = arch
|
|
|
|
system "hack/build-all.bash"
|
|
|
|
bin.install "release/dep-darwin-#{arch}" => "dep"
|
2017-08-02 23:07:04 +00:00
|
|
|
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"
|
2017-10-18 10:10:48 +00:00
|
|
|
(project/"hello.go").write <<~EOS
|
2017-08-02 23:07:04 +00:00
|
|
|
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
|