diff --git a/modules/ordo/condition.scm b/modules/ordo/condition.scm index caee868..4834ab6 100644 --- a/modules/ordo/condition.scm +++ b/modules/ordo/condition.scm @@ -1,8 +1,9 @@ (define-module (ordo condition) - #:use-moudle (ordo context) + #:use-module (srfi srfi-71) + #:use-module (ordo context) #:use-module (ordo action filesystem)) -(define (cond:any preds) +(define-public (cond:any preds) (lambda (ctx) (let loop ((preds preds)) (if (null? preds) @@ -12,7 +13,7 @@ #t (loop (cdr preds)))))))) -(define (cond:every preds) +(define-public (cond:every preds) (lambda (ctx) (let loop ((preds preds)) (if (null? preds) @@ -22,17 +23,17 @@ (loop (cdr preds)) #f)))))) -(define (cond:command-available? cmd-name) +(define-public (cond:command-available? cmd-name) (lambda (ctx) - (let ((_ rc) (run "which" `(,cmd-name))) + (let ((_ rc (run "which" `(,cmd-name)))) (zero? rc)))) -(define (cond:directory? path) +(define-public (cond:directory? path) (lambda (ctx) (let ((st ((action:stat path) ctx))) (and st (string=? "directory" (assoc-ref st 'file-type)))))) -(define (cond:regular-file? path) +(define-public (cond:regular-file? path) (lambda (ctx) (let ((st ((action:stat path) ctx))) (and st (string=? "regular-file" (assoc-ref st 'file-type)))))) diff --git a/tryme.scm b/tryme.scm index 5223a7e..e8fe0a0 100644 --- a/tryme.scm +++ b/tryme.scm @@ -1,7 +1,8 @@ (use-modules (ice-9 filesystem) + (ordo condition) (ordo connection) - (ordo context ) + (ordo context) (ordo action filesystem) (ordo play) (ordo task) @@ -18,7 +19,8 @@ (task "Create test directory" (bind-context-vars (base-dir) - (action:install-dir base-dir))) + (action:install-dir base-dir)) + #:condition (bind-context-vars (base-dir) (negate (cond:directory? base-dir)))) (task "Create test file from string content" (bind-context-vars (base-dir)