pull/9/head
Matthew Butterick 11 years ago
parent b6d409de90
commit 58990ff485

@ -2,12 +2,13 @@
;; todo: add command to check validity of installation ;; 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) (define-syntax (handle-pollen-command syntax-context)
(datum->syntax syntax-context (datum->syntax syntax-context
(let* ([args (current-command-line-arguments)] (let* ([args (current-command-line-arguments)]
[arg (if (> (len args) 0) (get args 0) "")]) [arg (if (> (len args) 0) (get args 0) "")])
(display (format "~a: " POLLEN_COMMAND_FILE))
(case arg (case arg
[("start") `(require "server.rkt")] [("start") `(require "server.rkt")]
[("render") `(begin [("render") `(begin
@ -55,6 +56,6 @@
`(begin `(begin
(require (planet mb/pollen/render)) (require (planet mb/pollen/render))
(render ,possible-file)) (render ,possible-file))
`(displayln (format "No command defined for ~a" ,arg))))])))) `(displayln (format "No command defined for '~a'" ,arg))))]))))
(handle-pollen-command) (handle-pollen-command)

@ -144,7 +144,7 @@
(has-ext? (->path x) POLLEN_PREPROC_EXT)) (has-ext? (->path x) POLLEN_PREPROC_EXT))
(module+ test (module+ test
(check-true (preproc-source? "foo.pp")) (check-true (preproc-source? "foo.p"))
(check-false (preproc-source? "foo.bar"))) (check-false (preproc-source? "foo.bar")))
(define/contract (has-preproc-source? x) (define/contract (has-preproc-source? x)
@ -180,8 +180,8 @@
(has-ext? x POLLEN_SOURCE_EXT)) (has-ext? x POLLEN_SOURCE_EXT))
(module+ test (module+ test
(check-true (pollen-source? "foo.p")) (check-true (pollen-source? "foo.pd"))
(check-false (pollen-source? "foo.pp"))) (check-false (pollen-source? "foo.p")))
(define/contract (template-source? x) (define/contract (template-source? x)
@ -216,10 +216,10 @@
(add-ext x POLLEN_PREPROC_EXT)))) (add-ext x POLLEN_PREPROC_EXT))))
(module+ test (module+ test
(check-equal? (->preproc-source-path (->path "foo.pp")) (->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.pp")) (check-equal? (->preproc-source-path (->path "foo.html")) (->path "foo.html.p"))
(check-equal? (->preproc-source-path "foo") (->path "foo.pp")) (check-equal? (->preproc-source-path "foo") (->path "foo.p"))
(check-equal? (->preproc-source-path 'foo) (->path "foo.pp"))) (check-equal? (->preproc-source-path 'foo) (->path "foo.p")))
(define/contract (->output-path x) (define/contract (->output-path x)
(pathish? . -> . path?) (pathish? . -> . path?)
@ -247,10 +247,10 @@
(add-ext x POLLEN_SOURCE_EXT)))) (add-ext x POLLEN_SOURCE_EXT))))
(module+ test (module+ test
(check-equal? (->pollen-source-path (->path "foo.p")) (->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.p")) (check-equal? (->pollen-source-path (->path "foo.html")) (->path "foo.html.pd"))
(check-equal? (->pollen-source-path "foo") (->path "foo.p")) (check-equal? (->pollen-source-path "foo") (->path "foo.pd"))
(check-equal? (->pollen-source-path 'foo) (->path "foo.p"))) (check-equal? (->pollen-source-path 'foo) (->path "foo.pd")))
(define/contract (project-files-with-ext ext) (define/contract (project-files-with-ext ext)
(symbol? . -> . (listof complete-path?)) (symbol? . -> . (listof complete-path?))

@ -1,3 +0,0 @@
#lang info
(define collection 'multi)
(define collection "pollen")

@ -31,6 +31,6 @@
(module+ main (module+ main
(displayln ";-------------------------") (displayln ";-------------------------")
(displayln (string-append "; pollen decoded 'text")) (displayln (string-append "; pollen 'text"))
(displayln ";-------------------------") (displayln ";-------------------------")
(display text)))) (display text))))

@ -2,8 +2,8 @@
(provide (all-defined-out)) (provide (all-defined-out))
(define POLLEN_PREPROC_EXT 'pp) (define POLLEN_PREPROC_EXT 'p)
(define POLLEN_SOURCE_EXT 'p) (define POLLEN_SOURCE_EXT 'pd)
(define TEMPLATE_FILE_PREFIX "-") (define TEMPLATE_FILE_PREFIX "-")
(define POLLEN_EXPRESSION_DELIMITER #\◊) (define POLLEN_EXPRESSION_DELIMITER #\◊)
(define TEMPLATE_FIELD_DELIMITER POLLEN_EXPRESSION_DELIMITER) (define TEMPLATE_FIELD_DELIMITER POLLEN_EXPRESSION_DELIMITER)
@ -23,7 +23,7 @@
(define EXTRAS_DIR (string->path "pollen-require")) (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 LINE_BREAK "\n")
(define PARAGRAPH_BREAK "\n\n") (define PARAGRAPH_BREAK "\n\n")
@ -33,6 +33,7 @@
(define RACKET_PATH "/usr/bin/racket") (define RACKET_PATH "/usr/bin/racket")
(define POLLEN_ROOT 'main) (define POLLEN_ROOT 'main)
(define POLLEN_COMMAND_FILE "polcom")
; get the starting directory, which is the parent of 'run-file ; get the starting directory, which is the parent of 'run-file
(define POLLEN_PROJECT_DIR (define POLLEN_PROJECT_DIR

Loading…
Cancel
Save