aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMarkus Reiter2016-12-04 21:35:43 +0100
committerMarkus Reiter2016-12-04 23:19:15 +0100
commit006f25d8cfa5ffa9e4c531d49dcc99fe312edff6 (patch)
tree74184d30f9f6455cec07f694db4f31060c61713c /Library
parent88d0e8c2e6c02d07111d99250e24f2bc201c8444 (diff)
downloadbrew-006f25d8cfa5ffa9e4c531d49dcc99fe312edff6.tar.bz2
Use Homebrew to detect if X11 is installed.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cask/lib/hbc/installer.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/locations.rb8
-rw-r--r--Library/Homebrew/cask/test/cask/depends_on_test.rb5
3 files changed, 4 insertions, 11 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/installer.rb b/Library/Homebrew/cask/lib/hbc/installer.rb
index 57efe97e9..afdaa2ec5 100644
--- a/Library/Homebrew/cask/lib/hbc/installer.rb
+++ b/Library/Homebrew/cask/lib/hbc/installer.rb
@@ -179,7 +179,7 @@ module Hbc
def x11_dependencies
return unless @cask.depends_on.x11
- raise CaskX11DependencyError, @cask.token if Hbc.x11_libpng.select(&:exist?).empty?
+ raise CaskX11DependencyError, @cask.token unless MacOS::X11.installed?
end
def formula_dependencies
diff --git a/Library/Homebrew/cask/lib/hbc/locations.rb b/Library/Homebrew/cask/lib/hbc/locations.rb
index 7a0bde1b0..f28e84b2e 100644
--- a/Library/Homebrew/cask/lib/hbc/locations.rb
+++ b/Library/Homebrew/cask/lib/hbc/locations.rb
@@ -171,14 +171,6 @@ module Hbc
def pre_mavericks_accessibility_dotfile
@pre_mavericks_accessibility_dotfile ||= Pathname.new("/private/var/db/.AccessibilityAPIEnabled")
end
-
- def x11_executable
- @x11_executable ||= Pathname.new("/usr/X11/bin/X")
- end
-
- def x11_libpng
- @x11_libpng ||= [Pathname.new("/opt/X11/lib/libpng.dylib"), Pathname.new("/usr/X11/lib/libpng.dylib")]
- end
end
end
end
diff --git a/Library/Homebrew/cask/test/cask/depends_on_test.rb b/Library/Homebrew/cask/test/cask/depends_on_test.rb
index 31e51b5e5..ce2e54178 100644
--- a/Library/Homebrew/cask/test/cask/depends_on_test.rb
+++ b/Library/Homebrew/cask/test/cask/depends_on_test.rb
@@ -93,6 +93,7 @@ describe "Satisfy Dependencies and Requirements" do
describe "depends_on x11" do
it "succeeds when depends_on x11 is satisfied" do
x11_cask = Hbc.load("with-depends-on-x11")
+ MacOS::X11.stubs(:installed?).returns(true)
shutup do
Hbc::Installer.new(x11_cask).install
end
@@ -100,7 +101,7 @@ describe "Satisfy Dependencies and Requirements" do
it "raises an exception when depends_on x11 is not satisfied" do
x11_cask = Hbc.load("with-depends-on-x11")
- Hbc.stubs(:x11_libpng).returns([Pathname.new("/usr/path/does/not/exist")])
+ MacOS::X11.stubs(:installed?).returns(false)
lambda {
shutup do
Hbc::Installer.new(x11_cask).install
@@ -110,7 +111,7 @@ describe "Satisfy Dependencies and Requirements" do
it "never raises when depends_on x11: false" do
x11_cask = Hbc.load("with-depends-on-x11-false")
- Hbc.stubs(:x11_executable).returns(Pathname.new("/usr/path/does/not/exist"))
+ MacOS::X11.stubs(:installed?).returns(false)
lambda do
shutup do
Hbc::Installer.new(x11_cask).install