diff --git a/debug.rkt b/debug.rkt index 26a4e6e..a4414e3 100644 --- a/debug.rkt +++ b/debug.rkt @@ -61,6 +61,12 @@ (define (make-debug-timestamp) (format "[~a ∆~as]" (make-timestamp) (seconds-since-last-message))) + + +;; todo: consolidate these two message functions +(define (basic-message . items) + (displayln (string-join `(,@(map (λ(x)(if (string? x) x (~v x))) items))) (current-error-port))) + (define (message . items) (displayln (string-join `(,(make-debug-timestamp) ,@(map (λ(x)(if (string? x) x (~v x))) items))) (current-error-port))) @@ -68,5 +74,5 @@ ; report the current value of the variable, then return it (define-syntax-rule (report var) (begin - (message 'var "=" var) + (basic-message 'var "=" var) var)) \ No newline at end of file diff --git a/file-tools.rkt b/file-tools.rkt index 2f0eeb7..d31b229 100644 --- a/file-tools.rkt +++ b/file-tools.rkt @@ -45,7 +45,7 @@ (module+ test (check-true (directory-pathish? "/Users/")) - (check-false (directory-pathish? "foobar"))) + (check-false (directory-pathish? "foobarzooblish"))) ;; helper function for ptree @@ -70,7 +70,7 @@ (module+ test (define foo-path-strings '("foo" "foo.txt" "foo.bar" "foo.bar.txt")) (define-values (foo-path foo.txt-path foo.bar-path foo.bar.txt-path) - (apply values (map string->path foo-path-strings))) + (apply values (map ->path foo-path-strings))) ;; test the sample paths before using them for other tests (define foo-paths (list foo-path foo.txt-path foo.bar-path foo.bar.txt-path)) (for-each check-equal? (map ->string foo-paths) foo-path-strings)) diff --git a/foobar/-main.html b/foobar/-main.html new file mode 100644 index 0000000..9c3a2a9 --- /dev/null +++ b/foobar/-main.html @@ -0,0 +1 @@ +world 10201 \ No newline at end of file diff --git a/foobar/screen.gif b/foobar/screen.gif new file mode 100644 index 0000000..a7b2fb6 Binary files /dev/null and b/foobar/screen.gif differ diff --git a/server-route-index.rkt b/server-route-index.rkt index ab85de3..d9a40c5 100644 --- a/server-route-index.rkt +++ b/server-route-index.rkt @@ -1,22 +1,36 @@ #lang racket/base (require racket/list racket/set) -(require "readability.rkt" "file-tools.rkt" "world.rkt") +(require "readability.rkt" "file-tools.rkt" "world.rkt" "debug.rkt") (define (pd which) - (->path (format "/Users/MB/git/~a" which))) + (->path (format "/Users/MB/git/pollen/~a" which))) -(define (ineligible-path? f) - (or (not (visible? f)) (member f RESERVED_PATHS))) - -(define (unique-members xs) - (set->list (list->set xs))) - (define (route-index [dir pollen-project-directory]) - (define unique-eligible-paths - (unique-members (map ->output-path - (filter-not ineligible-path? (directory-list dir))))) - unique-eligible-paths) + (define (make-link-cell [href+text (cons #f #f)]) + (define href (car href+text)) + (define text (cdr href+text)) + (filter-not void? `(td ,(when (and href text) + `(a ((href ,href)) ,text))))) + + (define (make-path-row p) + (define pstring (->string p)) + (define (file-in-dir? p) (file-exists? (apply build-path (map ->path (list dir p))))) + (define sources (filter file-in-dir? (list (->preproc-source-path pstring) (->pollen-source-path pstring)))) + `(tr ,@(map make-link-cell (list + (cons pstring pstring) + (cons (format "raw/~a" pstring) "raw") + (if (not (empty? sources)) + (cons (->string (car sources)) "source") + (cons #f #f)))))) + + (define (unique-sorted-paths xs) + (sort (set->list (list->set (map ->output-path xs))) #:key ->string stringpath (list POLLEN_COMMAND_FILE EXTRAS_DIR))) + +