# File lib/rubygems/package.rb, line 220
def add_files(tar) # :nodoc:
@spec.files.each do |file|
stat = File.lstat file
if stat.symlink?
target_path = File.readlink(file)
unless target_path.start_with? '.'
relative_dir = File.dirname(file).sub("#{Dir.pwd}/", '')
target_path = File.join(relative_dir, target_path)
end
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|
File.open file, 'rb' do |src_io|
dst_io.write src_io.read 16384 until src_io.eof?
end
end
end
end