diff options
| author | Jack Nagel | 2013-10-04 12:43:30 -0500 |
|---|---|---|
| committer | Jack Nagel | 2013-10-04 12:44:05 -0500 |
| commit | d2386f07b05fb583927471a637184af6fbe99acb (patch) | |
| tree | 90b359ac2b194f133d553d0bdcf53a154fda46c1 | |
| parent | 3a098ad8fcbb5e9d4b3af6ce3a8d7883035848d2 (diff) | |
| download | homebrew-d2386f07b05fb583927471a637184af6fbe99acb.tar.bz2 | |
Fetch yields the key, use it
| -rw-r--r-- | Library/Homebrew/macos.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Library/Homebrew/macos.rb b/Library/Homebrew/macos.rb index 7d9f2e4a0..19cbbe421 100644 --- a/Library/Homebrew/macos.rb +++ b/Library/Homebrew/macos.rb @@ -17,8 +17,8 @@ module MacOS extend self # Don't call tools (cc, make, strip, etc.) directly! # Give the name of the binary you look for as a string to this method # in order to get the full path back as a Pathname. - (@locate ||= {}).fetch(tool.to_s) do - @locate[tool.to_s] = if File.executable?(path = "/usr/bin/#{tool}") + (@locate ||= {}).fetch(tool.to_s) do |key| + @locate[key] = if File.executable?(path = "/usr/bin/#{tool}") Pathname.new path # Homebrew GCCs most frequently; much faster to check this before xcrun # This also needs to be queried if xcrun won't work, e.g. CLT-only @@ -76,7 +76,7 @@ module MacOS extend self end def sdk_path(v = version) - (@sdk_path ||= {}).fetch(v.to_s) do + (@sdk_path ||= {}).fetch(v.to_s) do |key| opts = [] # First query Xcode itself opts << `#{locate('xcodebuild')} -version -sdk macosx#{v} Path 2>/dev/null`.chomp unless Xcode.bad_xcode_select_path? @@ -84,7 +84,7 @@ module MacOS extend self opts << "#{Xcode.prefix}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX#{v}.sdk" # Xcode < 4.3 style opts << "/Developer/SDKs/MacOSX#{v}.sdk" - @sdk_path[v.to_s] = opts.map { |a| Pathname.new(a) }.detect(&:directory?) + @sdk_path[key] = opts.map { |a| Pathname.new(a) }.detect(&:directory?) end end @@ -250,14 +250,14 @@ module MacOS extend self def mdfind id return [] unless MACOS - (@mdfind ||= {}).fetch(id.to_s) do - @mdfind[id.to_s] = `/usr/bin/mdfind "kMDItemCFBundleIdentifier == '#{id}'"`.split("\n") + (@mdfind ||= {}).fetch(id.to_s) do |key| + @mdfind[key] = `/usr/bin/mdfind "kMDItemCFBundleIdentifier == '#{key}'"`.split("\n") end end def pkgutil_info id - (@pkginfo ||= {}).fetch(id.to_s) do - @pkginfo[id.to_s] = `/usr/sbin/pkgutil --pkg-info "#{id}" 2>/dev/null`.strip + (@pkginfo ||= {}).fetch(id.to_s) do |key| + @pkginfo[key] = `/usr/sbin/pkgutil --pkg-info "#{key}" 2>/dev/null`.strip end end end |
