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 the single shared client: Bundler ships a copy of it and uses it underneath its own fetcher orchestration, injecting its fetcher and filesystem access hook.
Constant Summary
-
DEBUG_MUTEX =
# File 'lib/rubygems/compact_index_client.rb', line 18Thread::Mutex.new
-
INFO_DEPS =
# File 'lib/rubygems/compact_index_client.rb', line 243 -
INFO_NAME =
# File 'lib/rubygems/compact_index_client.rb', line 21
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 232 -
INFO_REQS =
# File 'lib/rubygems/compact_index_client.rb', line 254 -
INFO_VERSION =
# File 'lib/rubygems/compact_index_client.rb', line 221 -
SUPPORTED_DIGESTS =
# File 'lib/rubygems/compact_index_client.rb', line 17{ "sha-256" => :SHA256 }.freeze
Class Method Summary
- .debug
-
.filesystem_access(path, action = :write, &block)
Filesystem reads and writes funnel through this hook so that a host (e.g. Bundler) can translate low-level Errno exceptions into its own friendlier errors.
- .filesystem_access=(hook)
-
.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 27
def self.debug return unless ENV["DEBUG_COMPACT_INDEX"] DEBUG_MUTEX.synchronize { warn("[#{self}] #{yield}") } end
.filesystem_access(path, action = :write, &block)
Filesystem reads and writes funnel through this hook so that a host (e.g. Bundler) can translate low-level Errno exceptions into its own friendlier errors. The default just yields the path.
.filesystem_access=(hook)
[ GitHub ]# File 'lib/rubygems/compact_index_client.rb', line 45
def self.filesystem_access=(hook) @filesystem_access = hook 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.