35 lines
1.3 KiB
Scheme
35 lines
1.3 KiB
Scheme
(use-modules
|
|
(ice-9 filesystem)
|
|
(ordo connection)
|
|
(ordo context )
|
|
(ordo action filesystem)
|
|
(ordo play)
|
|
(ordo task)
|
|
(ordo handler))
|
|
|
|
(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)
|
|
(action:install-dir base-dir)))
|
|
(task "Create test file from string content"
|
|
(bind-context-vars
|
|
(base-dir)
|
|
(action:install-file (file-name-join* base-dir "foo") #:content "Hello, world!\n" #:mode #o600))
|
|
#:register 'foo)
|
|
(task "Get file status"
|
|
(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))))))))
|
|
|
|
|
|
(run-play test-play)
|