summaryrefslogtreecommitdiff
path: root/lib/rubygems/source_info_cache_entry.rb
diff options
context:
space:
mode:
-rw-r--r--lib/rubygems/source_info_cache_entry.rb18
1 files changed, 14 insertions, 4 deletions
@@ -3,24 +3,31 @@ require 'rubygems/source_index'
require 'rubygems/remote_fetcher'
##
-# Entrys held by a SourceInfoCache.
class Gem::SourceInfoCacheEntry
# The source index for this cache entry.
attr_reader :source_index
# The size of the of the source entry. Used to determine if the
# source index has changed.
attr_reader :size
# Create a cache entry.
def initialize(si, size)
@source_index = si || Gem::SourceIndex.new({})
@size = size
end
- def refresh(source_uri)
begin
marshal_uri = URI.join source_uri.to_s, "Marshal.#{Gem.marshal_version}"
remote_size = Gem::RemoteFetcher.fetcher.fetch_size marshal_uri
@@ -29,9 +36,12 @@ class Gem::SourceInfoCacheEntry
remote_size = Gem::RemoteFetcher.fetcher.fetch_size yaml_uri
end
- return false if @size == remote_size # TODO Use index_signature instead of size?
- updated = @source_index.update source_uri
@size = remote_size
updated
end