add `omitted-path?` and `extra-path?` (closes #114)

pull/116/head
Matthew Butterick 8 years ago
parent b75df0fe75
commit 9cfe71b756

@ -119,7 +119,7 @@ version print the version" (current-server-port) (make-publish-di
(when (render-recursively?)
(for ([path (in-list dirlist)]
#:when (and (directory-exists? path)
(not (unpublished-path? path))))
(not (omitted-path? path))))
(render-one-dir (->complete-path path))))))
(begin ; first arg is a file
(displayln (format "rendering ~a" (string-join (map ->string path-args) " ")))
@ -175,8 +175,7 @@ version print the version" (current-server-port) (make-publish-di
(copy-directory/files source-dir target-dir)
(parameterize ([current-project-root (current-directory)])
(define (delete-from-publish-dir? p)
(and (unpublished-path? p)
(not ((setup:extra-published-path?) p))))
(and (omitted-path? p) (not (extra-path? p))))
(for-each delete-it (find-files delete-from-publish-dir? target-dir)))
(displayln "completed"))

@ -294,7 +294,7 @@
(define (ends-with? str ender)
(define pat (regexp (format "~a$" ender)))
(and (regexp-match pat str) #t))
(define+provide (magic-directory? path)
(and (directory-exists? path)
@ -305,7 +305,7 @@
(ormap (λ(cache-name) (ends-with? (path->string path) cache-name)) default-cache-names))
(define+provide (unpublished-path? file)
(define+provide (omitted-path? file)
(ormap (λ(proc) (proc file)) (list
preproc-source?
markup-source?
@ -316,4 +316,10 @@
racket-source?
magic-directory?
cache-file?
(setup:unpublished-path?))))
(setup:omitted-path?)
(setup:unpublished-path?))))
(define+provide (extra-path? file)
(ormap (λ(proc) (proc file)) (list
(setup:extra-path?)
(setup:extra-published-path?))))

@ -1 +1 @@
1464975591
1466203240

@ -110,7 +110,7 @@ If you're already in your project directory and want to publish somewhere other
You can determine the default publishing destination for a project by overriding @racket[default-publish-directory].
You can determine the files that get filtered out in a project by overriding @racket[default-unpublished-path?]. You can override these filters — that is, force a path to be published — by overriding @racket[default-extra-published-path?].
You can determine the files that get filtered out in a project by overriding @racket[default-omitted-path?]. You can override these filters — that is, force a path to be published — by overriding @racket[default-extra-path?].
@section{@exec{raco pollen setup}}

@ -118,9 +118,13 @@ Default separators used in decoding. The first two are initialized to @racket["\
@defoverridable[publish-directory (or/c path-string? path-for-some-system?)]{Default target for @secref{raco_pollen_publish}. A complete path is used as is; a relative path is published to the desktop. Default is @racket["publish"].}
@defoverridable[unpublished-path? (path? . -> . boolean?)]{Predicate that determines whether a path is omitted from @secref{raco_pollen_publish} operations. If the predicate evaluated to @racket[#t], then the path is omitted. The default predicate, therefore, is @racket[(lambda (path) #f)].}
@defoverridable[unpublished-path? (path? . -> . boolean?)]{Deprecated. Please use @racket[omitted-path?].}
@defoverridable[extra-published-path? (path? . -> . boolean?)]{Predicate that determines if path is published, overriding @racket[(setup:unpublished-path?)] above, and Pollen's default publish settings. For instance, Pollen automatically omits files with a @racket[.rkt] extension. If you wanted to force a @racket[.rkt] file to be published, you could include it here. Default is @racket[(lambda (path) #f)].}
@defoverridable[omitted-path? (path? . -> . boolean?)]{Predicate that determines whether a path is omitted from @secref{raco_pollen_render} and @secref{raco_pollen_publish} operations. If the predicate evaluated to @racket[#t], then the path is omitted. The default predicate, therefore, is @racket[(lambda (path) #f)].}
@defoverridable[extra-published-path? (path? . -> . boolean?)]{Deprecated. Please use @racket[extra-path?].}
@defoverridable[extra-path? (path? . -> . boolean?)]{Predicate that determines if path is rendered & published, overriding @racket[(setup:omitted-path?)] above, and Pollen's default publish settings. For instance, Pollen automatically omits files with a @racket[.rkt] extension. If you wanted to force a @racket[.rkt] file to be published, you could include it here. Default is @racket[(lambda (path) #f)].}
@defoverridable[splicing-tag symbol?]{Key used to signal that an X-expression should be spliced into its containing X-expression. Default is @val[default-splicing-tag].}

@ -109,8 +109,12 @@
(define-settable render-cache-active #t)
(define-settable compile-cache-max-size (* 10 1024 1024)) ; = 10 megabytes
(define-settable unpublished-path? (λ(path) #f))
(define-settable extra-published-path? (λ(path) #f))
(define-settable unpublished-path? (λ(path) #f)) ; deprecated in favor of `omitted-path?`
(define-settable omitted-path? (λ(path) #f))
(define-settable extra-published-path? (λ(path) #f)) ; deprecated in favor of `extra-path?`
(define-settable extra-path? (λ(path) #f))
(define-settable here-path-key 'here-path)

Loading…
Cancel
Save