class Egads::S3Tarball
Attributes
remote[R]
seed[R]
sha[R]
Public Class Methods
new(sha, options = {})
click to toggle source
# File lib/egads/s3_tarball.rb, line 4 def initialize(sha, options = {}) @sha = sha @remote = options[:remote] @seed = options[:seed] end
Public Instance Methods
bucket()
click to toggle source
# File lib/egads/s3_tarball.rb, line 41 def bucket config.s3_bucket end
config()
click to toggle source
# File lib/egads/s3_tarball.rb, line 10 def config remote ? RemoteConfig : Config end
download(file)
click to toggle source
Write the S3 object's contents to a local file
# File lib/egads/s3_tarball.rb, line 37 def download(file) bucket.object(key).get(response_target: file) end
exists?()
click to toggle source
# File lib/egads/s3_tarball.rb, line 22 def exists? bucket.object(key).exists? end
key()
click to toggle source
# File lib/egads/s3_tarball.rb, line 14 def key [ config.s3_prefix, seed ? 'seeds' : nil, "#{sha}.tar.gz" ].compact * '/' end
local_tar_path()
click to toggle source
# File lib/egads/s3_tarball.rb, line 26 def local_tar_path "tmp/#{sha}.tar.gz" end
upload(path=local_tar_path)
click to toggle source
# File lib/egads/s3_tarball.rb, line 30 def upload(path=local_tar_path) File.open(path) {|f| bucket.put_object(key: key, body: f) } end