59 lines
2.0 KiB
Ruby
59 lines
2.0 KiB
Ruby
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 "326ba98bcef16dc8823dd9fe76657e6ff0088a0669c0f857a05dd51867220bb7" => :catalina
|
|
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
|