aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/forego.rb
blob: 7a8e77d051318524946edfe2af265266dec374a7 (plain)
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
require "formula"
require "language/go"

class Forego < Formula
  homepage "https://github.com/ddollar/forego"
  url "https://github.com/ddollar/forego/archive/v0.13.1.tar.gz"
  sha1 "63ed315ef06159438e3501512a5b307486d49d5c"

  head "https://github.com/ddollar/forego.git"

  bottle do
    sha1 "9eac8ca38f6a4557b30737529f8be85b7afb11bb" => :mavericks
    sha1 "4a08f819f67056758915c4624868e3dc1b012431" => :mountain_lion
    sha1 "1fdb5c2c67b2990a3e71f4d4bde9a872662718c3" => :lion
  end

  depends_on "go" => :build

  go_resource "github.com/kr/godep" do
    url "https://github.com/kr/godep.git", :revision => "edcaa96f040b31f4186738decac57f88d6061b8d"
  end

  go_resource "github.com/kr/fs" do
    url "https://github.com/kr/fs.git", :revision => "2788f0dbd16903de03cb8186e5c7d97b69ad387b"
  end

  go_resource "code.google.com/p/go.tools" do
    url "https://code.google.com/p/go.tools/", :revision => "140fcaadc586", :using => :hg
  end

  def install
    ENV["GOPATH"] = buildpath
    Language::Go.stage_deps resources, buildpath/"src"

    cd "src/github.com/kr/godep" do
      system "go", "install"
    end

    ldflags = "-X main.Version #{version} -X main.allowUpdate false"
    system "./bin/godep", "go", "build", "-ldflags", ldflags, "-o", "forego"
    bin.install "forego"
  end

  test do
    (testpath/"Procfile").write("web: echo \"it works!\"")
    assert `#{bin}/forego start` =~ /it works!/
  end
end