Module: Homebrew::Unlink

Defined in:
brew/Library/Homebrew/unlink.rb

Overview

Provides helper methods for unlinking formulae and kegs with consistent output.

Class Method Summary collapse

Class Method Details



21
22
23
24
25
26
27
28
29
# File 'brew/Library/Homebrew/unlink.rb', line 21

def unlink(keg, dry_run: false, verbose: false)
  options = { dry_run: dry_run, verbose: verbose }

  keg.lock do
    print "Unlinking #{keg}... "
    puts if verbose
    puts "#{keg.unlink(**options)} symlinks removed"
  end
end


9
10
11
12
13
14
15
16
17
18
19
# File 'brew/Library/Homebrew/unlink.rb', line 9

def unlink_versioned_formulae(formula, verbose: false)
  formula.versioned_formulae
         .select(&:keg_only?)
         .select(&:linked?)
         .map(&:any_installed_keg)
         .compact
         .select(&:directory?)
         .each do |keg|
    unlink(keg, verbose: verbose)
  end
end