Use Homebrew to detect if X11 is installed.
This commit is contained in:
parent
88d0e8c2e6
commit
006f25d8cf
@ -179,7 +179,7 @@ module Hbc
|
|||||||
|
|
||||||
def x11_dependencies
|
def x11_dependencies
|
||||||
return unless @cask.depends_on.x11
|
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
|
end
|
||||||
|
|
||||||
def formula_dependencies
|
def formula_dependencies
|
||||||
|
|||||||
@ -171,14 +171,6 @@ module Hbc
|
|||||||
def pre_mavericks_accessibility_dotfile
|
def pre_mavericks_accessibility_dotfile
|
||||||
@pre_mavericks_accessibility_dotfile ||= Pathname.new("/private/var/db/.AccessibilityAPIEnabled")
|
@pre_mavericks_accessibility_dotfile ||= Pathname.new("/private/var/db/.AccessibilityAPIEnabled")
|
||||||
end
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -93,6 +93,7 @@ describe "Satisfy Dependencies and Requirements" do
|
|||||||
describe "depends_on x11" do
|
describe "depends_on x11" do
|
||||||
it "succeeds when depends_on x11 is satisfied" do
|
it "succeeds when depends_on x11 is satisfied" do
|
||||||
x11_cask = Hbc.load("with-depends-on-x11")
|
x11_cask = Hbc.load("with-depends-on-x11")
|
||||||
|
MacOS::X11.stubs(:installed?).returns(true)
|
||||||
shutup do
|
shutup do
|
||||||
Hbc::Installer.new(x11_cask).install
|
Hbc::Installer.new(x11_cask).install
|
||||||
end
|
end
|
||||||
@ -100,7 +101,7 @@ describe "Satisfy Dependencies and Requirements" do
|
|||||||
|
|
||||||
it "raises an exception when depends_on x11 is not satisfied" do
|
it "raises an exception when depends_on x11 is not satisfied" do
|
||||||
x11_cask = Hbc.load("with-depends-on-x11")
|
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 {
|
lambda {
|
||||||
shutup do
|
shutup do
|
||||||
Hbc::Installer.new(x11_cask).install
|
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
|
it "never raises when depends_on x11: false" do
|
||||||
x11_cask = Hbc.load("with-depends-on-x11-false")
|
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
|
lambda do
|
||||||
shutup do
|
shutup do
|
||||||
Hbc::Installer.new(x11_cask).install
|
Hbc::Installer.new(x11_cask).install
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user