Works with and_feathers to turn in-memory archives into gzipped tarballs.
Add this line to your application's Gemfile:
gem 'and_feathers-gzipped_tarball'
And then execute:
$ bundle
Or install it yourself as:
$ gem install and_feathers-gzipped_tarball
require 'and_feathers'
require 'and_feathers/gzipped_tarball'
# This is a simple archive
archive = AndFeathers.build('archive') do |root|
root.file('README')
end
File.open('archive.tgz', 'w+') do |f|
f << archive.to_io(AndFeathers::GzippedTarball).read
end
require 'and_feathers'
require 'and_feathers/gzipped_tarball'
archive = AndFeathers.from_path('spec') do |spec|
spec.file('end_to_end_spec.rb') { '# whoops' }
spec.file('spec_helper.rb') { '# everyone needs one of these' }
end
File.open('spec.zip', 'w+') do |f|
f << archive.to_io(AndFeathers::GzippedTarball).read
end