Excavate: Ruby gem to extract nested archives
Extract nested archives with a single command.
Installation
Add this line to your application’s Gemfile:
gem "excavate"
And then execute:
$ bundle install
Or install it yourself as:
$ gem install excavate
Usage
To extract an archive containing other archives inside:
target = Dir.mktmpdir
Excavate::Archive.new("path/to/archive.cab").extract(target, recursive_packages: true)
The same but allowing to choose only necessary files inside:
target = Dir.mktmpdir
Excavate::Archive.new("path/to/archive.cab").files(recursive_packages: true) do |path|
FileUtils.mv(path, target) if path.end_with?(".txt")
end
CLI
excavate
can be used via command line. To extract an archive including the nested ones:
$ excavate --recursive path/to/archive.cab
It supports recursive extraction of a directory containing archives:
$ excavate --recursive path/to/dir_with_archives
If you’d like to skip extraction of nested archives, just use:
$ excavate path/to/archive.cab
To extract a particular file or files specify them as last arguments:
$ excavate --recursive archive.cab file1 dir/file2
Also excavate
supports extraction from nested archives:
$ excavate --recursive archive.cab dir/nested.zip/file
And filtering:
$ excavate archive.cab --filter "**/specialfile*.txt"
Dependencies
Depends on ffi-libarchive-binary which has the following requirements:
-
zlib
-
Expat
-
OpenSSL (for Linux only)
These dependencies are generally present on all systems.
Development
We are following Sandi Metz’s Rules for this gem, you can read the description of the rules here. All new code should follow these rules. If you make changes in a pre-existing file that violates these rules you should fix the violations as part of your contribution.
Releasing
Releasing is done automatically with GitHub Action. Just bump and tag with gem-release
.
For a patch release (0.0.x) use:
gem bump --version patch --tag --push
For a minor release (0.x.0) use:
gem bump --version minor --tag --push
Contributing
First, thank you for contributing! We love pull requests from everyone. By participating in this project, you hereby grant Ribose Inc. the right to grant or transfer an unlimited number of non exclusive licenses or sub-licenses to third parties, under the copyright covering the contribution to use the contribution by all means.
Here are a few technical guidelines to follow:
-
Open an issue to discuss a new feature.
-
Write tests to support your new feature.
-
Make sure the entire test suite passes locally and on CI.
-
Open a Pull Request.
-
Squash your commits after receiving feedback.
-
Party!
License
This gem is distributed with a BSD 3-Clause license.
This gem is developed, maintained and funded by Ribose Inc.