# File lib/rubygems/package.rb, line 208
def add_files tar # :nodoc:
@spec.files.each do |file|
stat = File.lstat file
if stat.symlink?
relative_dir = File.dirname(file).sub("#{Dir.pwd}/", '')
target_path = File.join(relative_dir, File.readlink(file))
tar.add_symlink file, target_path, stat.mode
end
next unless stat.file?
tar.add_file_simple file, stat.mode, stat.size do |dst_io|
open file, 'rb' do |src_io|
dst_io.write src_io.read 16384 until src_io.eof?
end
end
end
end