Distribution via rsync.
This commit is contained in:
parent
1af5b69588
commit
8603bd22b0
|
@ -9,7 +9,8 @@ exec "$exe" "$0" "$@"
|
|||
|
||||
(require racket/cmdline racket/runtime-path
|
||||
racket/string racket/file
|
||||
"html/resource.rkt" "config.rkt" "navbar.rkt")
|
||||
"html/resource.rkt" "common/distribute.rkt"
|
||||
"config.rkt" "navbar.rkt")
|
||||
|
||||
(define build-mode #f)
|
||||
(define distribute? #f)
|
||||
|
@ -59,12 +60,7 @@ exec "$exe" "$0" "$@"
|
|||
(for-each delete-directory/files paths)
|
||||
(raise-user-error 'build "Aborting."))))
|
||||
|
||||
(printf "Building~a ~a content...\n"
|
||||
(if distribute? " and distributing" "") build-mode)
|
||||
(parameterize ([url-roots (and (eq? 'web build-mode)
|
||||
(map (lambda (site)
|
||||
(list (site-dir site)
|
||||
(site-url site)))
|
||||
sites))])
|
||||
(render-all))
|
||||
(printf "Building ~a content...\n" build-mode)
|
||||
(parameterize ([url-roots (and (eq? 'web build-mode) sites)]) (render-all))
|
||||
(when distribute? (printf "Distributing...\n") (distribute distributions))
|
||||
(printf "Done.\n")
|
||||
|
|
16
collects/meta/web/common/distribute.rkt
Normal file
16
collects/meta/web/common/distribute.rkt
Normal file
|
@ -0,0 +1,16 @@
|
|||
#lang racket/base
|
||||
|
||||
(require racket/system racket/list racket/promise "../config.rkt")
|
||||
|
||||
(define rsync-exe (delay (or (find-executable-path "rsync")
|
||||
(error 'distribute "couldn't find `rsync'"))))
|
||||
|
||||
(define (rsync . args)
|
||||
(unless (apply system* (force rsync-exe) args)
|
||||
(error 'distribute "errors when running: rsync with ~s" args)))
|
||||
|
||||
(provide distribute)
|
||||
(define (distribute specs)
|
||||
(for ([s (in-list specs)])
|
||||
(let ([srcs (cdr s)] [tgt (car s)])
|
||||
(apply rsync "-aqz" "-e" "ssh" "--delete" `(,@srcs ,tgt)))))
|
|
@ -1,8 +1,16 @@
|
|||
#lang racket/base
|
||||
|
||||
(provide (struct-out site) sites)
|
||||
(struct site (dir url))
|
||||
(define sites (list (site "www" "http://racket-lang.org/")
|
||||
(site "download" "http://download.racket-lang.org/")
|
||||
(site "stubs/git" "http://git.racket-lang.org/")
|
||||
(site "stubs/blog" "http://blog.racket-lang.org/")))
|
||||
(provide sites)
|
||||
(define sites
|
||||
'(("www" "http://racket-lang.org/")
|
||||
("download" "http://download.racket-lang.org/")
|
||||
("stubs/pre" "http://pre.racket-lang.org/")
|
||||
("stubs/git" "http://git.racket-lang.org/")
|
||||
("stubs/blog" "http://blog.racket-lang.org/")))
|
||||
|
||||
(provide distributions)
|
||||
(define distributions
|
||||
;; Each is a "hostname:dest-path", and then a list of directories to
|
||||
;; put in that path. (Warning: "dest" should not be a top-level
|
||||
;; directory that already exists.)
|
||||
'(("champlain:/www/new" "www" "download")))
|
||||
|
|
Loading…
Reference in New Issue
Block a user