Class: Weeblybundler::ZipFileGenerator
- Inherits:
-
Object
- Object
- Weeblybundler::ZipFileGenerator
- Defined in:
- lib/weeblybundler/zip_file_generator.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.
Constructor Details
#initialize(inputDir, outputFile) ⇒ ZipFileGenerator
Initialize with the directory to zip and the location of the output archive.
15 16 17 18 |
# File 'lib/weeblybundler/zip_file_generator.rb', line 15 def initialize(inputDir, outputFile) @inputDir = inputDir @outputFile = outputFile end |
Instance Method Details
#write ⇒ Object
Zip the input directory.
21 22 23 24 25 26 27 28 |
# File 'lib/weeblybundler/zip_file_generator.rb', line 21 def write() entries = Dir.entries(@inputDir) entries.delete_if { |entry| entry.start_with? '.' } io = Zip::File.open(@outputFile, Zip::File::CREATE); writeEntries(entries, "", io) io.close() end |