Class: Pakman::Finder

Inherits:
Object
  • Object
show all
Includes:
LogUtils::Logging
Defined in:
lib/pakman/finder.rb

Instance Method Summary collapse

Constructor Details

#initialize(old_logger_do_not_use = nil) ⇒ Finder

todo/fix: remove logger from c’tor use logutils instead



11
12
13
14
15
# File 'lib/pakman/finder.rb', line 11

def initialize( old_logger_do_not_use=nil )
  if old_logger_do_not_use != nil
       puts "*** depreciated API call [Pakman::Finder.initialize] - do NOT pass in logger; no longer required/needed; logger arg will get removed"
  end
end

Instance Method Details

#find_manifests(patterns, excludes = []) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/pakman/finder.rb', line 17

def find_manifests( patterns, excludes=[] )
  manifests = []
  
  patterns.each do |pattern|
    pattern.gsub!( '\\', '/')  # normalize path; make sure all path use / only
    logger.debug "Checking >#{pattern}<"
    Dir.glob( pattern ) do |file|
      logger.debug "  Found manifest candidate >#{file}<"
      if File.directory?( file ) # NB: do not include directories
        logger.debug "  Skipping match; it's a directory"
      else
        unless exclude?( file, excludes )  # check for excludes; skip if excluded
          logger.debug "  Adding match >#{file}<"
          
          ## todo/fix:
          # array first entry - downcase and gsub('.txt','') ??
          # use Pakman.pakname_from_file()
          
          manifests << [ File.basename( file ), file ]
        end
      end
    end
  end
  
  manifests
end