Sha256: 67d99463bb6ebfbfc43a49e0a11dba1bdb755e2cbb1b4f774e47f68a338a705d
Contents?: true
Size: 870 Bytes
Versions: 4
Compression:
Stored size: 870 Bytes
Contents
require "fileutils" require "torba/remote_sources/common" require "torba/remote_sources/get_file" module Torba module RemoteSources # Represents remote tar.gz archive. # @since 0.3.0 class Targz include Common attr_reader :url, :digest def initialize(url) @url = url @digest = "#{File.basename(url).sub(/\.(tgz|tar\.gz)$/, '')}-#{Torba.digest(url)}" end private 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 end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
torba-1.2.0 | lib/torba/remote_sources/targz.rb |
torba-1.1.1 | lib/torba/remote_sources/targz.rb |
torba-1.1.0 | lib/torba/remote_sources/targz.rb |
torba-1.0.1 | lib/torba/remote_sources/targz.rb |