Created
July 1, 2013 20:25
-
-
Save ehelms/5904264 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def run(plan) | |
step = next_step(plan) | |
puts step | |
end | |
def next_step(plan) | |
case plan | |
when ExecutionPlan::Sequence | |
step = check_plan(plan) | |
when ExecutionPlan::Concurrence | |
step = check_plan(plan) | |
when RunStep | |
step = check_step(plan) | |
when true | |
return true | |
else | |
raise ArgumentError, "Don't know how to run #{plan}" | |
end | |
return step | |
end | |
def check_plan(plan) | |
plan.steps.each do |step| | |
current_step = next_step(step) | |
if current_step != true | |
return current_step | |
end | |
end | |
return true | |
end | |
def check_step(step) | |
if %w[skipped success].include?(step.status) | |
return true | |
else | |
return step | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment