Method: Pod::Source::Manager#search_by_name
- Defined in:
- lib/cocoapods-core/source/manager.rb
#search_by_name(query, full_text_search = false) ⇒ Array<Set>
Search all the sources with the given search term.
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/cocoapods-core/source/manager.rb', line 120 def search_by_name(query, full_text_search = false) query_word_regexps = query.split.map { |word| /#{word}/i } if full_text_search query_word_results_hash = {} updated_search_index.each_value do |word_spec_hash| word_spec_hash.each_pair do |word, spec_names| query_word_regexps.each do |query_word_regexp| set = (query_word_results_hash[query_word_regexp] ||= Set.new) set.merge(spec_names) if word =~ query_word_regexp end end end found_set_names = query_word_results_hash.values.reduce(:&) found_set_names ||= [] sets_from_non_indexable = all_non_indexable.map { |s| s.search_by_name(query, true) }.flatten found_set_names += sets_from_non_indexable.map(&:name).flatten.uniq sets = found_set_names.map do |name| aggregate.representative_set(name) end # Remove nil values because representative_set return nil if no pod is found in any of the sources. sets.compact! else sets = aggregate.search_by_name(query, false) end if sets.empty? extra = ', author, summary, or description' if full_text_search raise Informative, "Unable to find a pod with name#{extra} " \ "matching `#{query}`" end sorted_sets(sets, query_word_regexps) end |