Sha256: 1ab1529e2e95ac977ff3b4a64f615a4a500a799cadb247341faddf1078e0e413
Contents?: true
Size: 1.64 KB
Versions: 3
Compression:
Stored size: 1.64 KB
Contents
require 'rho_connect_install_constants' module DownloadAndDocompress # download_and_decompress # Delegates the download and decompression duties def download_and_decompress(prefix, tarballs) #print_header "Downloading ..." downloads = 0 tarballs.each do |url| if !File.exists?("#{ get_tarball_name url }") || !File.exists?("#{ get_version url }") puts "Downloading #{url} ..." wget_download prefix, url decompress prefix, url downloads += 1 end #if end #do end #download_and_decompress # wget_download # Takes a URL and the name of a tarball and issues a wget command on said # URL unless the tarball or directory already exists def wget_download(prefix, url) if !File.exists?("#{ prefix }/#{ get_tarball_name url }") && !File.directory?("#{ prefix }/#{ get_version url }") cmd "wget -P #{prefix} #{url} -o /dev/null" end #if end #wget_download # decompress # Decompress downloaded files unless already decompressed directory # exists def decompress(prefix, url) tarball = get_tarball_name(url) dir = get_version(url) cmd "tar -xzf #{prefix}/#{tarball} -C #{prefix} > /dev/null 2>&1" unless File.directory? "#{prefix}/#{dir}" end #decompress # get_version # This method extracts the untarballed name of files retrieved via wget # from their URL def get_version(url) url =~ /.*\/(.*)\.t.*\Z/ $1 end #get_version # get_tarball_name # This method extracts the name of files retrieved via wget from their URL def get_tarball_name(url) url =~ /.*\/(.*\.t.*)/ $1 end #get_tarball_name end #DownloadAndDocompress
Version data entries
3 entries across 3 versions & 1 rubygems