Class: SessionZipper
- Inherits:
-
Object
- Object
- SessionZipper
- Defined in:
- lib/session_zipper.rb
Instance Method Summary collapse
Instance Method Details
#compress(path) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/session_zipper.rb', line 6 def compress(path) path.sub!(%r[/$],'') archive = File.join(path,File.basename(path))+'.zip' FileUtils.rm archive, :force=>true Zip::ZipFile.open(archive, 'w') do |zipfile| Dir["#{path}/**/**"].reject{|f|f==archive}.each do |file| zipfile.add(file.sub(path+'/',''),file) end end archive end |