parent
2c6b79b8d8
commit
32ca207ea0
|
@ -19,11 +19,11 @@ exec "$exe" "$0" "$@"
|
||||||
(command-line
|
(command-line
|
||||||
#:once-any
|
#:once-any
|
||||||
[("-l" "--local")
|
[("-l" "--local")
|
||||||
"create content that is viewable in the build directory"
|
"local mode: create content that is viewable in the build directory"
|
||||||
" (all links are relative) "
|
" (all links are relative) "
|
||||||
(set! build-mode 'local)]
|
(set! build-mode 'local)]
|
||||||
[("-w" "--web")
|
[("-w" "--web")
|
||||||
"create content that is viewable on the Racket web pages"
|
"web mode: create content that is viewable on the Racket web pages"
|
||||||
(set! build-mode 'web)]
|
(set! build-mode 'web)]
|
||||||
#:once-each
|
#:once-each
|
||||||
[("-o" "--output") dir
|
[("-o" "--output") dir
|
||||||
|
@ -52,12 +52,13 @@ exec "$exe" "$0" "$@"
|
||||||
(let ([build (file-or-directory-identity output-dir)])
|
(let ([build (file-or-directory-identity output-dir)])
|
||||||
(let loop ([dir here])
|
(let loop ([dir here])
|
||||||
(if (equal? build (file-or-directory-identity dir))
|
(if (equal? build (file-or-directory-identity dir))
|
||||||
(raise-user-error 'build "might clobber sources, refusing to build")
|
(raise-user-error 'build
|
||||||
|
"might clobber sources, refusing to build (use `-o')")
|
||||||
(let-values ([(base name dir?) (split-path dir)])
|
(let-values ([(base name dir?) (split-path dir)])
|
||||||
(when base (loop base))))))
|
(when base (loop base))))))
|
||||||
|
|
||||||
(parameterize ([current-directory output-dir])
|
(parameterize ([current-directory output-dir])
|
||||||
(let ([paths (sort (map path->string (directory-list)) string<?)])
|
(define paths (sort (map path->string (directory-list)) string<?))
|
||||||
(when (pair? paths)
|
(when (pair? paths)
|
||||||
(if (or (not warn?)
|
(if (or (not warn?)
|
||||||
(begin (printf "Directory not empty, these will be deleted: ~a.\n"
|
(begin (printf "Directory not empty, these will be deleted: ~a.\n"
|
||||||
|
@ -65,7 +66,7 @@ exec "$exe" "$0" "$@"
|
||||||
(printf "Continue? ") (flush-output)
|
(printf "Continue? ") (flush-output)
|
||||||
(regexp-match? #rx" *[yY]" (read-line))))
|
(regexp-match? #rx" *[yY]" (read-line))))
|
||||||
(for-each delete-directory/files paths)
|
(for-each delete-directory/files paths)
|
||||||
(raise-user-error 'build "Aborting.")))))
|
(raise-user-error 'build "Aborting."))))
|
||||||
|
|
||||||
(printf "Building ~a content...\n" build-mode)
|
(printf "Building ~a content...\n" build-mode)
|
||||||
(parameterize ([url-roots (and (eq? 'web build-mode) sites)])
|
(parameterize ([url-roots (and (eq? 'web build-mode) sites)])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user