Class: TerraspaceBundler::Mod::Fetcher::S3

Inherits:
Base
  • Object
show all
Extended by:
Memoist
Defined in:
lib/terraspace_bundler/mod/fetcher/s3.rb

Instance Attribute Summary

Attributes inherited from Base

#sha

Instance Method Summary collapse

Methods inherited from Base

#extract, #initialize, #switch_version

Constructor Details

This class inherits a constructor from TerraspaceBundler::Mod::Fetcher::Base

Instance Method Details

#download(region, bucket, key, path) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/terraspace_bundler/mod/fetcher/s3.rb', line 13

def download(region, bucket, key, path)
  # Download to cache area
  response_target = cache_path(path) # temporary path

  unless File.exist?(response_target)
    logger.debug "S3 save archive to #{response_target}".color(:yellow)
    FileUtils.mkdir_p(File.dirname(response_target))
    s3_get(region, response_target, bucket, key)
  end

  # Save to stage
  dest = stage_path(rel_dest_dir)
  extract(response_target, dest)
end

#runObject



8
9
10
11
# File 'lib/terraspace_bundler/mod/fetcher/s3.rb', line 8

def run
  region, bucket, key, path = s3_info
  download(region, bucket, key, path)
end