Sha256: adca6a9873208f7904c2983276c5269a0f21c57768060e9a687b4732ae3a9f23

Contents?: true

Size: 886 Bytes

Versions: 9

Compression:

Stored size: 886 Bytes

Contents

require 'r10k/cli/environment'
require 'r10k/deployment'
require 'cri'

module R10K::CLI::Environment
  module Stale
    def self.command
      @cmd ||= Cri::Command.define do
        name  'stale'
        usage 'stale <directory> [directory ...]'
        summary 'List all stale environments'

        run do |opts, args, cmd|
          deployment = R10K::Deployment.instance

          if args.empty?
            $stderr.print "ERROR: ".red
            $stderr.puts "#{cmd.name} requires one or more directories"
            $stderr.puts cmd.help
            exit(1)
          end

          args.each do |dir|
            puts "Stale environments in #{dir}:"
            output = deployment.collection.stale(dir).each do |stale_dir|
              puts "  - #{stale_dir}"
            end
          end
        end
      end
    end
  end
  self.command.add_command(Stale.command)
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
r10k-0.0.9 lib/r10k/cli/environment/stale.rb
r10k-0.0.8 lib/r10k/cli/environment/stale.rb
r10k-0.0.7 lib/r10k/cli/environment/stale.rb
r10k-0.0.6 lib/r10k/cli/environment/stale.rb
r10k-0.0.5 lib/r10k/cli/environment/stale.rb
r10k-0.0.4 lib/r10k/cli/environment/stale.rb
r10k-0.0.3 lib/r10k/cli/environment/stale.rb
r10k-0.0.2 lib/r10k/cli/environment/stale.rb
r10k-0.0.1 lib/r10k/cli/environment/stale.rb