Class: Tango::Runner
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
#as_user, #in_context, #in_directory, #with_umask
#write
Class Method Details
.step(step_name, &block) ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/tango/runner.rb', line 21
def self.step(step_name, &block)
define_method(step_name) do |*args|
description = step_description(step_name, args)
logger.begin_step(description)
begin
result = instance_exec(*args, &block)
rescue StandardError
logger.step_not_met(description)
raise
else
logger.step_met(description)
end
result
end
end
|
Instance Method Details
#logger ⇒ Object
47
48
49
|
# File 'lib/tango/runner.rb', line 47
def logger
Logger.instance
end
|
#step_description(step_name, args) ⇒ Object
39
40
41
42
43
|
# File 'lib/tango/runner.rb', line 39
def step_description(step_name, args)
description = "#{self.class.name}.#{step_name}"
description << "(" + args.map {|arg| arg.inspect }.join(", ") + ")" unless args.empty?
description
end
|