Class: PEBuild::Unpack::Tar
- Inherits:
-
Object
- Object
- PEBuild::Unpack::Tar
- Defined in:
- lib/pe_build/unpack/tar.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#creates ⇒ String
The file/dir that will be created as a result of unpack.
-
#dirname ⇒ String
The base directory contained in the tar archive.
-
#initialize(src, dst) ⇒ Tar
constructor
A new instance of Tar.
- #unpack ⇒ Object
Constructor Details
#initialize(src, dst) ⇒ Tar
Returns a new instance of Tar.
8 9 10 |
# File 'lib/pe_build/unpack/tar.rb', line 8 def initialize(src, dst) @src, @dst = src, dst end |
Instance Method Details
#creates ⇒ String
Returns The file/dir that will be created as a result of unpack.
17 18 19 |
# File 'lib/pe_build/unpack/tar.rb', line 17 def creates File.join(@dst, dirname) end |
#dirname ⇒ String
Returns The base directory contained in the tar archive.
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/pe_build/unpack/tar.rb', line 22 def dirname input = ::Archive::Tar::Minitar::Input.new(file_stream) base = nil input.each do |entry| path = entry.name base = path.split(File::SEPARATOR).first end base end |
#unpack ⇒ Object
12 13 14 |
# File 'lib/pe_build/unpack/tar.rb', line 12 def unpack ::Archive::Tar::Minitar.unpack(file_stream, @dst) end |