|
|
@ -11,7 +11,7 @@ render [dir] render project in dir (default is current dir)
|
|
|
|
render path render file
|
|
|
|
render path render file
|
|
|
|
clone copy project to desktop without source files" ,(world:current-server-port))))
|
|
|
|
clone copy project to desktop without source files" ,(world:current-server-port))))
|
|
|
|
|
|
|
|
|
|
|
|
(define (handle-render dir-or-path [port #f])
|
|
|
|
(define (handle-render dir-or-path rest-args)
|
|
|
|
`(begin
|
|
|
|
`(begin
|
|
|
|
(require pollen/render pollen/world pollen/file sugar)
|
|
|
|
(require pollen/render pollen/world pollen/file sugar)
|
|
|
|
(parameterize ([current-directory (world:current-project-root)])
|
|
|
|
(parameterize ([current-directory (world:current-project-root)])
|
|
|
@ -19,7 +19,7 @@ clone copy project to desktop without source files" ,(world:curr
|
|
|
|
(apply render-batch (map ->complete-path (if (not (directory-exists? dir-or-path))
|
|
|
|
(apply render-batch (map ->complete-path (if (not (directory-exists? dir-or-path))
|
|
|
|
(begin
|
|
|
|
(begin
|
|
|
|
(displayln (format "Rendering ~a" dir-or-path))
|
|
|
|
(displayln (format "Rendering ~a" dir-or-path))
|
|
|
|
(list dir-or-path))
|
|
|
|
(cons dir-or-path ',rest-args))
|
|
|
|
(begin
|
|
|
|
(begin
|
|
|
|
(displayln (format "Rendering preproc & pagetree files in directory ~a" dir-or-path))
|
|
|
|
(displayln (format "Rendering preproc & pagetree files in directory ~a" dir-or-path))
|
|
|
|
(apply append (map (λ(proc) (filter proc (directory-list dir-or-path))) (list preproc-source? pagetree-source?))))))))))
|
|
|
|
(apply append (map (λ(proc) (filter proc (directory-list dir-or-path))) (list preproc-source? pagetree-source?))))))))))
|
|
|
@ -35,39 +35,25 @@ clone copy project to desktop without source files" ,(world:curr
|
|
|
|
(start-server)))))
|
|
|
|
(start-server)))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(define (handle-clone directory target)
|
|
|
|
(define (handle-clone directory rest-args)
|
|
|
|
(define target-path (or (and target (path->complete-path (string->path target)))
|
|
|
|
(define target-path (or
|
|
|
|
(build-path (find-system-path 'desk-dir) (string->path "clone"))))
|
|
|
|
(and rest-args (not (null? rest-args)) (path->complete-path (string->path (car rest-args))))
|
|
|
|
|
|
|
|
(build-path (find-system-path 'desk-dir) (string->path world:clone-directory-name))))
|
|
|
|
|
|
|
|
|
|
|
|
`(begin
|
|
|
|
`(begin
|
|
|
|
(displayln "Clone & prune ...")
|
|
|
|
(displayln "Cloning ...")
|
|
|
|
(require racket/file pollen/file)
|
|
|
|
(require racket/file pollen/file)
|
|
|
|
|
|
|
|
|
|
|
|
(define (pollen-related-file? file)
|
|
|
|
|
|
|
|
(ormap (λ(proc) (proc file)) (list
|
|
|
|
|
|
|
|
preproc-source?
|
|
|
|
|
|
|
|
markup-source?
|
|
|
|
|
|
|
|
markdown-source?
|
|
|
|
|
|
|
|
template-source?
|
|
|
|
|
|
|
|
pagetree-source?
|
|
|
|
|
|
|
|
scribble-source?
|
|
|
|
|
|
|
|
null-source?
|
|
|
|
|
|
|
|
racket-source?
|
|
|
|
|
|
|
|
magic-directory?)))
|
|
|
|
|
|
|
|
(define (delete-it path)
|
|
|
|
(define (delete-it path)
|
|
|
|
(when (directory-exists? path)
|
|
|
|
(cond
|
|
|
|
(delete-directory/files path))
|
|
|
|
[(directory-exists? path) (delete-directory/files path)]
|
|
|
|
(when (file-exists? path)
|
|
|
|
[(file-exists? path) (delete-file path)]))
|
|
|
|
(delete-file path)))
|
|
|
|
(define source-dir ,directory)
|
|
|
|
|
|
|
|
(when (not (directory-exists? source-dir)) (error (format "clone error: source directory ~a does not exist" source-dir)))
|
|
|
|
(let ([source-dir ,directory]
|
|
|
|
(define target-dir ,target-path)
|
|
|
|
[target-dir ,target-path])
|
|
|
|
(when (directory-exists? target-dir) (delete-directory/files target-dir))
|
|
|
|
(when (directory-exists? target-dir)
|
|
|
|
(copy-directory/files source-dir target-dir)
|
|
|
|
(delete-directory/files target-dir))
|
|
|
|
(for-each delete-it (find-files pollen-related-file? target-dir))
|
|
|
|
(copy-directory/files source-dir target-dir)
|
|
|
|
(displayln (format "Completed to ~a" ,target-path))))
|
|
|
|
(map delete-it (find-files pollen-related-file? target-dir))
|
|
|
|
|
|
|
|
(displayln (format "Completed to ~a" ,target-path))
|
|
|
|
|
|
|
|
)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(define (handle-else command)
|
|
|
|
(define (handle-else command)
|
|
|
|
`(if (regexp-match #rx"(shit|fuck)" ,command)
|
|
|
|
`(if (regexp-match #rx"(shit|fuck)" ,command)
|
|
|
@ -76,42 +62,3 @@ clone copy project to desktop without source files" ,(world:curr
|
|
|
|
(displayln (format "unknown command ~a" ,command))))
|
|
|
|
(displayln (format "unknown command ~a" ,command))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[("clone") (let ([target-path
|
|
|
|
|
|
|
|
(if (> (len args) 1)
|
|
|
|
|
|
|
|
(->path (get args 1))
|
|
|
|
|
|
|
|
(build-path (find-system-path 'desk-dir) (->path "clone")))])
|
|
|
|
|
|
|
|
`(begin
|
|
|
|
|
|
|
|
(displayln "Clone & prune ...")
|
|
|
|
|
|
|
|
(require racket/file)
|
|
|
|
|
|
|
|
(require "tools.rkt")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(define (pollen-related-file? file)
|
|
|
|
|
|
|
|
(ormap (λ(proc) (proc file)) (list
|
|
|
|
|
|
|
|
markup-source?
|
|
|
|
|
|
|
|
preproc-source?
|
|
|
|
|
|
|
|
template-source?
|
|
|
|
|
|
|
|
pagetree-source?
|
|
|
|
|
|
|
|
pollen-script?
|
|
|
|
|
|
|
|
magic-directory?
|
|
|
|
|
|
|
|
racket-file?)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(define (delete-it path)
|
|
|
|
|
|
|
|
(when (directory-exists? path)
|
|
|
|
|
|
|
|
(delete-directory/files path))
|
|
|
|
|
|
|
|
(when (file-exists? path)
|
|
|
|
|
|
|
|
(delete-file path)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(let ([source-dir (current-directory)]
|
|
|
|
|
|
|
|
[target-dir ,target-path])
|
|
|
|
|
|
|
|
(when (directory-exists? target-dir)
|
|
|
|
|
|
|
|
(delete-directory/files target-dir))
|
|
|
|
|
|
|
|
(copy-directory/files source-dir target-dir)
|
|
|
|
|
|
|
|
(map delete-it (find-files pollen-related-file? target-dir))
|
|
|
|
|
|
|
|
(displayln (format "Completed to ~a" ,target-path))
|
|
|
|
|
|
|
|
)))]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|#
|
|
|
|
|