Method: VMC::Cli::ZipUtil.pack
- Defined in:
- lib/cli/zip_util.rb
.pack(dir, zipfile) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/cli/zip_util.rb', line 58 def pack(dir, zipfile) unless VMC::Cli::Config.nozip excludes = PACK_EXCLUSION_GLOBS.map { |e| "\\#{e}" } excludes = excludes.join(' ') Dir.chdir(dir) do `zip -y -q -r #{zipfile} . -x #{excludes} 2> #{to_dev_null}` return unless $? != 0 end end # Do Ruby version if told to or native version failed Zip::ZipFile::open(zipfile, true) do |zf| get_files_to_pack(dir).each do |f| zf.add(f.sub("#{dir}/",''), f) end end end |