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



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

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

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

  build_cache = Pathname.new("/home/shipitron/#{application}/#{build_cache_location}")
  build_cache.parent.mkpath
  build_cache.open('wb') do |local_file|
    local_file.write(s3_file.body)
  end

  Logger.info 'Download complete.'
end