Class: Gem::CompactIndexClient
| Relationships & Source Files | |
| Namespace Children | |
|
Classes:
| |
|
Exceptions:
| |
| Inherits: | Object |
| Defined in: | lib/rubygems/compact_index_client.rb, lib/rubygems/compact_index_client/cache.rb, lib/rubygems/compact_index_client/cache_file.rb, lib/rubygems/compact_index_client/http_fetcher.rb, lib/rubygems/compact_index_client/parser.rb, lib/rubygems/compact_index_client/updater.rb |
Overview
The CompactIndexClient fetches and parses the compact index files (names, versions and info/[gem]) served by a gem server, keeping a local cache so subsequent fetches only transfer what changed.
This is an independent RubyGems port of Bundler::CompactIndexClient.
Both implementations are intentionally kept separate so that changes
on either side cannot affect the other; this one only depends on
RubyGems itself.
Constant Summary
-
DEBUG_MUTEX =
# File 'lib/rubygems/compact_index_client.rb', line 15Thread::Mutex.new
-
INFO_DEPS =
# File 'lib/rubygems/compact_index_client.rb', line 213 -
INFO_NAME =
# File 'lib/rubygems/compact_index_client.rb', line 18
info returns an Array of INFO Arrays. Each INFO Array has the following indices:
0 -
INFO_PLATFORM =
# File 'lib/rubygems/compact_index_client.rb', line 202 -
INFO_REQS =
# File 'lib/rubygems/compact_index_client.rb', line 224 -
INFO_VERSION =
# File 'lib/rubygems/compact_index_client.rb', line 191 -
SUPPORTED_DIGESTS =
# File 'lib/rubygems/compact_index_client.rb', line 14{ "sha-256" => :SHA256 }.freeze
Class Method Summary
- .debug
-
.new(directory, fetcher = nil) ⇒ CompactIndexClient
constructor
The client is instantiated with: -
directory: the root directory where the cache files are stored.
Instance Attribute Summary
- #available? ⇒ Boolean readonly
Instance Method Summary
- #dependencies(names)
-
#fetch_info(name)
Fetches a single gem's info without consulting the versions index, using a conditional request to refresh the cached file.
- #info(name)
- #latest_version(name)
- #names
- #reset!
- #versions
Constructor Details
.new(directory, fetcher = nil) ⇒ CompactIndexClient
The client is instantiated with:
directory: the root directory where the cache files are stored.fetcher: (optional) an object that responds to#call(uri_path, headers) and returns a Gem::Net::HTTP response. When the fetcher is not provided, the client only reads cached files from disk.
Class Method Details
.debug
[ GitHub ]# File 'lib/rubygems/compact_index_client.rb', line 24
def self.debug return unless ENV["DEBUG_COMPACT_INDEX"] DEBUG_MUTEX.synchronize { warn("[#{self}] #{yield}") } end
Instance Attribute Details
#available? ⇒ Boolean (readonly)
[ GitHub ]
Instance Method Details
#dependencies(names)
[ GitHub ]#fetch_info(name)
Fetches a single gem's info without consulting the versions index, using a conditional request to refresh the cached file. Useful when only a few gems are needed and the versions index download would dominate, as in gem install.