Module: Homebrew::Unlink

Defined in:
Library/Homebrew/unlink.rb

Overview

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

Class Method Summary collapse

Class Method Details


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

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
# File 'Library/Homebrew/unlink.rb', line 9

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