Method: Jets::Builders::Md5Zip#create

Defined in:
lib/jets/builders/md5_zip.rb

#createObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/jets/builders/md5_zip.rb', line 21

def create
  headline "Creating zip file for #{@path}"
  # => Creating zip file for /tmp/jets/demo/stage/bundled

  # https://serverfault.com/questions/265675/how-can-i-zip-compress-a-symlink
  command = "cd #{@path} && zip --symlinks -rq #{zip_file} ."
  sh(command)
  # move out of the lower folder to the stage folder
  # mv /tmp/jets/demo/stage/code/code.zip /tmp/jets/demo/stage/code.zip
  FileUtils.mkdir_p(File.dirname(zip_dest))
  FileUtils.mv("#{@path}/#{zip_file}", zip_dest)

  # mv /tmp/jets/demo/stage/zips/code.zip /tmp/jets/demo/stage/zips/code-a8a604aa.zip
  FileUtils.mv(zip_dest, md5_dest)

  file_size = number_to_human_size(File.size(md5_dest))
  puts "Zip file created at: #{md5_dest.color(:green)} (#{file_size})"
end