* Allow no_* to be used for every tests in condition DSL: condition { no_has_env :shell, '/bin/sh' }; * Modify Test constructor to accept negated: named argument, implement #negated? and #pass?; * Rename #success? to #verify in all test classes.
27 lines
486 B
Ruby
27 lines
486 B
Ruby
module Producer
|
|
module Core
|
|
class Condition
|
|
class << self
|
|
def evaluate(env, &block)
|
|
DSL.evaluate(env, &block)
|
|
end
|
|
end
|
|
|
|
def initialize(tests, return_value = nil)
|
|
@tests = tests
|
|
@return_value = return_value
|
|
end
|
|
|
|
def met?
|
|
return !!@return_value if @tests.empty?
|
|
@tests.each { |t| return false unless t.pass? }
|
|
true
|
|
end
|
|
|
|
def !
|
|
!met?
|
|
end
|
|
end
|
|
end
|
|
end
|