Support for context vars without macros

This commit is contained in:
Ray Miller 2025-01-07 18:09:10 +00:00
parent af16ee29b6
commit b4cdfc341a
Signed by: ray
GPG key ID: 043F786C4CD681B8
7 changed files with 91 additions and 94 deletions

View file

@ -1,11 +1,26 @@
(use-modules
(ice-9 filesystem)
(ordo connection)
(ordo context )
(ordo action filesystem)
(ordo play)
(ordo task)
(ordo handler))
;; uname -a => Linux little-rascal 6.11.10-gnu #1 SMP PREEMPT_DYNAMIC 1 x86_64 GNU/Linux
;; kernel name: Linux
;; node name: little-rascal
;; kernel release: 6.11.10-gnu
;; kernel version: #1
;; machine: SMP PREEMPT_DYNAMIC
;; processor: 1
;; hardware platform: x86_64
;; operating system: GNU/Linux
;;
;; Linux toolbox 6.12.6-200.fc41.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 19 21:06:34 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
;; uname --kernel-name --nodename --kernel-release --machine --operating-system
;; Linux little-rascal 6.11.10-gnu x86_64 GNU/Linux
(define test-play
(play "Test play"
#:connection (local-connection)
@ -15,17 +30,21 @@
(const "/home/ray/ordo-test-again")
#:register 'base-dir)
(task "Create test directory"
(install-directory ($ 'base-dir)))
(lambda (ctx)
(install-directory ctx (context-ref ctx 'base-dir))))
(task "Create test file from string content"
(install-file (file-name-join* ($ 'base-dir) "foo")
#:content "Hello, world!\n"))
(lambda (ctx)
(install-file ctx (file-name-join* (context-ref ctx 'base-dir) "foo")
#:content "Hello, world!\n")))
(task "Create test file from local source"
(install-file (file-name-join* ($ 'base-dir) "bar")
#:local-src (file-name-join* ($ 'base-dir) "foo"))
(lambda (ctx)
(install-file ctx (file-name-join* (context-ref ctx 'base-dir) "bar")
#:local-src (file-name-join* (context-ref ctx 'base-dir) "foo")))
#:triggers '(fritz))
(task "Create test file from remote source"
(install-file (file-name-join* ($ 'base-dir) "baz")
#:remote-src (file-name-join* ($ 'base-dir) "bar"))
(lambda (ctx)
(install-file ctx (file-name-join* (context-ref ctx 'base-dir) "baz")
#:remote-src (file-name-join* (context-ref ctx 'base-dir) "bar")))
#:triggers '(frobnicate)))
#:handlers `((frobnicate . ,(handler "Frobnicate" (const #t)))
(fritz . ,(handler "Fritz" (const #t)))