|
|
@ -1,6 +1,51 @@
|
|
|
|
#lang racket/base
|
|
|
|
#lang racket/base
|
|
|
|
(require (for-syntax racket/base))
|
|
|
|
(require (for-syntax racket/base))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; Handle commands from raco
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; arg 0 will be the command name
|
|
|
|
|
|
|
|
(define-for-syntax args (current-command-line-arguments))
|
|
|
|
|
|
|
|
(define-for-syntax arg-command-name (with-handlers ([exn:fail? (λ(exn) #f)])
|
|
|
|
|
|
|
|
(vector-ref args 0)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(define-for-syntax arg-project-directory
|
|
|
|
|
|
|
|
(if (> (vector-length args) 1)
|
|
|
|
|
|
|
|
(with-handlers ([exn:fail? (λ(exn) #f)])
|
|
|
|
|
|
|
|
(let ([possible-path (path->complete-path (simplify-path (string->path (vector-ref args 1))))])
|
|
|
|
|
|
|
|
possible-path))
|
|
|
|
|
|
|
|
(current-directory)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(define-for-syntax (command-error error-string)
|
|
|
|
|
|
|
|
`(displayln (string-append "Error: ", error-string)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(define-syntax (just-a-hook-for-the-macro stx)
|
|
|
|
|
|
|
|
(if arg-command-name
|
|
|
|
|
|
|
|
(datum->syntax stx
|
|
|
|
|
|
|
|
(case arg-command-name
|
|
|
|
|
|
|
|
[("nothing") '(begin)]
|
|
|
|
|
|
|
|
[("test") `(displayln "All systems go")]
|
|
|
|
|
|
|
|
[("start")
|
|
|
|
|
|
|
|
(if (not (directory-exists? arg-project-directory))
|
|
|
|
|
|
|
|
(command-error (format "~a is not a directory" arg-project-directory))
|
|
|
|
|
|
|
|
`(begin
|
|
|
|
|
|
|
|
(require pollen/server pollen/world)
|
|
|
|
|
|
|
|
(parameterize ([world:current-project-root ,arg-project-directory])
|
|
|
|
|
|
|
|
(start-server))))]
|
|
|
|
|
|
|
|
[else (if (regexp-match #rx"(shit|fuck)" arg-command-name)
|
|
|
|
|
|
|
|
(displayln (let ([responses '("Cursing at free software? Really?" "How uncouth." "Same to you, buddy.")])
|
|
|
|
|
|
|
|
(list-ref responses (random (length responses)))))
|
|
|
|
|
|
|
|
(command-error (format "unknown command ~a" arg-command-name)))]))
|
|
|
|
|
|
|
|
#'(begin)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(just-a-hook-for-the-macro)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#lang racket/base
|
|
|
|
|
|
|
|
(require (for-syntax racket/base))
|
|
|
|
|
|
|
|
|
|
|
|
;; todo: add command to check validity of installation
|
|
|
|
;; todo: add command to check validity of installation
|
|
|
|
|
|
|
|
|
|
|
|
(require (for-syntax sugar "world.rkt"))
|
|
|
|
(require (for-syntax sugar "world.rkt"))
|
|
|
@ -66,3 +111,4 @@ polcom [filename] (renders individual file)")]
|
|
|
|
|
|
|
|
|
|
|
|
(handle-pollen-command)
|
|
|
|
(handle-pollen-command)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|#
|