Class: Cleaner

Inherits:
Object
  • Object
show all
Defined in:
brew/Library/Homebrew/cleaner.rb,
brew/Library/Homebrew/extend/os/mac/cleaner.rb,
brew/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

Constructor Details

#initialize(f) ⇒ Cleaner

Create a cleaner for the given formula



14
15
16
# File 'brew/Library/Homebrew/cleaner.rb', line 14

def initialize(f)
  @f = f
end

Instance Method Details

#cleanObject

Clean the keg of formula @f



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

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