-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.rkt
53 lines (38 loc) · 1.39 KB
/
build.rkt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#lang racket
;;;
;;; Build
;;;
; This file creates a new folder "build", then copies all files
; needed to deploy the app on the server, to the folder.
; If the build folder already exists, it is deleted.
(require racket/runtime-path)
(define current-prefix (make-parameter ""))
(define current-build-directory (make-parameter "build"))
(define-runtime-path files-root "files-root")
(define-runtime-path app-rs "app-racket-stories")
(define (build app-dir)
(define base (current-prefix))
(define (to-path dir)
(match base
["" (build-path dir)]
[_ (build-path base dir)]))
(define build-dir (to-path (current-build-directory)))
; DELETE build-dir
(when (directory-exists? build-dir)
(delete-directory/files build-dir #:must-exist? #t))
; make the build directory
(unless (directory-exists? build-dir)
(make-directory build-dir))
; copy the app(s)
(copy-directory/files (to-path app-dir)
(build-path build-dir app-dir))
; copy the static files
(copy-directory/files files-root
(build-path build-dir "files-root"))
; database path
(define dbs-dir (build-path build-dir "dbs"))
(unless (directory-exists? (to-path dbs-dir))
(make-directory (to-path dbs-dir)))
(copy-directory/files "server.rkt"
(build-path build-dir "server.rkt")))
(build "app-racket-stories")