added skip-user-doc-check? to materialize-user-docs

This commit is contained in:
Robby Findler 2019-07-31 00:30:15 -05:00
parent 754109fa31
commit 6747766c6f
3 changed files with 13 additions and 4 deletions

View File

@ -42,3 +42,5 @@
(define pkg-desc "Base Racket documentation") (define pkg-desc "Base Racket documentation")
(define pkg-authors '(eli jay matthias mflatt robby ryanc samth)) (define pkg-authors '(eli jay matthias mflatt robby ryanc samth))
(define version "1.1")

View File

@ -2230,13 +2230,16 @@ installation or in a user-specific location, respectively, if
@history[#:added "1.1"] @history[#:added "1.1"]
@defproc[(materialize-user-docs [on-setup ((-> boolean?) -> any) (lambda (setup) (setup))]) @defproc[(materialize-user-docs [on-setup ((-> boolean?) -> any) (lambda (setup) (setup))]
[#:skip-user-doc-check? skip-user-doc-check? any/c #f])
void?]{ void?]{
Checks whether a user-specific documentation entry point already Checks whether a user-specific documentation entry point already
exists in @racket[(find-user-doc-dir)], and if not, runs @exec{raco exists in @racket[(find-user-doc-dir)], and if not, runs @exec{raco
setup} in a mode that will create the entry point (to have the same setup} in a mode that will create the entry point (to have the same
content as the installation's documentation entry point.) content as the installation's documentation entry point.) If
@racket[skip-user-doc-check?] is not @racket[#f], then skips the
check for the user-specific documentation entry point.
The run of @exec{raco setup} is packaged in a thunk that is provided to The run of @exec{raco setup} is packaged in a thunk that is provided to
@racket[on-setup], which can adjust the current output and error ports @racket[on-setup], which can adjust the current output and error ports
@ -2244,4 +2247,6 @@ as appropriate and check the thunk's result for success.
The @racket[on-setup] argument is not called if the documentation entry The @racket[on-setup] argument is not called if the documentation entry
point already exists in @racket[(find-user-doc-dir)]. point already exists in @racket[(find-user-doc-dir)].
@history[#:changed "1.1" @list{Added the @racket[skip-user-doc-check?] argument.}]
} }

View File

@ -4,8 +4,10 @@
(provide materialize-user-docs) (provide materialize-user-docs)
(define (materialize-user-docs [wrap-setup (lambda (t) (t))]) (define (materialize-user-docs [wrap-setup (lambda (t) (t))]
(unless (file-exists? (build-path (find-user-doc-dir) "index.html")) #:skip-user-doc-check? [skip-user-doc-check? #f])
(when (or skip-user-doc-check?
(not (file-exists? (build-path (find-user-doc-dir) "index.html"))))
(wrap-setup (wrap-setup
(lambda () (lambda ()
(setup #:avoid-main? #t (setup #:avoid-main? #t