Permalink
Browse files

Add gunzip to FakeFetcher, fix SpecFetcher cached data test.

git-svn-id: http://rubygems.rubyforge.org/svn/trunk@1802 3d4018f9-ac1a-0410-99e9-8a154d859a19
  • Loading branch information...
1 parent e8cacb6 commit 4cd64c7a4db69093d6a2ff4b1a21c85a1348482a drbrain committed Jun 24, 2008
@@ -134,9 +134,9 @@ def download(spec, source_uri, install_dir = Gem.dir)
def fetch_path(uri)
open_uri_or_path(uri) do |input|
- spec_dump = input.read
- spec_dump = Gem.gunzip spec_dump if uri.to_s =~ /gz$/
- spec_dump
+ data = input.read
+ data = Gem.gunzip data if uri.to_s =~ /gz$/
+ data
end
rescue FetchError
raise
@@ -190,8 +190,15 @@ def load_specs(source_uri, file)
if File.exist? local_file then
spec_dump = @fetcher.fetch_path spec_path, File.mtime(local_file)
+
+ #if spec_dump.nil? then
+ # spec_dump = Gem.read_binary local_file
+ #else
+ # loaded = true
+ #end
else
spec_dump = @fetcher.fetch_path spec_path
+ loaded = true
end
specs = Marshal.load spec_dump
@@ -40,7 +40,12 @@ def fetch_path(path)
raise Gem::RemoteFetcher::FetchError.new('no data', path)
end
- data.respond_to?(:call) ? data.call : data
+ if data.respond_to?(:call) then
+ data.call
+ else
+ data = Gem.gunzip data if path.to_s =~ /gz$/
+ data
+ end
end
def fetch_size(path)
@@ -294,7 +294,7 @@ def test_load_specs_cached
Marshal.dump @latest_specs, io
end
- specs = @sf.load_specs @uri, 'specs'
+ specs = @sf.load_specs @uri, 'latest_specs'
assert_equal @specs, specs
end

0 comments on commit 4cd64c7

Please sign in to comment.