def find_metadata(tarball)
        gzip = Zlib::GzipReader.new(tarball[:tempfile])
        tar = Gem::Package::TarReader.new(gzip)

        tar.each do |entry|
          if entry.full_name =~ /metadata\.json$/
            return Metadata.from_json(entry.read)
          elsif entry.full_name =~ /metadata\.rb$/
            return Metadata.from_ruby(entry.read)
          end
        end
      ensure
        tar.close
      end
def find_metadata(tarball)
        gzip = Zlib::GzipReader.new(tarball[:tempfile])
        tar = Gem::Package::TarReader.new(gzip)

        tar.each do |entry|
          if entry.full_name =~ /metadata\.json$/
            return Metadata.from_json(entry.read)
          elsif entry.full_name =~ /metadata\.rb$/
            return Metadata.from_ruby(entry.read)
          end
        end
      ensure
        tar.close
      end
Parse the metadata from the tarball.

 @param [Tempfile] tarball
   the temporarily uploaded file

 @return [Metadata]