Class: Shipitron::Server::Git::DownloadCache

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

Instance Method Summary collapse

Instance Method Details

#callObject



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

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

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

  Pathname.new("/tmp/#{application}.git.tar.gz").open('wb') do |local_file|
    local_file.write(s3_file.body)
  end

  extract_tarball(filename: "/tmp/#{application}.git.tar.gz", directory: '/home/shipitron')

  Logger.info 'Download complete.'
end