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 prefered 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

Search all source indexes for pattern.

Search all source indexes for pattern. Only returns gems matching Gem.platforms when only_platform is true. See search_with_source.

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

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

Public Instance methods

The most recent cache data.

The name of the cache file to be read

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

Refreshes each source in the cache from its repository.

Searches all source indexes for pattern.

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.

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

The name of the user cache file.

Write data to the proper cache.

[Validate]