linkapps: stop linking .app bundles from 'bin/'

`Keg#app_installed?` only checks the formula prefix and `libexec/` for
.app bundles to determine if a formula provides any. This is used by
`Caveats#app_caveats` to generate an appropriate message. The same list
should be used by `brew linkapps` for consistency.

Reduce likelihood of future inconsistencies by creating `Keg#apps` and
using it in place of the duplicate code.

Closes Homebrew/homebrew#45173.

Signed-off-by: Xu Cheng <xucheng@me.com>
This commit is contained in:
Martin Afanasjew 2015-10-20 07:05:21 +02:00 committed by Xu Cheng
parent 51392352ad
commit fdd3469fca
2 changed files with 8 additions and 5 deletions

View File

@ -23,11 +23,9 @@ module Homebrew
end
kegs.each do |keg|
keg = keg.opt_record if keg.optlinked?
Dir["#{keg}/*.app", "#{keg}/bin/*.app", "#{keg}/libexec/*.app"].each do |app|
keg.apps.each do |app|
puts "Linking #{app} to #{target_dir}."
app_name = File.basename(app)
target = "#{target_dir}/#{app_name}"
target = "#{target_dir}/#{app.basename}"
if File.exist?(target) && !File.symlink?(target)
onoe "#{target} already exists, skipping."

View File

@ -253,8 +253,13 @@ class Keg
Dir["#{path}/lib/python2.7/site-packages/*.pth"].any?
end
def apps
app_prefix = optlinked? ? opt_record : path
Pathname.glob("#{app_prefix}/{,libexec/}*.app")
end
def app_installed?
Dir["#{path}/{,libexec/}*.app"].any?
!apps.empty?
end
def elisp_installed?