Module: Packmule::Archiver

Defined in:
lib/packmule/archiver.rb,
lib/packmule/archiver/tar.rb,
lib/packmule/archiver/zip.rb

Defined Under Namespace

Classes: Tar, Zip

Class Method Summary collapse

Class Method Details

.create(options) ⇒ Object

Archives the shit out of the directory with the passed options.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/packmule/archiver.rb', line 15

def self.create(options)
  puts "Creating archives..."

  options[:formats].each do |format|
    if format == 'zip'
      # Zipit, zipit good
      Packmule::Archiver::Zip.create(options)
    elsif format == 'tar'
      # TARzan
      Packmule::Archiver::Tar.create(options)
    elsif format == 'tar.gz'
      # Targz, klingon pets
      Packmule::Archiver::Tar.create(options.merge({:gzip => true}))
    elsif format == 'tar.bz2'
      # Tarbz2, I got nothing...
      Packmule::Archiver::Tar.create(options.merge({:bzip => true}))
    elsif format == 'tar.xz'
      # Tarxz, better than Tarbz2
      Packmule::Archiver::Tar.create(options.merge({:xz => true}))
    end
  end

  puts "Done creating archives"
end