Class: Kitchen::CLI

Inherits:
Thor
  • Object
show all
Includes:
PerformCommand, Logging
Defined in:
lib/kitchen/cli.rb

Overview

The command line runner for Kitchen.

Author:

Defined Under Namespace

Modules: PerformCommand Classes: Driver

Constant Summary collapse

MAX_CONCURRENCY =

The maximum number of concurrent instances that can run--which is a bit high

9999

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from PerformCommand

#perform

Methods included from Logging

#banner, #debug, #error, #fatal, #info, #warn

Constructor Details

#initialize(*args) ⇒ CLI

Constructs a new instance.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/kitchen/cli.rb', line 70

def initialize(*args)
  super
  $stdout.sync = true
  @loader = Kitchen::Loader::YAML.new(
    :project_config => ENV["KITCHEN_YAML"],
    :local_config => ENV["KITCHEN_LOCAL_YAML"],
    :global_config => ENV["KITCHEN_GLOBAL_YAML"]
  )
  @config = Kitchen::Config.new(
    :loader     => @loader
  )
  @config.log_level = Kitchen.env_log unless Kitchen.env_log.nil?
  @config.log_overwrite = Kitchen.env_log_overwrite unless Kitchen.env_log_overwrite.nil?
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



67
68
69
# File 'lib/kitchen/cli.rb', line 67

def config
  @config
end

Class Method Details

.log_optionsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Sets the logging method_options



87
88
89
90
91
92
93
94
# File 'lib/kitchen/cli.rb', line 87

def self.log_options
  method_option :log_level,
    :aliases => "-l",
    :desc => "Set the log level (debug, info, warn, error, fatal)"
  method_option :log_overwrite,
    :desc => "Set to false to prevent log overwriting each time Test Kitchen runs",
    :type => :boolean
end

Instance Method Details

#consoleObject



250
251
252
# File 'lib/kitchen/cli.rb', line 250

def console
  perform("console", "console")
end

#diagnose(*args) ⇒ Object



126
127
128
129
# File 'lib/kitchen/cli.rb', line 126

def diagnose(*args)
  update_config!
  perform("diagnose", "diagnose", args, :loader => @loader)
end

#exec(*args) ⇒ Object



233
234
235
236
# File 'lib/kitchen/cli.rb', line 233

def exec(*args)
  update_config!
  perform("exec", "exec", args)
end

#list(*args) ⇒ Object



106
107
108
109
# File 'lib/kitchen/cli.rb', line 106

def list(*args)
  update_config!
  perform("list", "list", args)
end

#login(*args) ⇒ Object



222
223
224
225
# File 'lib/kitchen/cli.rb', line 222

def (*args)
  update_config!
  perform("login", "login", args)
end

#sinkObject



245
246
247
# File 'lib/kitchen/cli.rb', line 245

def sink
  perform("sink", "sink")
end

#test(*args) ⇒ Object



214
215
216
217
218
# File 'lib/kitchen/cli.rb', line 214

def test(*args)
  update_config!
  ensure_initialized
  perform("test", "test", args)
end

#versionObject



239
240
241
# File 'lib/kitchen/cli.rb', line 239

def version
  puts "Test Kitchen version #{Kitchen::VERSION}"
end