Class: Evm::TarFile
- Inherits:
-
Object
- Object
- Evm::TarFile
- Defined in:
- lib/evm/tar_file.rb
Instance Method Summary collapse
- #download! ⇒ Object
- #extract! ⇒ Object
-
#initialize(name) ⇒ TarFile
constructor
A new instance of TarFile.
Constructor Details
#initialize(name) ⇒ TarFile
Returns a new instance of TarFile.
5 6 7 |
# File 'lib/evm/tar_file.rb', line 5 def initialize(name) @name = name end |
Instance Method Details
#download! ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/evm/tar_file.rb', line 9 def download! unless tars_path.exist? tars_path.mkdir end unless tar_path.exist? File.open(tar_path, 'wb') do |write_file| open(url, 'rb') do |read_file| write_file.write(read_file.read) end end end end |
#extract! ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/evm/tar_file.rb', line 23 def extract! unless builds_path.exist? builds_path.mkdir end system = Evm::System.new('tar') system.run('-xzf', tar_path.to_s, '-C', builds_path.to_s) end |