Sha256: a321c00c28d3af20ac3cb00edf0012417765686b92dd56836cf92e7ce3afaa6b
Contents?: true
Size: 1.63 KB
Versions: 1
Compression:
Stored size: 1.63 KB
Contents
module Heirloom class Downloader def initialize(args) @config = args[:config] @name = args[:name] @id = args[:id] @logger = @config.logger end def download(args) @region = args[:region] @bucket_prefix = args[:bucket_prefix] extract = args[:extract] secret = args[:secret] output = args[:output] ||= './' @logger.info "Downloading s3://#{bucket}/#{key} from #{@region}." s3_downloader = Downloader::S3.new :config => @config, :logger => @logger, :region => @region raw_archive = s3_downloader.download_file :bucket => bucket, :key => key return false unless raw_archive archive = cipher_data.decrypt_data :data => raw_archive, :secret => secret return false unless archive return false unless writer.save_archive :archive => archive, :output => output, :file => file, :extract => extract @logger.info "Download complete." output end private def file "#{@id}.tar.gz" end def key "#{@name}/#{file}" end def bucket "#{@bucket_prefix}-#{@region}" end def writer @writer ||= Writer.new :config => @config end def cipher_data @cipher_data ||= Cipher::Data.new :config => @config end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
heirloom-0.9.0 | lib/heirloom/archive/downloader.rb |