Class: Tango::Runner

Inherits:
Object
  • Object
show all
Includes:
ConfigFiles, Contexts::Helpers, Delegate, Fetch, 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



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

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



37
38
39
# File 'lib/tango/runner.rb', line 37

def logger
  Logger.instance
end

#step_description(step_name, args) ⇒ Object



29
30
31
32
33
# File 'lib/tango/runner.rb', line 29

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