Granted that spec.files must all be files for the gem to validate.
However, many old gemspecs use spec.files = Dir['lib/**/*'] style globs for file listings, resulting in intermediate directories in spec.files.
spec.files = Dir['lib/**/*']
RubyGems 2.0 can't package these gemspecs any more. It tries to add the dirs to the tarball as if they were files.
I think it's probably worth maintaining compatibility with old gemspecs:
diff --git a/lib/rubygems/package.rb b/lib/rubygems/package.rb
index 1769af0..0707a26 100644
@@ -196,7 +196,7 @@ class Gem::Package
open file, 'rb' do |src_io|
dst_io.write src_io.read 16384 until src_io.eof?
+ end if stat.file?
Omit directories from gemspec.files for RubyGems 2 compat.
RG2 packager expects each spec.files path to be a file and bombs when it tries to tarball a dir.
May revert if rubygems/rubygems#413 is accepted.
Omit directories when packaging files. Fixes #413