ordo/tryme.scm

36 lines
1.3 KiB
Scheme
Raw Normal View History

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)
(ordo context )
2025-01-05 17:43:09 +00:00
(ordo action filesystem)
(ordo play)
(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"
(bind-context-vars
(base-dir)
2025-01-10 16:04:18 +00:00
(action:install-dir base-dir)))
2025-01-05 18:24:33 +00:00
(task "Create test file from string content"
(bind-context-vars
(base-dir)
2025-01-10 16:04:18 +00:00
(action:install-file (file-name-join* base-dir "foo") #:content "Hello, world!\n" #:mode #o600))
#:register 'foo)
(task "Get file status"
2025-01-10 16:04:18 +00:00
(bind-context-vars (foo) (action: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
(run-play test-play)