Class: Rake::Delphi::ZipTask
- Defined in:
- lib/rake/common/ziptask.rb
Instance Method Summary collapse
-
#initialize(task, zipfile, files, options = nil) ⇒ ZipTask
constructor
A new instance of ZipTask.
Methods inherited from BasicTask
Constructor Details
#initialize(task, zipfile, files, options = nil) ⇒ ZipTask
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/rake/common/ziptask.rb', line 38 def initialize(task, zipfile, files, = nil) super(task) Logger.trace(Logger::VERBOSE, [zipfile, files]) raise "zipfile name is not defined!" if zipfile.nil? || zipfile.empty? @norubyzip = nil @options = || {} begin require 'zip/zip' rescue LoadError @norubyzip = true end raise "no ZIP library (rubyzip) found!" if @norubyzip # work with rubyzip Logger.trace(Logger::VERBOSE, '`rubyzip` gem is used') File.unlink(zipfile) if File.exists?(zipfile) && ! @options[:add] Zip.[:continue_on_exists_proc] = true Zip::ZipFile.open(zipfile, Zip::ZipFile::CREATE) do |z| files.each do |f| zip_addfile(z, f) end end end |