@@ -23,7 +23,7 @@ def terminate(final = nil)
23
23
end
24
24
25
25
# make a nice status line for an action and react to the action
26
- def perform_action ( message , multiline , mark_fn , on_fail_msg , abort_on_fail )
26
+ def perform_action ( message , multiline , mark_fn , on_fail_msg , tally_on_fail , abort_on_fail )
27
27
line = "#{ message } ... "
28
28
endline = "...#{ message } "
29
29
if multiline
@@ -39,7 +39,7 @@ def perform_action(message, multiline, mark_fn, on_fail_msg, abort_on_fail)
39
39
puts mark . to_s . rjust ( WIDTH - line . length , " " )
40
40
unless result
41
41
puts on_fail_msg unless on_fail_msg . nil?
42
- @failure_count += 1
42
+ @failure_count += 1 if tally_on_fail
43
43
# print out error messaging here if we've captured it
44
44
terminate if abort_on_fail
45
45
end
@@ -48,29 +48,30 @@ def perform_action(message, multiline, mark_fn, on_fail_msg, abort_on_fail)
48
48
49
49
# Make a nice status for something that defers any failure code until script exit
50
50
def attempt ( message , &block )
51
- perform_action ( message , false , @passfail , nil , false , &block )
51
+ perform_action ( message , false , @passfail , nil , true , false , &block )
52
52
end
53
53
54
54
# Make a nice status for something that defers any failure code until script exit
55
55
def attempt_multiline ( message , &block )
56
- perform_action ( message , true , @passfail , nil , false , &block )
56
+ perform_action ( message , true , @passfail , nil , true , false , &block )
57
57
end
58
58
59
59
# Make a nice status for something that kills the script immediately on failure
60
+ FAILED_ASSURANCE_MESSAGE = "This may indicate a problem with ArduinoCI, or your configuration" . freeze
60
61
def assure ( message , &block )
61
- perform_action ( message , false , @passfail , "This may indicate a problem with ArduinoCI, or your configuration" , true , &block )
62
+ perform_action ( message , false , @passfail , FAILED_ASSURANCE_MESSAGE , true , true , &block )
62
63
end
63
64
64
65
def assure_multiline ( message , &block )
65
- perform_action ( message , true , @passfail , "This may indicate a problem with ArduinoCI, or your configuration" , true , &block )
66
+ perform_action ( message , true , @passfail , FAILED_ASSURANCE_MESSAGE , true , true , &block )
66
67
end
67
68
68
69
def inform ( message , &block )
69
- perform_action ( message , false , proc { |x | x } , nil , false , &block )
70
+ perform_action ( message , false , proc { |x | x } , nil , false , false , &block )
70
71
end
71
72
72
73
def inform_multiline ( message , &block )
73
- perform_action ( message , true , nil , nil , false , &block )
74
+ perform_action ( message , true , nil , nil , false , false , &block )
74
75
end
75
76
76
77
# Assure that a platform exists and return its definition
0 commit comments