zipファイルの作成

rubyzip というライブラリがあるのでそれを使用した。

http://x.jeez.jp/archives/date/2008/01/14 を参考にしました。

  • まずは rubyzip をインストール
wget http://downloads.sourceforge.net/rubyzip/rubyzip-0.9.1.tgz
tar zxvf rubyzip-0.9.1.tgz
cd rubyzip-0.9.1
ruby install.rb 
  • zipファイルの作成(ファイル圧縮)
# filename のファイルを生成し、
Zip::ZipFile.open(fileName, Zip::ZipFile::CREATE) do |zipfile|
  # zipfile に imageName で targetFilePath のファイルを追加する
  zipfile.add(imageName, targetFilePath)
end