Class: Homebrew::Cmd::PrettyListing Private

Inherits:
Object
  • Object
show all
Defined in:
cmd/list.rb

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

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ void

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.

Parameters:



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
# File 'cmd/list.rb', line 237

def initialize(path)
  Pathname.new(path).children.sort_by { |p| p.to_s.downcase }.each do |pn|
    case pn.basename.to_s
    when "bin", "sbin"
      pn.find { |pnn| puts pnn unless pnn.directory? }
    when "lib"
      print_dir pn do |pnn|
        # dylibs have multiple symlinks and we don't care about them
        (pnn.extname == ".dylib" || pnn.extname == ".pc") && !pnn.symlink?
      end
    when ".brew"
      next # Ignore .brew
    else
      if pn.directory?
        if pn.symlink?
          puts "#{pn} -> #{pn.readlink}"
        else
          print_dir pn
        end
      elsif Metafiles.list?(pn.basename.to_s)
        puts pn
      end
    end
  end
end