Class: Packmule::Archiver::Zip
- Inherits:
-
Object
- Object
- Packmule::Archiver::Zip
- Defined in:
- lib/packmule/archiver.rb
Overview
Zipper
Class Method Summary collapse
-
.create(options) ⇒ Object
Zips the stuff.
Class Method Details
.create(options) ⇒ Object
Zips the stuff
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/packmule/archiver.rb', line 42 def self.create() # Make sure the archive doesn't exist.. if ::FileTest.exists? "./#{[:filename]}.zip" puts "#{[:filename]}.zip already exists, skipping" return false end # Get the needed Zip stuff gem 'rubyzip' require 'zip/zip' require 'zip/zipfilesystem' # Create the archive ::Zip::ZipFile.open("./#{[:filename]}.zip", 'w') do |z| Dir["#{[:dir]}/**/**"].each do |file| z.add(file.sub("#{[:dir]}/", ''), file) if not [:ignore].include?(file.sub("#{[:dir]}/", '')) end # Dir end # Zip block puts " - #{[:filename]}.zip created" return true end |