blob: 65db03fbbf1e574b03eca6ebdd74231bcc0a5dcc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
#! ./pre-inst-env
!#
(use-modules (ice-9 format)
(ice-9 futures)
(ice-9 getopt-long)
(ice-9 ftw))
(let* ((option-spec
'((settings (single-char #\s) (value #t))
(output (single-char #\o) (value #t))
(documentation (single-char #\d) (value #t))))
(options (getopt-long (command-line) option-spec))
(settings (option-ref options 'settings #f))
(output (option-ref options 'output #f))
(documentation (option-ref options 'documentation #f)))
(define (enter? name stat result)
stat result ;ignore
;; Skip version control directories if any.
(not (member (basename name) '(".git" ".svn" "CVS"))))
(define (leaf name stat result)
stat result ;ignore
(when (string-suffix? ".scm" name)
(let* ((base-file-name (basename name ".scm"))
(cmd (format #f " ~a --settings ~a --output ~a --documentation ~a"
name
settings
(string-append output "/" base-file-name ".ttl")
(string-append documentation "/" base-file-name ".md"))))
(touch
(future
(begin
(display (format #f "Running ~a" cmd))
(display "\n")
(system cmd)))))))
(define (down name stat result)
name stat ;ignore
result)
(define (up name stat result)
name stat ;ignore
result)
(define (skip name stat result)
name stat ;ignore
result)
;; Ignore unreadable files/directories but warn the user.
(define (error name stat errno result)
stat ;ignore
(format (current-error-port) "warning: ~a: ~a~%"
name (strerror errno))
result)
(file-system-fold enter? leaf down up skip error
0 ;initial counter is zero bytes
"./examples"))
|