Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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...
commit 4cd64c7a4db69093d6a2ff4b1a21c85a1348482a 1 parent e8cacb6
authored June 24, 2008
6  lib/rubygems/remote_fetcher.rb
@@ -134,9 +134,9 @@ def download(spec, source_uri, install_dir = Gem.dir)
134 134
 
135 135
   def fetch_path(uri)
136 136
     open_uri_or_path(uri) do |input|
137  
-      spec_dump = input.read
138  
-      spec_dump = Gem.gunzip spec_dump if uri.to_s =~ /gz$/
139  
-      spec_dump
  137
+      data = input.read
  138
+      data = Gem.gunzip data if uri.to_s =~ /gz$/
  139
+      data
140 140
     end
141 141
   rescue FetchError
142 142
     raise
7  lib/rubygems/spec_fetcher.rb
@@ -190,8 +190,15 @@ def load_specs(source_uri, file)
190 190
 
191 191
     if File.exist? local_file then
192 192
       spec_dump = @fetcher.fetch_path spec_path, File.mtime(local_file)
  193
+
  194
+      #if spec_dump.nil? then
  195
+      #  spec_dump = Gem.read_binary local_file
  196
+      #else
  197
+      #  loaded = true
  198
+      #end
193 199
     else
194 200
       spec_dump = @fetcher.fetch_path spec_path
  201
+      loaded = true
195 202
     end
196 203
 
197 204
     specs = Marshal.load spec_dump
7  lib/rubygems/test_utilities.rb
@@ -40,7 +40,12 @@ def fetch_path(path)
40 40
       raise Gem::RemoteFetcher::FetchError.new('no data', path)
41 41
     end
42 42
 
43  
-    data.respond_to?(:call) ? data.call : data
  43
+    if data.respond_to?(:call) then
  44
+      data.call
  45
+    else
  46
+      data = Gem.gunzip data if path.to_s =~ /gz$/
  47
+      data
  48
+    end
44 49
   end
45 50
 
46 51
   def fetch_size(path)
2  test/test_gem_spec_fetcher.rb
@@ -294,7 +294,7 @@ def test_load_specs_cached
294 294
       Marshal.dump @latest_specs, io
295 295
     end
296 296
 
297  
-    specs = @sf.load_specs @uri, 'specs'
  297
+    specs = @sf.load_specs @uri, 'latest_specs'
298 298
 
299 299
     assert_equal @specs, specs
300 300
   end

0 notes on commit 4cd64c7

Please sign in to comment.
Something went wrong with that request. Please try again.