Repository is archived
No commit activity in last 3 years
No release in over 3 years
Small library for unpacking various archives, extracted from Beanstalk (http://beanstalkapp.com) (and rewritten, in fact).
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 2.4.2
 Project Readme

unpacker¶ ↑

DESCRIPTION¶ ↑

Small library for unpacking various archives, extracted from Beanstalk (beanstalkapp.com) (and rewritten, in fact).

FEATURES/PROBLEMS¶ ↑

None so far. Won’t run on Windows, haven’t tested.

SAMPLE USAGE¶ ↑

To test archives do:

Unpacker.valid? 'path/to/file.zip'

The method optionally accepts second argument, file name (if it is different than the file path). Handy if you test temp uploaded files.

To extract files do:

Unpacker.unpack('path/to/myfile.zip') do |directory_that_contains_extracted_files|

end

To recognize archives do:

Unpacker.archive? 'path/to/archive.txt'

In case the archive is not supported (currently working with zip, bzip, gzip, tar and rar) you may get UnrecognizedArchiveError in both methods.

The gem takes care to remove any temporary extractings after the block is executed; (uses /tmp/ directory).

When working with .gz files (single archive), the extracted file is always called gz-contents.

REQUIREMENTS¶ ↑

Relies on system calls, so you should have

  • unzip

  • unrar

  • tar

  • gunzip

  • bunzip

In path.

INSTALL¶ ↑

sudo gem install unpacker

Note on Patches/Pull Requests¶ ↑

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

  • Send me a pull request. Bonus points for topic branches.

Copyright © 2010 Petyo Ivanov. See LICENSE for details.