Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to assert a negative fact in Pyke?

Let's say I have fact file:

code_in_git(a)
code_in_git(b)
code_in_git(c)
build_on_disk(a)
build_on_disk(c)

I want to assert the rule "if code_in_git($branch) and not build_on_disk($branch), create fact needs_build($branch)". How can I do that?

like image 504
Kuroki Kaze Avatar asked Oct 08 '14 11:10

Kuroki Kaze


1 Answers

Okay, seems I can assert them with notany:

no_build_on_disk
    foreach
        deploy.code_in_git($branch)
        notany
            deploy.build_on_disk($branch)
    assert
        deploy.needs_build($branch)
like image 146
Kuroki Kaze Avatar answered Nov 02 '22 01:11

Kuroki Kaze