aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula
diff options
context:
space:
mode:
authorDominyk Tiller2015-02-07 21:16:47 +0000
committerMike McQuaid2015-02-13 17:53:41 +0000
commit7fae0b6204ca7ccb532fb6420ce406bab5e15695 (patch)
tree7ba8b48d2eb6e9c2e5ea11ce3c9308df7dd10f83 /Library/Formula
parent1cc099bfbee0b9d4f0bd76a22cd7b0e37698c3a6 (diff)
downloadhomebrew-7fae0b6204ca7ccb532fb6420ce406bab5e15695.tar.bz2
slimerjs: add firefox requirement
Closes #36399 Closes #36635. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Diffstat (limited to 'Library/Formula')
-rw-r--r--Library/Formula/slimerjs.rb57
1 files changed, 43 insertions, 14 deletions
diff --git a/Library/Formula/slimerjs.rb b/Library/Formula/slimerjs.rb
index 81c7a8921..e9ec7dea5 100644
--- a/Library/Formula/slimerjs.rb
+++ b/Library/Formula/slimerjs.rb
@@ -1,8 +1,23 @@
+class FirefoxDependency < Requirement
+ fatal true
+
+ def self.firefox_installation
+ paths = ["~/Applications/FirefoxNightly.app", "~/Applications/Firefox.app",
+ "/Applications/FirefoxNightly.app", "/Applications/Firefox.app"]
+ paths.find { |p| File.exist? File.expand_path(p) }
+ end
+
+ satisfy { FirefoxDependency.firefox_installation }
+
+ def message
+ "Firefox must be installed unless building with xulrunner"
+ end
+end
+
class Slimerjs < Formula
homepage "http://www.slimerjs.org"
url "http://download.slimerjs.org/releases/0.9.5/slimerjs-0.9.5-mac.tar.bz2"
sha256 "4333ae1c7898789c71b65ba5767cd1781290cdad36cb64d58ef289933482c81b"
-
head "https://github.com/laurentj/slimerjs.git"
bottle do
@@ -11,9 +26,18 @@ class Slimerjs < Formula
sha1 "aa5654afdd8d2dc049878d2898b9fb7fa33911ab" => :mountain_lion
end
- if MacOS.version > :snow_leopard
- option "without-xulrunner", "Build without xulrunner (requires a installed Firefox)"
- depends_on "xulrunner" => :recommended
+ option "without-xulrunner", "Build with xulrunner"
+
+ # Min supported OS X version by Firefox & xulrunner is 10.6
+ depends_on :macos => :leopard
+
+ # xulrunner will not currently build on Yosemite.
+ if MacOS.version >= :yosemite
+ depends_on FirefoxDependency
+ elsif build.with? "xulrunner"
+ depends_on "xulrunner"
+ else
+ depends_on FirefoxDependency
end
def install
@@ -25,19 +49,24 @@ class Slimerjs < Formula
bin.install_symlink libexec/"slimerjs"
end
- def caveats; <<-EOS.undent
- You can set the environment variable SLIMERJSLAUNCHER to a installation of
- Mozilla Firefox (or Mozilla XULRunner) to use this version with SlimerJS
- instead of the one installed by Homebrew (this is required if built without
- xulrunner).
- For a standard Mozilla Firefox installation this would be:
+ def caveats
+ s = ""
- export SLIMERJSLAUNCHER=/Applications/Firefox.app/Contents/MacOS/firefox
+ if (firefox_installation = FirefoxDependency.firefox_installation)
+ s += <<-EOS.undent
+ You MUST provide an installation of Mozilla Firefox and set
+ the environment variable SLIMERJSLAUNCHER pointing to it, e.g.:
- Note: If you use SlimerJS with an unstable version of Mozilla
- Firefox/XULRunner (>29.*) you may have to change the [Gecko]MaxVersion in:
- #{libexec}/application.ini
+ export SLIMERJSLAUNCHER=#{firefox_installation}/Contents/MacOS/firefox
+ EOS
+ end
+ s += <<-EOS.undent
+
+ Note: If you use SlimerJS with an unstable version of Mozilla Firefox/XULRunner (>36.*)
+ you may have to change the [Gecko]MaxVersion in #{libexec}/application.ini
EOS
+
+ s
end
test do