2017-08-02 23:07:04 +00:00
|
|
|
class Dep < Formula
|
|
|
|
desc "Go dependency management tool"
|
|
|
|
homepage "https://github.com/golang/dep"
|
2017-08-04 15:02:31 +00:00
|
|
|
url "https://github.com/golang/dep/archive/v0.3.0.tar.gz"
|
|
|
|
sha256 "7d816ffb14f57c4b01352676998a8cda9e4fb24eaec92bd79526e1045c5a0c83"
|
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
|
2017-08-04 15:06:40 +00:00
|
|
|
sha256 "ae72261cfa4cf3f9b00b28d60ac8899324059a3d085b1dd1f68ce1a14a23b3ad" => :sierra
|
|
|
|
sha256 "7310e0170d08550d46040bc8a35933978e842e3ee900068ce6c377872ef7c99b" => :el_capitan
|
|
|
|
sha256 "acedf313471d97063c663dfab05952f2f5f6552512f72f759af57e63c2b758ac" => :yosemite
|
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
|
|
|
|
(buildpath/"src/github.com/golang/dep").install buildpath.children
|
|
|
|
cd "src/github.com/golang/dep" do
|
|
|
|
system "go", "build", "-o", bin/"dep", ".../cmd/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.undent
|
|
|
|
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
|