use "compiled/pollen" as cache dir instead of "pollen-cache"

pull/134/head
Matthew Butterick 8 years ago
parent 05fad9ba54
commit 0a4c31b7f0

@ -16,8 +16,7 @@
#:when (and (directory-exists? path)
(let* ([last (compose1 car reverse)]
[last-path-element (path->string (last (explode-path path)))])
(or (equal? last-path-element (setup:cache-dir-name))
(equal? last-path-element "compiled")))))
(member last-path-element default-cache-names))))
(message (format "removing cache directory: ~a" path))
(delete-directory/files path)))

@ -93,13 +93,13 @@
;; certain files (leading dot) will be ignored by `directory-list` anyhow.
;; we will, however, ignore Pollen's cache files, and Racket's `compiled` dirs,
;; because those shouldn't be project-manipulated.
(define (neither-compiled-nor-cache-dir? path)
(not (member (->string path) (cons "compiled" default-cache-names))))
(define (not-cache-dir? path)
(not (member (->string path) default-cache-names)))
(unless (directory-exists? dir)
(error 'directory->pagetree (format "directory ~v doesn't exist" dir)))
(decode-pagetree (map ->pagenode (unique-sorted-output-paths (filter neither-compiled-nor-cache-dir? (directory-list dir))))))
(decode-pagetree (map ->pagenode (unique-sorted-output-paths (filter not-cache-dir? (directory-list dir))))))
(define+provide/contract (get-pagetree source-path)

@ -63,7 +63,7 @@
(define (make-cache-dirs path)
(define path-dir (dirname path))
(define cache-dir (build-path path-dir (setup:cache-dir-name)))
(define cache-dir (build-path path-dir (setup:cache-dir-name) (setup:cache-subdir-name)))
(define private-cache-dir (build-path cache-dir "private"))
(my-make-directory* private-cache-dir) ; will also make cache-dir, if needed
(values cache-dir private-cache-dir))

@ -1 +1 @@
1476735877
1479757388

@ -11,7 +11,7 @@
The slowest part of a Pollen @racket[render] is compiling a source file. Because Pollen allows source files to be edited and previewed dynamically, these files get recompiled a lot. Therefore, Pollen stores copies of the exports of source files — namely, whatever is stored in @code[(format "~a" default-main-export)] and @code[(format "~a" default-meta-export)] — in a cache so they can be reused.
In each directory of your project, Pollen creates a subdirectory called @filepath{pollen-cache}. The files are stored on disk so they can be reused between sessions. If you delete files within a cache directory (or the whole thing), don't worry — everything will get regenerated. (However, you should not read or write to any @filepath{pollen-cache} directory, as the implementation details are subject to change.)
In each directory of your project, Pollen writes cache files into a subdirectory called @filepath{compiled}. The files are stored on disk so they can be reused between sessions. If you delete files within a cache directory (or the whole thing), don't worry — everything will get regenerated. (However, I don't recommend trying to read or write directly to any @filepath{compiled} directory, as the implementation details of the cache are subject to change.)
@section{Preloading and reseting}

@ -60,9 +60,10 @@
(define+provide default-mode-pagetree 'ptree)
(define+provide default-mode-template 'template)
(define-settable cache-filename "pollen.cache")
(define-settable cache-dir-name "pollen-cache")
(define+provide default-cache-names (list (cache-filename) (cache-dir-name)))
(define-settable old-cache-names '("pollen.cache" "pollen-cache"))
(define-settable cache-dir-name "compiled")
(define-settable cache-subdir-name "pollen")
(define+provide default-cache-names (list* (cache-dir-name) (old-cache-names)))
(define-settable decodable-extensions (list (markup-source-ext) (pagetree-source-ext)))

@ -7,8 +7,8 @@
(define-runtime-path dr-sub "data/pathup/subdir/subdir/pollen.rkt")
(define-runtime-path template "data/pathup/subdir/template.html")
(define-runtime-path cache-dir "data/pathup/subdir/pollen-cache")
(define-runtime-path other-cache-dir "data/pathup/subdir/subdir/pollen-cache")
(define-runtime-path cache-dir "data/pathup/subdir/compiled")
(define-runtime-path other-cache-dir "data/pathup/subdir/subdir/compiled")
(define-runtime-path up-pollen "pollen.rkt")
(define-runtime-path test-pathup.rkt "test-pathup.rkt")

@ -9,7 +9,7 @@
(define-runtime-path template.txt "data/rerequire/template.txt")
(define-runtime-path markup.txt.pm "data/rerequire/markup.txt.pm")
(define-runtime-path markup.txt "data/rerequire/markup.txt")
(define-runtime-path pollen-cache "data/rerequire/pollen-cache")
(define-runtime-path pollen-cache "data/rerequire/compiled")
(copy-file markup.txt.pm pre.txt.pp #t)

Loading…
Cancel
Save