class Ki::FileFinder

Public Instance Methods

cross_any_matches?(arr, dest_arr) click to toggle source
# File lib/data_access/version_iterators.rb, line 136
def cross_any_matches?(arr, dest_arr)
  arr.each do |i|
    if dest_arr.any_matches?(i)
      return true
    end
  end
  false
end
file_list() click to toggle source
# File lib/data_access/version_iterators.rb, line 111
def file_list
  file_map.values
end
file_map() click to toggle source
# File lib/data_access/version_iterators.rb, line 88
def file_map
  start_iteration do |ver_iterator|
    ret = {}
    ver_iterator.iterate_dependencies.each do |dependency, version, file_map|
      file_operations(file_map, dependency)
      ret.merge!(file_map)
    end
    ver = ver_iterator.version
    binaries = ver.binaries
    metadata = ver.metadata
    # TODO: file operations should be applied to the files before the files are filtered
    metadata.files.each do |file|
      path = file["path"]
      file_path = File.join([ver_iterator.package_path, path].compact)
      if ok_to_add_file(file, file_path)
        ret[file_path]=binaries.path(path)
      end
    end
    file_operations(ret, metadata.cached_data)
    ret
  end
end
file_operations(file_map, dependency) click to toggle source

Modifies

# File lib/data_access/version_iterators.rb, line 116
def file_operations(file_map, dependency)
  operations = dependency["operations"]
  if operations
    VersionFileOperations.new.edit_file_map(file_map, operations)
  end
end
ok_to_add_file(file, file_path) click to toggle source

File is added to the list if

  • files pattern list is empty (select all files) or file path matches any files pattern

  • it does not match any file exclude patterns

  • tags selection list is empty or file has any tags from tags selection list

  • no tags match tags from tags exclusion list

# File lib/data_access/version_iterators.rb, line 128
def ok_to_add_file(file, file_path)
  file_tags = file["tags"] || []
  (files.size == 0 || files.any_matches?(file_path)) &&
      !exclude_files.any_matches?(file_path) &&
      (tags.size == 0 || (cross_any_matches?(file_tags, tags)) &&
          !cross_any_matches?(file_tags, exclude_tags))
end