Class: Chef::Knife::ChopTranslate

Inherits:
Chef::Knife show all
Includes:
ChopBase
Defined in:
lib/chef/knife/chop_translate.rb

Instance Attribute Summary

Attributes included from ChopLogging

#TODO, #args, #logger, #step

Attributes inherited from Chef::Knife

#ALLACTIONS, #ALLPARTS, #LOGLEVELS, #location, #logger, #prec_max, #rsrctype, #verbosity

Instance Method Summary collapse

Methods included from ChopBase

#build_option_arguments, #configure_chef, included, #initialize, #parseActionSymbol, #parseList, #parseOptionString, #parsePartSymbol, #parsePath, #parsePrecedence, #parseString, #parse_options, #run_with_pretty_exceptions

Methods included from ChopLogging

#getLogger, #logStep, #logTodo, #setLogger

Methods inherited from Chef::Knife

allactions, allactions=, allparts, allparts=, loglevels, loglevels=, #translate

Instance Method Details

#runObject




31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/chef/knife/chop_translate.rb', line 31

def run
  $stdout.sync = true
  watch_for_break

  @config[:parts].each{ |p|
    @config[:actions].each{ |a|
      actor = @actors[a]
      raise ChopInternalError.new("Actor for action '#{a.to_s}' cannot be nil!") unless actor
      method = %(#{a.to_s}_#{p.to_s})
      raise ChopInternalError.new "Internal error: Method '#{method}' is not implemented in actor #{actor.class.name}!" unless actor.respond_to?(method,true)
      actor.send(method)
    }
  }
end