class Dockly::BuildCacheCommand

Public Instance Methods

execute() click to toggle source
Calls superclass method Dockly::AbstractCommand#execute
# File lib/dockly/cli.rb, line 109
def execute
  Dockly::BuildCache.model = Dockly::BuildCache::Local
  super
  docker = Dockly.docker(docker_name.to_sym)
  build_caches = (docker && docker.build_cache) || []

  puts "No build cache for #{docker_name}" if build_caches.empty?

  if list?
    build_caches.each_with_index do |build_cache, index|
      puts "#{index + 1}. Hash: #{build_cache.hash_command} Build: #{build_cache.build_command}"
    end
  else
    bcs = if local?
      convert_bc_to_local_bc(docker)
    else
      build_caches
    end
    bcs.each do |bc|
      bc.execute!
    end
  end
end