Method: Pod::Source::Manager#update_search_index_if_needed
- Defined in:
- lib/cocoapods-core/source/manager.rb
#update_search_index_if_needed(changed_spec_paths) ⇒ Object
Updates the stored search index if there are changes in spec repos while updating them. Update is performed incrementally. Only the changed pods’ search data is re-generated and updated.
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
# File 'lib/cocoapods-core/source/manager.rb', line 217 def update_search_index_if_needed(changed_spec_paths) search_index = stored_search_index return unless search_index changed_spec_paths.each_pair do |source, spec_paths| next unless source.indexable? index_for_source = search_index[source.name] next unless index_for_source && !spec_paths.empty? updated_pods = source.pods_for_specification_paths(spec_paths) new_index = aggregate.generate_search_index_for_changes_in_source(source, spec_paths) # First traverse search_index and update existing words # Remove traversed words from new_index after adding to search_index, # so that only non existing words will remain in new_index after enumeration completes. index_for_source.each_pair do |word, _| if new_index[word] index_for_source[word] |= new_index[word] new_index.delete(word) else index_for_source[word] -= updated_pods end end # Now add non existing words remained in new_index to search_index index_for_source.merge!(new_index) end save_search_index(search_index) end |