lib/atp/ast/builder.rb in atp-0.4.0 vs lib/atp/ast/builder.rb in atp-0.4.1
- old
+ new
@@ -26,11 +26,11 @@
test
end
end
def render(str)
- n(:render, str.to_s)
+ n(:render, str)
end
def id(symbol)
n(:id, symbol.to_sym)
end
@@ -49,10 +49,14 @@
def job(id, enabled, node)
n(:job, id, enabled, node)
end
+ def run_flag(id, enabled, node)
+ n(:run_flag, id, enabled, node)
+ end
+
def set_run_flag(flag)
n(:set_run_flag, flag)
end
def enable_flow_flag(var, options = {})
@@ -116,11 +120,12 @@
:job, :jobs, :if_job, :if_jobs,
:unless_job, :unless_jobs,
:if_any_failed, :unless_all_passed,
:if_all_failed, :unless_any_passed,
:if_any_passed, :unless_all_failed,
- :if_all_passed, :unless_any_failed
+ :if_all_passed, :unless_any_failed,
+ :if_flag, :unless_flag
]
def apply_conditions(node, conditions)
conditions.each do |key, value|
# Sometimes conditions can be an array (in the case of the current context
@@ -170,9 +175,19 @@
node = test_executed(value, false, node)
when :job, :jobs, :if_job, :if_jobs
node = job(value, true, node)
when :unless_job, :unless_jobs
node = job(value, false, node)
+ when :if_flag
+ if value.is_a?(Array)
+ fail 'if_flag only accepts one flag'
+ end
+ node = run_flag(value, true, node)
+ when :unless_flag
+ if value.is_a?(Array)
+ fail 'unless_flag only accepts one flag'
+ end
+ node = run_flag(value, false, node)
else
fail "Unknown test condition attribute - #{key} (#{value})"
end
end
node