aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorJack Nagel2013-10-18 12:56:52 -0500
committerJack Nagel2013-10-18 13:38:19 -0500
commit0c3cb4274f63c827a7163409d34016e5ab4ddf68 (patch)
treee652e67d683567902f07f20b763a9ab47a791b58 /Library/Homebrew
parentf813dc3306e66c2b9a78d5cb6a8da2e118bb6b31 (diff)
downloadhomebrew-0c3cb4274f63c827a7163409d34016e5ab4ddf68.tar.bz2
Extract repeated conditional to a method
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/os/mac/xquartz.rb30
1 files changed, 12 insertions, 18 deletions
diff --git a/Library/Homebrew/os/mac/xquartz.rb b/Library/Homebrew/os/mac/xquartz.rb
index e46d8da27..f1102ed28 100644
--- a/Library/Homebrew/os/mac/xquartz.rb
+++ b/Library/Homebrew/os/mac/xquartz.rb
@@ -95,34 +95,28 @@ module OS
# found in the SDK, so we use sdk_path for both the headers and libraries.
# Confusingly, executables (e.g. config scripts) are only found under
# /opt/X11/bin or /usr/X11/bin in all cases.
+ def effective_prefix
+ if provided_by_apple? && Xcode.without_clt?
+ Pathname.new("#{OS::Mac.sdk_path}/usr/X11")
+ else
+ prefix
+ end
+ end
+
def bin
- Pathname.new("#{prefix}/bin")
+ prefix/"bin"
end
def include
- @include ||= if use_sdk?
- Pathname.new("#{MacOS.sdk_path}/usr/X11/include")
- else
- Pathname.new("#{prefix}/include")
- end
+ effective_prefix/"include"
end
def lib
- @lib ||= if use_sdk?
- Pathname.new("#{MacOS.sdk_path}/usr/X11/lib")
- else
- Pathname.new("#{prefix}/lib")
- end
+ effective_prefix/"lib"
end
def share
- Pathname.new("#{prefix}/share")
- end
-
- private
-
- def use_sdk?
- provided_by_apple? && Xcode.without_clt?
+ prefix/"share"
end
end
end