Class: Ki::FileFinder
- Inherits:
-
VersionIterator
- Object
- VersionIterator
- Ki::FileFinder
- Defined in:
- lib/data_access/version_iterators.rb
Instance Method Summary collapse
- #cross_any_matches?(arr, dest_arr) ⇒ Boolean
- #file_list ⇒ Object
- #file_map ⇒ Object
-
#file_operations(file_map, dependency) ⇒ Object
Modifies.
-
#ok_to_add_file(file, file_path) ⇒ Object
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.
Methods inherited from VersionIterator
#iterate_dependencies, #iterate_versions, #ok_to_iterate_dependency, #select_dep_rm, #start_iteration
Instance Method Details
#cross_any_matches?(arr, dest_arr) ⇒ Boolean
136 137 138 139 140 141 142 143 |
# 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 ⇒ Object
111 112 113 |
# File 'lib/data_access/version_iterators.rb', line 111 def file_list file_map.values end |
#file_map ⇒ Object
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# 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 = ver. # TODO: file operations should be applied to the files before the files are filtered .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, .cached_data) ret end end |
#file_operations(file_map, dependency) ⇒ Object
Modifies
116 117 118 119 120 121 |
# 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) ⇒ Object
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
128 129 130 131 132 133 134 |
# File 'lib/data_access/version_iterators.rb', line 128 def ok_to_add_file(file, file_path) = file["tags"] || [] (files.size == 0 || files.any_matches?(file_path)) && !exclude_files.any_matches?(file_path) && (.size == 0 || (cross_any_matches?(, )) && !cross_any_matches?(, )) end |