Create directories in .gem files

RubyGems does not add directory entries to .gem files due to backwards
compatibility issues.

If a gem is created using tar it will contain directory entries which
RubyGems could not extract.

Now RubyGems unpacks directory entries from the data.tar.gz. and creates
the directories with the correct permissions.

Fixes #631