Module: R10K::CLI::Cache

Defined in:
lib/r10k/cli/cache.rb

Class Method Summary collapse

Class Method Details

.commandObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/r10k/cli/cache.rb', line 8

def self.command
  @cmd ||= Cri::Command.define do
    name  'cache'
    usage 'cache'
    summary 'Update cache for all sources'

    run do |opts, args, cmd|
      sources = R10K::Deployment.config[:sources]
      remotes = Set.new

      sources.each_pair do |name, hash|
        remotes << hash['remote']
      end

      remotes.each do |remote|
        logger.info "Updating cache for #{remote.inspect}"
        synchro = R10K::Synchro::Git.new(remote)
        synchro.cache
      end
    end
  end
end