Class: Idlc::ZipFileGenerator
- Inherits:
-
Object
- Object
- Idlc::ZipFileGenerator
- Includes:
- Helpers
- Defined in:
- lib/idlc-sdk-core/zip.rb
Instance Method Summary collapse
-
#initialize(inputDir, outputFile) ⇒ ZipFileGenerator
constructor
Initialize with the directory to zip and the location of the output archive.
-
#write ⇒ Object
Zip the input directory.
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/idlc-sdk-core/zip.rb', line 6 def initialize(inputDir, outputFile) @inputDir = inputDir @outputFile = outputFile end |
Instance Method Details
#write ⇒ Object
Zip the input directory.
12 13 14 15 16 17 18 |
# File 'lib/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 |