aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/phantomjs.rb
blob: e3e15324a11f9a713ae8c988c82de30b499b7aa1 (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
require "formula"

class Phantomjs < Formula
  homepage "http://www.phantomjs.org/"

  stable do
    url "https://github.com/ariya/phantomjs/archive/1.9.8.tar.gz"
    sha256 "3a321561677f678ca00137c47689e3379c7fe6b83f7597d2d5de187dd243f7be"
  end

  bottle do
    cellar :any
    sha1 "d7016751675b1b7948e712b7c90e38f698527ae7" => :yosemite
    sha1 "cb2da81b59d7b5825645d4a598876539a99bf65c" => :mavericks
    sha1 "c43984e9ffb64d628f27b64bae5b75cbfd9dcfc2" => :mountain_lion
  end

  head "https://github.com/ariya/phantomjs.git"

  depends_on "openssl"

  def install
    if build.stable? && MacOS.prefer_64_bit?
      inreplace "src/qt/preconfig.sh", "-arch x86", "-arch x86_64"
    end
    system "./build.sh", "--confirm", "--jobs", ENV.make_jobs,
      "--qt-config", "-openssl-linked"
    bin.install "bin/phantomjs"
    (share+"phantomjs").install "examples"
  end

  test do
    path = testpath/"test.js"
    path.write <<-EOS
      console.log("hello");
      phantom.exit();
    EOS

    assert_equal "hello", shell_output("#{bin}/phantomjs #{path}").strip
  end
end