Class: Evm::TarFile

Inherits:
Object
  • Object
show all
Defined in:
lib/evm/tar_file.rb

Instance Method Summary collapse

Constructor Details

#initialize(tar_file) ⇒ TarFile

Returns a new instance of TarFile.



3
4
5
# File 'lib/evm/tar_file.rb', line 3

def initialize(tar_file)
  @tar_file = tar_file
end

Instance Method Details

#extract(extract_to, name = nil) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/evm/tar_file.rb', line 7

def extract(extract_to, name = nil)
  args = []
  args << '-xzf'
  args << @tar_file
  args << '-C'

  if name
    args << File.join(extract_to, name)
    args << '--strip-components'
    args << '1'
  else
    args << extract_to
  end

  tar(*args)
end