RealZip
Usage
require 'real_zip'
# create zip file with given file structure and transfer files to the directory of your choice within the zip file.
RealZip 'real.zip', {:dir1 => ["/path/to/file1"], :dir2 => ["path/to/folder/"], 'dir2/dir3' => ["path/to/file3"]}
## Use Cases
RealZip 'temp.zip', {:html => ["/home/Files/a.html"], :pdf => ["/home/Files/c.pdf"], :rb => ["/home/Files/b.rb"]}
# Results in
puts `unzip -l temp.zip | awk '{print $4}'`
===========================================
html/
pdf/
rb/
html/a.html
pdf/c.pdf
rb/b.rb
RealZip 'temp.zip', {'doc/html' => ["/home/Files/a.html"], 'doc/pdf' => ["/home/Files/c.pdf"], 'doc/pdf/rb' => ["/home/Files/b.rb"]}
# Results in
puts `unzip -l temp.zip | awk '{print $4}'`
===========================================
doc/html/
doc/pdf/
doc/pdf/rb/
doc/html/a.html
doc/pdf/c.pdf
doc/pdf/rb/b.rb
# Symlinks or Softlinks can also be used to reference files.
Installation
Add this line to your application's Gemfile:
gem 'real_zip'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install real_zip
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Acknowledgement
This software is built upon Alexander K's Fake_Zip gem. A hearty thanks to him for making it freely available. This project would not be possible without Ravi Baghele's major input in implementing the core file tranfer functionality. I would also like to thank Indrajeet Mishra for his valuable insights about testing and debugging the gem. Our team leader Mr. Pankaj Gupta has provided invaluable support and guidance throughout the project.