Method: Pod::CDNSource#ensure_versions_file_loaded

Defined in:
lib/cocoapods-core/cdn_source.rb

#ensure_versions_file_loaded(fragment) ⇒ Object (private)



279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
# File 'lib/cocoapods-core/cdn_source.rb', line 279

def ensure_versions_file_loaded(fragment)
  return if !@version_arrays_by_fragment_by_name[fragment].nil? && !@check_existing_files_for_update

  # Index file that contains all the versions for all the pods in the shard.
  # We use those because you can't get a directory listing from a CDN.
  index_file_name = index_file_name_for_fragment(fragment)
  download_file(index_file_name)
  file_okay = local_file_okay?(index_file_name)
  if file_okay
    versions_raw = local_file(index_file_name, &:to_a).map(&:chomp)
    @version_arrays_by_fragment_by_name[fragment] = versions_raw.reduce({}) do |hash, row|
      row = row.split('/')
      pod = row.shift
      versions = row

      hash[pod] = versions
      hash
    end
  else
    debug "CDN: #{name} Relative path: #{index_file_name} not available in this source set"
  end
end