Skip to content
martin-brennan-fs edited this page Sep 4, 2014 · 2 revisions

This is a simple example which uses rubyzip to recursively generate a zip file from the contents of a specified directory. The directory itself is not included in the archive, rather just its contents.

To use Zippy, you need to have the rubyzip gem installed, and you also need to require albacore/tools/zippy at the top of your rakefile.

Usage:

dir_to_zip = "/tmp/input"
out_file = "/tmp/out.zip"
zf = Zippy.new dir_to_zip, out_file
zf.write

Or:

z = Zippy.new(directory_to_zip, output_file) { |f| f.include? 'html' }
z.write
Clone this wiki locally