2025-01-05 17:43:09 +00:00
|
|
|
(use-modules
|
2025-01-06 22:08:33 +00:00
|
|
|
(ice-9 filesystem)
|
2025-01-05 17:43:09 +00:00
|
|
|
(ordo connection)
|
2025-01-07 18:09:10 +00:00
|
|
|
(ordo context )
|
2025-01-05 17:43:09 +00:00
|
|
|
(ordo action filesystem)
|
|
|
|
(ordo play)
|
2025-01-05 19:10:42 +00:00
|
|
|
(ordo task)
|
|
|
|
(ordo handler))
|
2025-01-05 17:43:09 +00:00
|
|
|
|
2025-01-05 18:24:33 +00:00
|
|
|
(define test-play
|
|
|
|
(play "Test play"
|
|
|
|
#:connection (local-connection)
|
2025-01-06 22:08:33 +00:00
|
|
|
#:vars '((base-dir . "/home/ray/ordo-test"))
|
2025-01-05 18:24:33 +00:00
|
|
|
#:tasks (list
|
2025-01-06 22:08:33 +00:00
|
|
|
(task "Override base dir"
|
|
|
|
(const "/home/ray/ordo-test-again")
|
|
|
|
#:register 'base-dir)
|
2025-01-05 18:24:33 +00:00
|
|
|
(task "Create test directory"
|
2025-01-08 09:13:19 +00:00
|
|
|
(bind-context-vars
|
|
|
|
(base-dir)
|
|
|
|
(install-directory base-dir)))
|
2025-01-05 18:24:33 +00:00
|
|
|
(task "Create test file from string content"
|
2025-01-08 09:13:19 +00:00
|
|
|
(bind-context-vars
|
|
|
|
(base-dir)
|
2025-01-08 18:27:46 +00:00
|
|
|
(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))))))))
|
|
|
|
|
2025-01-05 17:43:09 +00:00
|
|
|
|
2025-01-06 21:38:32 +00:00
|
|
|
(run-play test-play)
|