Class: Dnnbundler::ZipFileGenerator
- Inherits:
-
Object
- Object
- Dnnbundler::ZipFileGenerator
- Defined in:
- lib/dnnbundler/zipFileGenerator.rb
Instance Method Summary collapse
-
#initialize(data) ⇒ ZipFileGenerator
constructor
Initialize with the directory to zip and the location of the output archive.
-
#write ⇒ Object
Zip the input directory.
Constructor Details
#initialize(data) ⇒ ZipFileGenerator
Initialize with the directory to zip and the location of the output archive.
9 10 11 12 13 |
# File 'lib/dnnbundler/zipFileGenerator.rb', line 9 def initialize(data) @entries = data[JsonConfig::Entries] @ignore_entries = data[JsonConfig::IgnoreEntries] @output_file = data[JsonConfig::Name] end |
Instance Method Details
#write ⇒ Object
Zip the input directory.
16 17 18 19 20 21 |
# File 'lib/dnnbundler/zipFileGenerator.rb', line 16 def write buffer = create_zip @entries, @ignore_entries puts "\nwrite file #{@output_file}" File.open(@output_file, "wb") {|f| f.write buffer.string } end |