Class: Dockly::BuildCacheCommand

Inherits:
AbstractCommand show all
Defined in:
lib/dockly/cli.rb

Instance Method Summary collapse

Instance Method Details

#executeObject



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/dockly/cli.rb', line 47

def execute
  Dockly::BuildCache.model = Dockly::BuildCache::Local
  super
  build_caches = Dockly.docker(docker_name.to_sym).build_cache || []
  raise "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_name)
    else
      build_caches
    end
    bcs.each do |bc|
      bc.execute!
    end
  end
end