Module: Homebrew::Unlink Private

Defined in:
unlink.rb

Overview

This module is part of a private API. This module may only be used in the Homebrew/brew repository. Third parties should avoid using this module if possible, as it may be removed or changed without warning.

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

Class Method Summary collapse

Class Method Details

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.



18
19
20
21
22
23
24
25
26
# File 'unlink.rb', line 18

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

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

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.



7
8
9
10
11
12
13
14
15
16
# File 'unlink.rb', line 7

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