Class: Buildr::ZipTask
- Inherits:
-
ArchiveTask
- Object
- Rake::FileTask
- ArchiveTask
- Buildr::ZipTask
- Includes:
- WithManifest
- Defined in:
- lib/buildr/packaging/ziptask.rb,
lib/buildr/java/packaging.rb
Overview
The ZipTask creates a new Zip file. You can include any number of files and and directories, use exclusion patterns, and include files into specific directories.
For example:
zip('test.zip').tap do |task|
task.include 'srcs'
task.include 'README', 'LICENSE'
end
See Buildr#zip and ArchiveTask.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#compression_level ⇒ Object
Compression leve for this Zip.
Instance Method Summary collapse
-
#entries ⇒ Object
:nodoc:.
-
#entry(entry_name) ⇒ Object
:call-seq: entry(name) => Entry.
-
#initialize(*args) ⇒ ZipTask
constructor
:nodoc:.
Methods inherited from ArchiveTask
#clean, #contain?, #empty?, #exclude, #include, #invoke_prerequisites, #merge, #needed?, #path, #root, #with
Methods inherited from Rake::FileTask
Constructor Details
#initialize(*args) ⇒ ZipTask
:nodoc:
37 38 39 40 |
# File 'lib/buildr/packaging/ziptask.rb', line 37 def initialize(*args) #:nodoc: self.compression_level = Zlib::DEFAULT_COMPRESSION super end |
Instance Attribute Details
#compression_level ⇒ Object
Compression leve for this Zip.
35 36 37 |
# File 'lib/buildr/packaging/ziptask.rb', line 35 def compression_level @compression_level end |
Instance Method Details
#entries ⇒ Object
:nodoc:
52 53 54 |
# File 'lib/buildr/packaging/ziptask.rb', line 52 def entries #:nodoc: @entries ||= Zip::ZipFile.open(name) { |zip| zip.entries } end |
#entry(entry_name) ⇒ Object
:call-seq:
entry(name) => Entry
Returns a ZIP file entry. You can use this to check if the entry exists and its contents, for example:
package(:jar).entry("META-INF/LICENSE").should contain(/Apache Software License/)
48 49 50 |
# File 'lib/buildr/packaging/ziptask.rb', line 48 def entry(entry_name) ::Zip::ZipEntry.new(name, entry_name) end |