add `site' makefile target
Also, adjust stamp handling to ensure that it doesn't change during the build process. original commit: d2ddfc09bd1a68f27822a99aee99743e3204d6fa
This commit is contained in:
parent
a95ce7aa51
commit
21c2b5812c
|
@ -6,7 +6,6 @@
|
||||||
(only-in "config.rkt" extract-options))
|
(only-in "config.rkt" extract-options))
|
||||||
|
|
||||||
(define build-dir (build-path "build"))
|
(define build-dir (build-path "build"))
|
||||||
(define dest-dir (build-path build-dir "site"))
|
|
||||||
|
|
||||||
(define built-dir (build-path build-dir "built"))
|
(define built-dir (build-path build-dir "built"))
|
||||||
(define native-dir (build-path build-dir "native"))
|
(define native-dir (build-path build-dir "native"))
|
||||||
|
@ -23,6 +22,12 @@
|
||||||
|
|
||||||
(define config (extract-options config-file config-mode))
|
(define config (extract-options config-file config-mode))
|
||||||
|
|
||||||
|
(define dest-dir (hash-ref config
|
||||||
|
'#:site-dest
|
||||||
|
(build-path build-dir "site")))
|
||||||
|
|
||||||
|
(printf "Assembling site as ~a\n" dest-dir)
|
||||||
|
|
||||||
(define (copy dir [build-dir build-dir])
|
(define (copy dir [build-dir build-dir])
|
||||||
(make-directory* dest-dir)
|
(make-directory* dest-dir)
|
||||||
(printf "Copying ~a\n" (build-path build-dir dir))
|
(printf "Copying ~a\n" (build-path build-dir dir))
|
||||||
|
|
|
@ -164,6 +164,8 @@
|
||||||
;; machine starts by a `git pull' in <dir>; set
|
;; machine starts by a `git pull' in <dir>; set
|
||||||
;; to #f, for example, for a repo checkout that is
|
;; to #f, for example, for a repo checkout that is
|
||||||
;; shared with server; the default is #t
|
;; shared with server; the default is #t
|
||||||
|
;; #:site-dest <path-string> --- destination for completed build; the default
|
||||||
|
;; is "build/site"
|
||||||
;;
|
;;
|
||||||
;; Machine-only keywords:
|
;; Machine-only keywords:
|
||||||
;;
|
;;
|
||||||
|
@ -233,6 +235,7 @@
|
||||||
site-config-options
|
site-config-options
|
||||||
site-config-content
|
site-config-content
|
||||||
current-mode
|
current-mode
|
||||||
|
current-stamp
|
||||||
extract-options)
|
extract-options)
|
||||||
|
|
||||||
(module reader syntax/module-reader
|
(module reader syntax/module-reader
|
||||||
|
@ -353,6 +356,7 @@
|
||||||
[(#:repo) (string? val)]
|
[(#:repo) (string? val)]
|
||||||
[(#:clean?) (boolean? val)]
|
[(#:clean?) (boolean? val)]
|
||||||
[(#:pull?) (boolean? val)]
|
[(#:pull?) (boolean? val)]
|
||||||
|
[(#:site-dest) (path-string? val)]
|
||||||
[else 'bad-keyword]))
|
[else 'bad-keyword]))
|
||||||
|
|
||||||
(define (check-machine-keyword kw val)
|
(define (check-machine-keyword kw val)
|
||||||
|
@ -368,6 +372,15 @@
|
||||||
|
|
||||||
(define current-mode (make-parameter "default"))
|
(define current-mode (make-parameter "default"))
|
||||||
|
|
||||||
|
(define current-stamp
|
||||||
|
(let* ([f (build-path "build" "stamp.txt")]
|
||||||
|
[s (and (file-exists? f)
|
||||||
|
(call-with-input-file* f read-line))])
|
||||||
|
(lambda ()
|
||||||
|
(if (string? s)
|
||||||
|
s
|
||||||
|
"now"))))
|
||||||
|
|
||||||
(define (extract-options config-file config-mode)
|
(define (extract-options config-file config-mode)
|
||||||
(or
|
(or
|
||||||
(and (file-exists? config-file)
|
(and (file-exists? config-file)
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
(keyword-apply make-download-page
|
(keyword-apply make-download-page
|
||||||
(map car args)
|
(map car args)
|
||||||
(map cdr args)
|
(map cdr args)
|
||||||
table-file)))
|
(list table-file))))
|
||||||
|
|
||||||
(define (make-download-page table-file
|
(define (make-download-page table-file
|
||||||
#:dest [dest "index.html"]
|
#:dest [dest "index.html"]
|
||||||
|
|
|
@ -55,14 +55,16 @@
|
||||||
"attach" "-readwrite" "-noverify" "-noautoopen"
|
"attach" "-readwrite" "-noverify" "-noautoopen"
|
||||||
"-mountpoint" mnt dmg)
|
"-mountpoint" mnt dmg)
|
||||||
(define mnt-name (let-values ([(base name dir?) (split-path mnt)]) (path->string name)))
|
(define mnt-name (let-values ([(base name dir?) (split-path mnt)]) (path->string name)))
|
||||||
;; see also https://github.com/andreyvit/yoursway-create-dmg
|
;; See also https://github.com/andreyvit/yoursway-create-dmg
|
||||||
|
;; First, give Finder a chance to see the new disk:
|
||||||
(define script
|
(define script
|
||||||
@~a{
|
@~a{
|
||||||
tell application "Finder"
|
tell application "Finder"
|
||||||
-- look for a single disk with the mount point as its name
|
-- look for a single disk with the mount point as its name
|
||||||
-- (maybe this works only on newer osx versions?)
|
-- (maybe this works only on newer osx versions?)
|
||||||
set myDisks to every disk
|
|
||||||
set theDMGDisk to ""
|
set theDMGDisk to ""
|
||||||
|
repeat while theDMGDisk = ""
|
||||||
|
set myDisks to every disk
|
||||||
repeat with d in myDisks
|
repeat with d in myDisks
|
||||||
if name of d = "@mnt-name"
|
if name of d = "@mnt-name"
|
||||||
if theDMGDisk = ""
|
if theDMGDisk = ""
|
||||||
|
@ -72,6 +74,9 @@
|
||||||
end if
|
end if
|
||||||
end if
|
end if
|
||||||
end repeat
|
end repeat
|
||||||
|
-- not found? maybe Finder wasn't ready
|
||||||
|
if theDMGDisk = "" then delay 1
|
||||||
|
end repeat
|
||||||
if theDMGDisk = "" then error "Attached DMG not found!"
|
if theDMGDisk = "" then error "Attached DMG not found!"
|
||||||
-- found a single matching disk, continue
|
-- found a single matching disk, continue
|
||||||
tell theDMGDisk
|
tell theDMGDisk
|
||||||
|
|
Loading…
Reference in New Issue
Block a user