class Torba::RemoteSources::Targz
Represents remote tar.gz archive. @since 0.3.0
Attributes
digest[R]
url[R]
Public Class Methods
new(url)
click to toggle source
# File lib/torba/remote_sources/targz.rb, line 15 def initialize(url) @url = url @digest = "#{File.basename(url).sub(/\.(tgz|tar\.gz)$/, '')}-#{Torba.digest(url)}" end
Private Instance Methods
ensure_cached()
click to toggle source
# File lib/torba/remote_sources/targz.rb, line 22 def ensure_cached unless Dir.exist?(cache_path) FileUtils.mkdir_p(cache_path) tempfile = GetFile.process(url) command = "gzip -qcd #{tempfile.path} | tar --no-same-owner -mxpf - --strip-components=1 -C #{cache_path}" system(command) || raise(Errors::ShellCommandFailed.new(command)) end rescue FileUtils.rm_rf(cache_path) raise end