From 58990ff48510ce2975624a5de7f0355c4e078c6e Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Mon, 6 Jan 2014 22:39:30 -0800 Subject: [PATCH] updates --- command.rkt | 5 +++-- file-tools.rkt | 22 +++++++++++----------- info.rkt | 3 --- main-preproc.rkt | 2 +- world.rkt | 7 ++++--- 5 files changed, 19 insertions(+), 20 deletions(-) delete mode 100644 info.rkt diff --git a/command.rkt b/command.rkt index b47d620..a6a9099 100644 --- a/command.rkt +++ b/command.rkt @@ -2,12 +2,13 @@ ;; todo: add command to check validity of installation -(require (for-syntax "readability.rkt")) +(require (for-syntax "readability.rkt" "world.rkt")) (define-syntax (handle-pollen-command syntax-context) (datum->syntax syntax-context (let* ([args (current-command-line-arguments)] [arg (if (> (len args) 0) (get args 0) "")]) + (display (format "~a: " POLLEN_COMMAND_FILE)) (case arg [("start") `(require "server.rkt")] [("render") `(begin @@ -55,6 +56,6 @@ `(begin (require (planet mb/pollen/render)) (render ,possible-file)) - `(displayln (format "No command defined for ~a" ,arg))))])))) + `(displayln (format "No command defined for '~a'" ,arg))))])))) (handle-pollen-command) diff --git a/file-tools.rkt b/file-tools.rkt index 43ba5c1..0cbd1fd 100644 --- a/file-tools.rkt +++ b/file-tools.rkt @@ -144,7 +144,7 @@ (has-ext? (->path x) POLLEN_PREPROC_EXT)) (module+ test - (check-true (preproc-source? "foo.pp")) + (check-true (preproc-source? "foo.p")) (check-false (preproc-source? "foo.bar"))) (define/contract (has-preproc-source? x) @@ -180,8 +180,8 @@ (has-ext? x POLLEN_SOURCE_EXT)) (module+ test - (check-true (pollen-source? "foo.p")) - (check-false (pollen-source? "foo.pp"))) + (check-true (pollen-source? "foo.pd")) + (check-false (pollen-source? "foo.p"))) (define/contract (template-source? x) @@ -216,10 +216,10 @@ (add-ext x POLLEN_PREPROC_EXT)))) (module+ test - (check-equal? (->preproc-source-path (->path "foo.pp")) (->path "foo.pp")) - (check-equal? (->preproc-source-path (->path "foo.html")) (->path "foo.html.pp")) - (check-equal? (->preproc-source-path "foo") (->path "foo.pp")) - (check-equal? (->preproc-source-path 'foo) (->path "foo.pp"))) + (check-equal? (->preproc-source-path (->path "foo.p")) (->path "foo.p")) + (check-equal? (->preproc-source-path (->path "foo.html")) (->path "foo.html.p")) + (check-equal? (->preproc-source-path "foo") (->path "foo.p")) + (check-equal? (->preproc-source-path 'foo) (->path "foo.p"))) (define/contract (->output-path x) (pathish? . -> . path?) @@ -247,10 +247,10 @@ (add-ext x POLLEN_SOURCE_EXT)))) (module+ test - (check-equal? (->pollen-source-path (->path "foo.p")) (->path "foo.p")) - (check-equal? (->pollen-source-path (->path "foo.html")) (->path "foo.html.p")) - (check-equal? (->pollen-source-path "foo") (->path "foo.p")) - (check-equal? (->pollen-source-path 'foo) (->path "foo.p"))) + (check-equal? (->pollen-source-path (->path "foo.pd")) (->path "foo.pd")) + (check-equal? (->pollen-source-path (->path "foo.html")) (->path "foo.html.pd")) + (check-equal? (->pollen-source-path "foo") (->path "foo.pd")) + (check-equal? (->pollen-source-path 'foo) (->path "foo.pd"))) (define/contract (project-files-with-ext ext) (symbol? . -> . (listof complete-path?)) diff --git a/info.rkt b/info.rkt deleted file mode 100644 index bed5993..0000000 --- a/info.rkt +++ /dev/null @@ -1,3 +0,0 @@ -#lang info -(define collection 'multi) -(define collection "pollen") diff --git a/main-preproc.rkt b/main-preproc.rkt index 102f635..bb46e83 100644 --- a/main-preproc.rkt +++ b/main-preproc.rkt @@ -31,6 +31,6 @@ (module+ main (displayln ";-------------------------") - (displayln (string-append "; pollen decoded 'text")) + (displayln (string-append "; pollen 'text")) (displayln ";-------------------------") (display text)))) diff --git a/world.rkt b/world.rkt index 83c0acc..97a6e3e 100644 --- a/world.rkt +++ b/world.rkt @@ -2,8 +2,8 @@ (provide (all-defined-out)) -(define POLLEN_PREPROC_EXT 'pp) -(define POLLEN_SOURCE_EXT 'p) +(define POLLEN_PREPROC_EXT 'p) +(define POLLEN_SOURCE_EXT 'pd) (define TEMPLATE_FILE_PREFIX "-") (define POLLEN_EXPRESSION_DELIMITER #\◊) (define TEMPLATE_FIELD_DELIMITER POLLEN_EXPRESSION_DELIMITER) @@ -23,7 +23,7 @@ (define EXTRAS_DIR (string->path "pollen-require")) -(define MISSING_FILE_BOILERPLATE "#lang planet mb/pollen\n\n") +(define MISSING_FILE_BOILERPLATE "#lang pollen\n\n") (define LINE_BREAK "\n") (define PARAGRAPH_BREAK "\n\n") @@ -33,6 +33,7 @@ (define RACKET_PATH "/usr/bin/racket") (define POLLEN_ROOT 'main) +(define POLLEN_COMMAND_FILE "polcom") ; get the starting directory, which is the parent of 'run-file (define POLLEN_PROJECT_DIR