Module: R10K::CLI::Version

Defined in:
lib/r10k/cli/version.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
# File 'lib/r10k/cli/version.rb', line 8

def self.command
  @cmd ||= Cri::Command.define do
    name    'version'
    usage   'version'
    summary 'Print the version of r10k'

    run do |opts, args, cmd|
      puts "r10k #{R10K::VERSION}"
      if opts[:verbose]
        puts RUBY_DESCRIPTION
        cmdpath = caller.last.slice(/\A.*#{$PROGRAM_NAME}/)
        puts "Command path: #{cmdpath}"
        puts "Interpreter path: #{Gem.ruby}"
        if RUBY_VERSION >= '1.9'
          puts "Default encoding: #{Encoding.default_external.name}"
        end
      end
      exit 0
    end
  end
end