ordo/tryme.scm
Ray Miller 93820dc307
Some refactoring, and implement stat
Add convenience functions run and must to the context module, and remove
the similar functions from connection.

In the connection module, rename %run to connection-run now that that
function has moved to context.
2025-01-08 18:27:46 +00:00

49 lines
1.8 KiB
Scheme

(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)
#:vars '((base-dir . "/home/ray/ordo-test"))
#:tasks (list
(task "Override base dir"
(const "/home/ray/ordo-test-again")
#:register 'base-dir)
(task "Create test directory"
(bind-context-vars
(base-dir)
(install-directory base-dir)))
(task "Create test file from string content"
(bind-context-vars
(base-dir)
(install-file (file-name-join* base-dir "foo") #:content "Hello, world!\n"))
#:register 'foo)
(task "Get file status"
(bind-context-vars (foo) (fs:stat foo))
#:register 'stat-out
#:triggers '(display-stat)))
#:handlers `((display-stat . ,(handler "Display stat"
(bind-context-vars (foo stat-out) (lambda _ (pk foo stat-out))))))))
(run-play test-play)