diff --git a/Library/Homebrew/cask/lib/hbc/installer.rb b/Library/Homebrew/cask/lib/hbc/installer.rb index 57efe97e959ea85de2de02ed34e9b141041b906b..afdaa2ec535a00aa3fab86059799cf9ed1dbcc6b 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 7a0bde1b06dda3646e9b2d8a9592465416947b44..f28e84b2ef7ce057a5247caf026e85eb78b18d83 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 31e51b5e5e6bcee93a06127c03d4944a9f5116bf..ce2e5417830df0e9261f81c07659ee06f937f9d2 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