fetch_spec (Gem::SpecFetcher)

    # File lib/rubygems/spec_fetcher.rb, line 84
      def fetch_spec(spec, source_uri)
        spec = spec - [nil, 'ruby', '']
        spec_file_name = "#{spec.join '-'}.gemspec"

        uri = source_uri + "#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}"

        cache_dir = cache_dir uri

        local_spec = File.join cache_dir, spec_file_name

        if File.exist? local_spec then
          spec = Gem.read_binary local_spec
        else
          uri.path << '.rz'

          spec = @fetcher.fetch_path uri
          spec = Gem.inflate spec

          if @update_cache then
            FileUtils.mkdir_p cache_dir

            open local_spec, 'wb' do |io|
              io.write spec
            end
          end
        end

        # TODO: Investigate setting Gem::Specification#loaded_from to a URI
        Marshal.load spec
      end