automatically omit more paths and directories from `raco pollen render` and `raco pollen publish` (fixes #114)

pull/127/head
Matthew Butterick 9 years ago
parent eb8d87b847
commit 2b7182baba

@ -296,13 +296,20 @@
(and (regexp-match pat str) #t))
(define+provide (magic-directory? path)
(and (directory-exists? path)
(or (ends-with? (path->string path) "compiled"))))
(define (special-path? path)
(define special-paths (append default-cache-names '("compiled" ".git" ".gitignore" ".hg" ".svn" "CVS")))
(and (member (path->string (last (explode-path path))) special-paths) #t))
(define+provide (cache-file? path)
(ormap (λ(cache-name) (ends-with? (path->string path) cache-name)) default-cache-names))
(module-test-internal
(require sugar/coerce)
(check-true (special-path? (string->path "foo/pollen-cache")))
(check-false (special-path? (string->path "foo/bar-pollen-cache")))
(check-true (special-path? (string->path "compiled")))
(check-true (special-path? (string->path "foo/compiled")))
(check-false (special-path? (string->path "foo/rcompiled")))
(check-true (special-path? (string->path ".git")))
(check-true (special-path? (string->path "foo/.git")))
(check-false (special-path? (string->path "foo/robot.git"))))
(define+provide (omitted-path? file)
@ -314,12 +321,11 @@
scribble-source?
null-source?
racket-source?
magic-directory?
cache-file?
special-path?
(setup:omitted-path?)
(setup:unpublished-path?))))
(setup:unpublished-path?)))) ; deprecated name
(define+provide (extra-path? file)
(ormap (λ(proc) (proc file)) (list
(setup:extra-path?)
(setup:extra-published-path?))))
(setup:extra-published-path?)))) ; deprecated name

@ -1 +1 @@
1466283681
1466709322

@ -73,7 +73,9 @@ Render all preprocessor source files and then all pagetree files found in the cu
This command can be invoked with extra arguments.
@racket[raco pollen render _directory] will perform the render described above, but in the specified directory. By default, only files in the immediate directory are rendered. Adding the optional @exec{-r} or @exec{--recursive} switch will also render subdirectories recursively.
@racket[raco pollen render _directory] will perform the render described above, but in the specified directory. By default, only files in the immediate directory are rendered.
Adding the optional @exec{-r} or @exec{--recursive} switch will also render subdirectories recursively. Certain directories are automatically omitted from recursive renders, including Pollen caches and source-control directories (like @tt{.git} and @tt{.svn}). You can omit other paths by overriding @racket[default-omitted-path?]. You can override these omissions — that is, force a path to be included in a recursive render — by overriding @racket[default-extra-path?].
Alternatively, the command can take a variable number of path arguments. @racket[raco pollen render _path ...] will render only the paths specified in @racket[_path ...]. Consistent with the usual command-line idiom, this can be a single path, a list of paths, or a pattern:
@ -110,7 +112,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-omitted-path?]. You can override these filters — that is, force a path to be published — by overriding @racket[default-extra-path?].
Certain files and directories are automatically omitted from the published directory, including Racket and Pollen sources, Pollen caches, and source-control directories (like @tt{.git} and @tt{.svn}). You can omit other files by overriding @racket[default-omitted-path?]. You can override these omissions — that is, force a path to be published — by overriding @racket[default-extra-path?].
@section{@exec{raco pollen setup}}

Loading…
Cancel
Save