71: def self.pack(src, destname, signer = nil)
72: TarOutput.open(destname, signer) do |outp|
73: dir_class.chdir(src) do
74: outp.metadata = (file_class.read("RPA/metadata") rescue nil)
75: find_class.find('.') do |entry|
76: case
77: when file_class.file?(entry)
78: entry.sub!(%r{\./}, "")
79: next if entry =~ /\ARPA\//
80: stat = File.stat(entry)
81: outp.add_file_simple(entry, stat.mode, stat.size) do |os|
82: file_class.open(entry, "rb") do |f|
83: os.write(f.read(4096)) until f.eof?
84: end
85: end
86: when file_class.dir?(entry)
87: entry.sub!(%r{\./}, "")
88: next if entry == "RPA"
89: outp.mkdir(entry, file_class.stat(entry).mode)
90: else
91: raise "Don't know how to pack this yet!"
92: end
93: end
94: end
95: end
96: end