Class: Cleaner

Inherits:
Object
  • Object
show all
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

Constructor Details

#initialize(f) ⇒ Cleaner

Create a cleaner for the given formula



11
12
13
# File 'Library/Homebrew/cleaner.rb', line 11

def initialize(f)
  @f = f
end

Instance Method Details

#cleanObject

Clean the keg of formula @f



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

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"
  if info_dir_file.file? && !@f.skip_clean?(info_dir_file)
    observe_file_removal info_dir_file
  end

  prune
end