Class: Jdt::ExtensionZipper

Inherits:
Object
  • Object
show all
Defined in:
lib/jdt/manifest/build.rb

Instance Method Summary collapse

Constructor Details

#initialize(manifest) ⇒ ExtensionZipper

Returns a new instance of ExtensionZipper.



19
20
21
# File 'lib/jdt/manifest/build.rb', line 19

def initialize(manifest)
  @manifest = manifest
end

Instance Method Details

#zip(type) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/jdt/manifest/build.rb', line 23

def zip(type)

  zip_file_name = zip_file_name(type)

  # ensure that the file does not exist
  ensure_zip_file_does_not_exist(zip_file_name)

  # ensure that directory exists
  ensure_zip_dir_exists(zip_file_name)

  # create zip file
  Zip::ZipFile.open(zip_file_name, Zip::ZipFile::CREATE) do |zos|
    add_files_to_zip(zos)
    add_index_html_to_every_dir(zos)
  end

  # return zip file
  zip_file_name
end