Module: Workspace::WorkspaceDir::Archive

Extended by:
ActiveSupport::Concern
Included in:
Workspace::WorkspaceDir
Defined in:
lib/workspace/workspace_dir/archive.rb

Instance Method Summary collapse

Instance Method Details

#compress_zip(target_file) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/workspace/workspace_dir/archive.rb', line 6

def compress_zip(target_file)
  target_file.delete!
  require "zip"
  Zip::File.open(target_file.to_s, 'w') do |zipfile|
    Dir["#{self}/**/**"].each do |file|
      zipfile.add(file.sub("#{self}/", ''), file)
    end
  end
  self
end