Sha256: 7a42774c65c83a2db983987c76c4ca9176e4bf045fcc185715f510fc084ac207

Contents?: true

Size: 1.13 KB

Versions: 2

Compression:

Stored size: 1.13 KB

Contents

# ZipDir

Zip and unzip directories.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'zip_dir'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install zip_dir

## Usage

```ruby
#
# Zip
#
zipper = ZipDir::Zipper.new("optional_filename")

zip_file = zipper.generate("some/path/to/directory")
zip_file # => #<Tempfile:/var/folders/6c/s4snqy051jqdpbjw7f7tsn940000gn/T/zipper-20151127-19694-1baaqoi.zip>
zip_file == zipper.file # => true

# to zip multiple directories
zip_file = zipper.generate do |z|
  z.add_path "some/path/to/directory"
  z.add_path "another/path/to/directory" # does a shell "cp -r" operation
end

# to zip __just the paths inside the directory___
zip_file = zipper.generate("some/path/to/directory", root_directory: true)

zip_file = zipper.generate do |z|
  z.add_path "some/path/to/directory", root_directory: true
end

#
# Unzip
#
unzip_path = ZipDir::Unzipper.new(zip_file.path).unzip_path # => "/var/folders/6c/s4snqy051jqdpbjw7f7tsn940000gn/T/d20151127-22683-a9vrnv"
```

## dir_model
Use [`dir_model`](https://github.com/FinalCAD/dir_model) to create complex directories to zip.

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
zip_dir-0.1.3 README.md
zip_dir-0.1.2 README.md