Class: Tango::Runner

Inherits:
Object
  • Object
show all
Includes:
ConfigFiles, Contexts::Helpers, Delegate, Fetch, Helpers::FileManipulationHelpers, MetAndMeet, Shell
Defined in:
lib/tango/runner.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Shell

#shell, #shell!

Methods included from MetAndMeet

#meet, #met?

Methods included from Fetch

#fetch

Methods included from Delegate

included

Methods included from Contexts::Helpers

#as_user, #in_context, #in_directory, #with_umask

Methods included from ConfigFiles

#write

Class Method Details

.step(step_name, &block) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/tango/runner.rb', line 19

def self.step(step_name, &block)
  define_method(step_name) do |*args|
    description = step_description(step_name, args)

    logger.enter(description)
    result = instance_exec(*args, &block)
    logger.leave(description)

    result
  end
end

Instance Method Details

#loggerObject



39
40
41
# File 'lib/tango/runner.rb', line 39

def logger
  Logger.instance
end

#step_description(step_name, args) ⇒ Object



31
32
33
34
35
# File 'lib/tango/runner.rb', line 31

def step_description(step_name, args)
  description = "#{self.class.name}.#{step_name}"
  description << "(" + args.map {|arg| arg.inspect }.join(", ") + ")" unless args.empty?
  description
end