lib/mixlib/archive.rb in mixlib-archive-0.2.0 vs lib/mixlib/archive.rb in mixlib-archive-0.3.0

- old
+ new

@@ -2,29 +2,34 @@ require "mixlib/archive/version" require "mixlib/log" module Mixlib class Archive - attr_reader :extractor + attr_reader :archiver + alias_method :extractor, :archiver def initialize(archive, empty: false) @empty = empty archive = File.expand_path(archive) # for now we only support Tar format archives. - @extractor = Mixlib::Archive::Tar.new(archive) + @archiver = Mixlib::Archive::Tar.new(archive) end class Log extend Mixlib::Log end Log.level = :error + def create(files = [], gzip: false) + archiver.create(files, gzip: gzip) + end + def extract(destination, perms: true, ignore: []) create_and_empty(destination) - extractor.extract(destination, perms: perms, ignore: ignore) + archiver.extract(destination, perms: perms, ignore: ignore) end private def create_and_empty(destination)