class Kitchen::ThorTasks

Kitchen Thor task generator.

@author Fletcher Nichol <fnichol@nichol.ca>

Attributes

config[R]

@return [Config] a Kitchen::Config

Public Class Methods

new(*args) { |self| ... } click to toggle source

Creates Kitchen Thor tasks and allows the callee to configure it.

@yield [self] gives itself to the block

Calls superclass method
# File lib/kitchen/thor_tasks.rb, line 32
def initialize(*args)
  super
  @config = Kitchen::Config.new
  Kitchen.logger = Kitchen.default_file_logger(nil, false)
  yield self if block_given?
  define
end

Private Instance Methods

define() click to toggle source

Generates a test Thor task for each instance and one to test all instances in serial.

@api private

# File lib/kitchen/thor_tasks.rb, line 49
def define
  config.instances.each do |instance|
    self.class.desc instance.name, "Run #{instance.name} test instance"
    self.class.send(:define_method, instance.name.tr("-", "_")) do
      instance.test(:always)
    end
  end

  self.class.desc "all", "Run all test instances"
  self.class.send(:define_method, :all) do
    config.instances.each { |i| invoke i.name.tr("-", "_") }
  end
end