12 Commits

Author SHA1 Message Date
Thibault Jouan
f312e33062 Refactor Condition.define_test 2015-04-05 12:50:00 +00:00
Thibault Jouan
f6237bfc0c Implement `yaml_eq' condition keyword 2014-10-11 13:46:18 +00:00
Thibault Jouan
2543fdeb00 Implement `file_match' condition keyword 2014-09-27 12:14:16 +00:00
Thibault Jouan
42e29cc1fe Implement `target' condition keyword 2014-09-25 01:34:44 +00:00
Thibault Jouan
77582ef843 Allow access to registry from conditions 2014-09-25 00:01:03 +00:00
Thibault Jouan
3b28045340 Merge Condition::DSL into Condition 2014-09-22 19:43:43 +00:00
Thibault Jouan
3c46c5bc61 Implement `test_macro' recipe keyword 2014-06-03 16:27:59 +00:00
Thibault Jouan
5d81f0bc07 Add Condition#{tests,return_value} attributes reader 2014-01-19 00:07:21 +00:00
Thibault Jouan
d83b11d07b Remove Condition::DSL.evaluate method 2013-12-20 11:24:30 +00:00
Thibault Jouan
35621e1f5f Implement condition DSL negated test prefix (no_*)
* 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.
2013-12-19 20:22:44 +00:00
Thibault Jouan
ed99c191e0 Build conditions with DSL evaluated tests:
In Condition:

  * Modify constructor to accepts tests and a default return value;
  * Implement #met?;
  * Modify #! so that it return the negated value returned by #met?.

  In Condition::DSL:

  * Modify .evaluate to build the condition with tests and the value
    returned by a the evaluated condition block.

  Add a basic Test base class, with env and arguments as attributes.

  Add some spec helpers to build some easily testable kind of Test
instances (as test doubles).
2013-08-18 00:29:36 +00:00
Thibault Jouan
639bdc1c73 Implement basic condition DSL framework for tests:
Instead of interrupting task evaluation when condition is not met,
allow the whole task to be evaluated (including condition and
evaluation) so that the interpreter will get all tasks actions (whether
condition is met or not) and be able to query the condition.

* Modify Interpreter#process_task: test if task condition is met before
  applying the actions;
* Implement condition handling in Task and Task::DSL;
* Implement Condition and Condition::DSL (useless as they are, but
  needed to implement later test keywords as part of the condition DSL.
2013-08-18 00:29:14 +00:00