Class: Packmule::Archiver::Zip
- Inherits:
-
Object
- Object
- Packmule::Archiver::Zip
- Defined in:
- lib/packmule/archiver/zip.rb
Overview
Zipper
Class Method Summary collapse
-
.create(options) ⇒ Object
Zips the stuff.
Class Method Details
.create(options) ⇒ Object
Zips the stuff
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/packmule/archiver/zip.rb', line 17 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' # Create the archive ::Zip::File.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 |