Class Gem::SourceInfoCache
In: lib/rubygems/source_info_cache.rb
Parent: Object

SourceInfoCache stores a copy of the gem index for each gem source.

There are two possible cache locations, the system cache and the user cache:

  • The system cache is preferred if it is writable or can be created.
  • The user cache is used otherwise

Once a cache is selected, it will be used for all operations. SourceInfoCache will not switch between cache files dynamically.

Cache data is a Hash mapping a source URI to a SourceInfoCacheEntry.

Methods

Included Modules

Gem::UserInteraction

Public Class methods

The singleton Gem::SourceInfoCache. If all is true, a full refresh will be performed if the singleton instance is being initialized.

The name of the system cache file.

The name of the latest user cache file.

Reset all singletons, discarding any changes.

Search all source indexes. See Gem::SourceInfoCache#search.

Search all source indexes returning the source_uri. See Gem::SourceInfoCache#search_with_source.

The name of the system cache file. (class method)

The name of the user cache file.

Public Instance methods

The most recent cache data.

The name of the cache file.

Write the cache to a local file (if it is dirty).

The name of the latest cache file.

The name of the latest system cache file.

The name of the latest user cache file.

Merges the complete cache file into this Gem::SourceInfoCache.

Reads cached data from file.

Refreshes each source in the cache from its repository. If all is false, only latest gems are updated.

Force cache file to be reset, useful for integration testing of rubygems

Searches all source indexes. See Gem::SourceIndex#search for details on pattern and platform_only. If all is set to true, the full index will be loaded before searching.

Searches all source indexes for pattern. If only_platform is true, only gems matching Gem.platforms will be selected. Returns an Array of pairs containing the Gem::Specification found and the source_uri it was found at.

Set the source info cache data directly. This is mainly used for unit testing when we don‘t want to read a file system to grab the cached source index information. The hash should map a source URL into a SourceInfoCacheEntry.

The name of the system cache file.

Determine if path is a candidate for a cache file. Returns path if it is, nil if not.

Mark the cache as updated (i.e. dirty).

The name of the user cache file.

Write data to the proper cache files.

[Validate]