diff options
| author | Martin Afanasjew | 2015-10-20 07:05:21 +0200 | 
|---|---|---|
| committer | Xu Cheng | 2015-10-20 18:25:28 +0800 | 
| commit | fdd3469fca62eab96ed0c111451ba0e0a2efbbcc (patch) | |
| tree | d5fdd99a3b60d8e6ac800632c5a98a4a59264d54 | |
| parent | 51392352adc73b10c227b71153e66ba620cfb2fd (diff) | |
| download | brew-fdd3469fca62eab96ed0c111451ba0e0a2efbbcc.tar.bz2 | |
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>
| -rw-r--r-- | Library/Homebrew/cmd/linkapps.rb | 6 | ||||
| -rw-r--r-- | Library/Homebrew/keg.rb | 7 | 
2 files changed, 8 insertions, 5 deletions
| diff --git a/Library/Homebrew/cmd/linkapps.rb b/Library/Homebrew/cmd/linkapps.rb index 9a58bd37a..dba9beaa5 100644 --- a/Library/Homebrew/cmd/linkapps.rb +++ b/Library/Homebrew/cmd/linkapps.rb @@ -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." diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb index 1d0361983..9b548b83a 100644 --- a/Library/Homebrew/keg.rb +++ b/Library/Homebrew/keg.rb @@ -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? | 
