diff options
| author | Jack Nagel | 2013-10-18 12:56:52 -0500 |
|---|---|---|
| committer | Jack Nagel | 2013-10-18 13:38:19 -0500 |
| commit | 0c3cb4274f63c827a7163409d34016e5ab4ddf68 (patch) | |
| tree | e652e67d683567902f07f20b763a9ab47a791b58 /Library/Homebrew/os | |
| parent | f813dc3306e66c2b9a78d5cb6a8da2e118bb6b31 (diff) | |
| download | homebrew-0c3cb4274f63c827a7163409d34016e5ab4ddf68.tar.bz2 | |
Extract repeated conditional to a method
Diffstat (limited to 'Library/Homebrew/os')
| -rw-r--r-- | Library/Homebrew/os/mac/xquartz.rb | 30 |
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 |
