Class: Cleaner

Inherits:
Object
  • Object
show all
Includes:
Context
Defined in:
Library/Homebrew/cleaner.rb,
Library/Homebrew/extend/os/mac/cleaner.rb,
Library/Homebrew/extend/os/linux/cleaner.rb

Overview

Cleans a newly installed keg. By default:

  • removes .la files
  • removes perllocal.pod files
  • removes .packlist files
  • removes empty directories
  • sets permissions on executables
  • removes unresolved symlinks

Instance Method Summary collapse

Methods included from Context

current, current=, #debug?, #quiet?, #verbose?, #with_context

Constructor Details

#initialize(f) ⇒ Cleaner

Create a cleaner for the given formula


16
17
18
# File 'Library/Homebrew/cleaner.rb', line 16

def initialize(f)
  @f = f
end

Instance Method Details

#cleanObject

Clean the keg of formula @f


21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'Library/Homebrew/cleaner.rb', line 21

def clean
  ObserverPathnameExtension.reset_counts!

  # Many formulae include 'lib/charset.alias', but it is not strictly needed
  # and will conflict if more than one formula provides it
  observe_file_removal @f.lib/"charset.alias"

  [@f.bin, @f.sbin, @f.lib].each { |d| clean_dir(d) if d.exist? }

  # Get rid of any info 'dir' files, so they don't conflict at the link stage
  info_dir_file = @f.info/"dir"
  observe_file_removal info_dir_file if info_dir_file.file? && !@f.skip_clean?(info_dir_file)

  prune
end