Class: Idlc::ZipFileGenerator

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/iapi-idlc-sdk-core/zip.rb

Instance Method Summary collapse

Methods included from Helpers

debug, err, msg, stderr, stdout, system_command

Constructor Details

#initialize(inputDir, outputFile) ⇒ ZipFileGenerator

Initialize with the directory to zip and the location of the output archive.



6
7
8
9
# File 'lib/iapi-idlc-sdk-core/zip.rb', line 6

def initialize(inputDir, outputFile)
  @inputDir = inputDir
  @outputFile = outputFile
end

Instance Method Details

#writeObject

Zip the input directory.



12
13
14
15
16
17
18
# File 'lib/iapi-idlc-sdk-core/zip.rb', line 12

def write()
  entries = Dir.entries(@inputDir); entries.delete("."); entries.delete("..")
  io = Zip::File.open(@outputFile, Zip::File::CREATE);

  writeEntries(entries, "", io)
  io.close();
end