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.

This method returns an undefined value.

Parameters:

  • keg (Keg)
  • dry_run (Boolean) (defaults to: false)
  • verbose (Boolean) (defaults to: false)


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

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.

This method returns an undefined value.

Parameters:

  • formula (Formula)
  • verbose (Boolean) (defaults to: false)


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

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