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

class SnowLeopardOrNewer < Requirement
  def satisfied?
    MacOS.snow_leopard?
  end

  def message
    "PhantomJS requires Mac OS X 10.6 (Snow Leopard) or newer."
  end
end

class Phantomjs < Formula
  homepage 'http://www.phantomjs.org/'
  url "http://phantomjs.googlecode.com/files/phantomjs-1.5.0-macosx-static.zip"
  sha1 'b87152ce691e7ed1937d30f86bc706a408d47f64'

  depends_on SnowLeopardOrNewer.new

  # phantomjs wrapper script to hide dock icon
  # See http://code.google.com/p/phantomjs/issues/detail?id=281
  def script; <<-EOS.undent
    #!/bin/sh
    exec "#{libexec}/phantomjs" "$@"
    EOS
  end

  def install
    libexec.install 'bin/phantomjs', 'bin/Info.plist'
    (bin+'phantomjs').write script
  end
end