Sha256: 06486b400414cdffb9a991360b7fa763f48ac48c6c87b7f29fd68fb42fb5951f

Contents?: true

Size: 1.06 KB

Versions: 4

Compression:

Stored size: 1.06 KB

Contents

require 'r10k/cli'
require 'r10k/deployment'
require 'r10k/action/environment'

require 'middleware'
require 'cri'

module R10K::CLI
  module Synchronize
    def self.command
      @cmd ||= Cri::Command.define do
        name  'synchronize'
        usage 'synchronize <options>'
        summary 'Fully synchronize all environments'

        run do |opts, args, cmd|
          deployment   = R10K::Deployment.instance
          environments = deployment.environments
          directories  = (deployment.config[:purgedirs] || [])

          stack = Middleware::Builder.new do
            environments.each do |env|
              use R10K::Action::Environment::Deploy, env
            end

            directories.each do |dir|
              use R10K::Action::Environment::Purge, dir
            end
          end

          stack_env = {
            :update_cache => true,
            :trace        => opts[:trace],
            :recurse      => true,
          }

          stack.call(stack_env)
        end
      end
    end
  end
  self.command.add_command(Synchronize.command)
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
r10k-0.0.9 lib/r10k/cli/synchronize.rb
r10k-0.0.8 lib/r10k/cli/synchronize.rb
r10k-0.0.7 lib/r10k/cli/synchronize.rb
r10k-0.0.6 lib/r10k/cli/synchronize.rb