Class: Rubygems::Await::InfoAwaiter

Inherits:
Awaiter
  • Object
show all
Defined in:
lib/rubygems/await.rb

Instance Attribute Summary

Attributes inherited from Awaiter

#deadline, #gems, #name_indent, #source, #source_uri

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Awaiter

#call, call, #compact_index_client, #downloader, #expired?, #format_element, #gem_remote_fetcher, #index_fetcher, #inherited, #initialize, #log, #log_error, #log_found, #safe_load_marshal, subclasses

Constructor Details

This class inherits a constructor from Rubygems::Await::Awaiter

Class Method Details

.awaiter_nameObject



283
284
285
# File 'lib/rubygems/await.rb', line 283

def self.awaiter_name
  "info"
end

Instance Method Details

#collectionObject



247
248
249
# File 'lib/rubygems/await.rb', line 247

def collection
  gems.group_by(&:name).transform_values! { Set.new(_1) }
end

#process_collection(missing) ⇒ Object



251
252
253
254
255
256
# File 'lib/rubygems/await.rb', line 251

def process_collection(missing)
  missing.delete_if do |name, tuples|
    process_element(name, tuples)
    tuples.empty?
  end
end

#process_element(name, tuples) ⇒ Object



258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
# File 'lib/rubygems/await.rb', line 258

def process_element(name, tuples)
  cic = compact_index_client
  if cic.respond_to?(:update_info, true)
    cic.send :update_info, name
  elsif cic.respond_to?(:info)
    cic.info name
  else
    raise NotImplementedError,
          "unsupported bundler version: #{Bundler::VERSION}. " \
          "#{cic.class} does not respond to #info or #update_info"
  end
  info = if defined?(::Bundler::CompactIndexClient::Parser)
           cic.info(name)
         else
           cic.instance_variable_get(:@cache).dependencies(name)
         end

  info.each do |args|
    args.shift if args.first == name
    version, platform, = *args
    tuple = Gem::NameTuple.new(name, version, platform)
    log_found(tuple) if tuples.delete?(tuple)
  end
end