hyper-literate/pkgs/scribble-pkgs/scribble-test/tests/scribble/exe.rkt
Matthew Flatt e34cf22278 scribble/manual: delay expressions that require collection-based files
This changed make `(require scribble/manual)` work in an executable,
although actually rendering documents requires the "scribble"
collection.

original commit: 9ca0aa52250c18dd05c2a19bea654ca770aecf0c
2014-02-11 10:07:03 -07:00

34 lines
1.1 KiB
Racket

#lang racket/base
(require racket/file
compiler/embed
racket/system)
;; Check that `scribble/manual` can be embedded in an executable
(define src (make-temporary-file))
(define exe (make-temporary-file))
(call-with-output-file src
#:exists 'truncate
(lambda (o)
(write '(module m racket/base
(require scribble/manual))
o)))
(define mod-sym (string->symbol
(format "~a"
(let-values ([(base name dir?)
(split-path src)])
(path->bytes (path-replace-suffix name #""))))))
(create-embedding-executable exe
#:cmdline '("-U")
#:collects-path null
#:modules `((#f ,src))
#:configure-via-first-module? #t
#:literal-expression
(parameterize ([current-namespace (make-base-namespace)])
(compile `(namespace-require '',mod-sym))))
(system* exe)