2014-02-13 12:41:18 +00:00
|
|
|
require "formula"
|
|
|
|
|
|
|
|
class GoInstalled < Requirement
|
|
|
|
fatal true
|
|
|
|
default_formula "go"
|
|
|
|
satisfy { which "go" }
|
|
|
|
|
|
|
|
def message
|
|
|
|
"Go is required to use gpm."
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class Gpm < Formula
|
|
|
|
homepage "https://github.com/pote/gpm"
|
2014-06-17 14:33:25 +00:00
|
|
|
url "https://github.com/pote/gpm/archive/v1.2.3.tar.gz"
|
|
|
|
sha1 "dc616876b874f01e7eaec75ef34f13e43df7ae91"
|
2014-02-13 12:41:18 +00:00
|
|
|
|
2014-03-09 17:06:26 +00:00
|
|
|
bottle do
|
|
|
|
cellar :any
|
2014-04-19 15:00:48 +00:00
|
|
|
sha1 "623057df59619c9fb9fda82d85a5aed696c49bb2" => :mavericks
|
|
|
|
sha1 "ebbfe75b3aae977a55ba3de9df09bb8fa3b161b6" => :mountain_lion
|
|
|
|
sha1 "dc68290e961ccfb91cb688262be917dc55f728bc" => :lion
|
2014-03-09 17:06:26 +00:00
|
|
|
end
|
|
|
|
|
2014-02-13 12:41:18 +00:00
|
|
|
depends_on GoInstalled
|
|
|
|
|
|
|
|
def install
|
|
|
|
system "./configure", "--prefix=#{prefix}"
|
|
|
|
system "make", "install"
|
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
|
|
|
Pathname("Godeps").write "github.com/pote/gpm-testing-package v6.1"
|
|
|
|
|
|
|
|
ENV["GOPATH"] = testpath
|
2014-05-20 15:51:29 +00:00
|
|
|
system bin/"gpm", "install"
|
2014-02-13 12:41:18 +00:00
|
|
|
|
|
|
|
Pathname("go_code.go").write <<-EOS.undent
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"github.com/pote/gpm-testing-package"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
fmt.Print(gpm_testing_package.Version())
|
|
|
|
}
|
|
|
|
EOS
|
2014-05-20 15:51:29 +00:00
|
|
|
|
|
|
|
out = `go run go_code.go`
|
|
|
|
assert_equal "v6.1", out
|
|
|
|
assert_equal 0, $?.exitstatus
|
2014-02-13 12:41:18 +00:00
|
|
|
end
|
|
|
|
end
|