Class: Shipitron::Server::DownloadBuildCache

Inherits:
Object
  • Object
show all
Includes:
Metaractor
Defined in:
lib/shipitron/server/download_build_cache.rb

Instance Method Summary collapse

Instance Method Details

#callObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/shipitron/server/download_build_cache.rb', line 12

def call
  Logger.info "Downloading build cache from bucket #{s3_cache_bucket}"

  s3_file = bucket.files.get("#{application}.build-cache.tar.gz")
  if s3_file.nil?
    Logger.warn 'Build cache not found.'
    return
  end

  build_cache = Pathname.new("/home/shipitron/#{application}/tmp/build-cache.tar.gz")
  build_cache.parent.mkpath
  build_cache.open('wb') do |local_file|
    local_file.write(s3_file.body)
  end

  Logger.info 'Download complete.'
end