Class Buildr::Unzip
In: lib/buildr/packaging/ziptask.rb  (CVS)
Parent: Object

An object for unzipping/untarring a file into a target directory. You can tell it to include or exclude only specific files and directories, and also to map files from particular paths inside the zip file into the target directory. Once ready, call extract.

Usually it is more convenient to create a file task for extracting the zip file (see unzip) and pass this object as a prerequisite to other tasks.

See Buildr#unzip.

Methods

add   exclude   extract   from_path   include   included?   new   path   root   to_s  

Attributes

target  [RW]  The target directory to extract to.
zip_file  [RW]  The zip file to extract.

Public Class methods

Initialize with hash argument of the form target=>zip_file.

Public Instance methods

add(*files)

Alias for include

Exclude all files that match the patterns and return self.

Use exclude to unzip all files except those that match the pattern. You can use exclude in combination with include.

Extract the zip/tgz file into the target directory.

You can call this method directly. However, if you are using the unzip method, it creates a file task for the target directory: use that task instead as a prerequisite. For example:

  build unzip(dir=>zip_file)

Or:

  unzip(dir=>zip_file).target.invoke

Allows you to unzip from a path. Returns an object you can use to specify which files to include/exclude relative to that path. Expands the file relative to that path.

For example:

  unzip(Dir.pwd=>'test.jar').from_path('etc').include('LICENSE')

will unzip etc/LICENSE into ./LICENSE.

This is different from:

 unzip(Dir.pwd=>'test.jar').include('etc/LICENSE')

which unzips etc/LICENSE into ./etc/LICENSE.

Include all files that match the patterns and returns self.

Use include if you only want to unzip some of the files, by specifying them instead of using exclusion. You can use include in combination with exclude.

reads the includes/excludes and apply them to the entry_name

path(name)

Alias for from_path

Returns the root path, essentially the Unzip object itself. In case you are wondering down paths and want to go back.

Returns the path to the target directory.

[Validate]