Class: Rubygems::Await::GemsAwaiter

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, #collection, #compact_index_client, #downloader, #expired?, #format_element, #gem_remote_fetcher, #index_fetcher, #inherited, #initialize, #log, #log_error, #log_found, #process_collection, #safe_load_marshal, subclasses

Constructor Details

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

Class Method Details

.awaiter_nameObject



331
332
333
# File 'lib/rubygems/await.rb', line 331

def self.awaiter_name
  "gems"
end

Instance Method Details

#process_element(element) ⇒ Object



312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
# File 'lib/rubygems/await.rb', line 312

def process_element(element)
  gem_file_name = "#{element.full_name}.gem"
  src = Bundler::Source::Rubygems.new(remotes: [source])
  remote_spec = Bundler::RemoteSpecification.new(element.name, element.version, element.platform, index_fetcher)
  cache_dir = src.send(:download_cache_path, remote_spec) ||
              src.send(:default_cache_path_for, Bundler.rubygems.gem_dir)
  local_gem_path = File.join cache_dir, gem_file_name

  remote_gem_path = source_uri + "gems/#{gem_file_name}"

  Bundler::SharedHelpers.filesystem_access(local_gem_path) do
    gem_remote_fetcher.cache_update_path remote_gem_path, local_gem_path
  end
  true
rescue Gem::RemoteFetcher::FetchError => e
  log_error(e)
  false
end