blob: ff1edea29d7e0afc850c24b5e317af2cdecc4b39 (
plain)
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
53
|
#!/usr/bin/env bb
;; Usage: bb build.clj <no_chache?> <rebuild_scripts?>
(require '[babashka.tasks :refer [shell]])
;; configuration
(def theme-path "themes/venin")
;; banner
(defn banner []
(println "
▐
▄▄ ▄▖ ▄▖ ▄▟ ▄▖ ▄▖ ▗▄▖ ▖▄ ▄▖
▐▘▜ ▐▘▐ ▐▘▐ ▐▘▜ ▐▘▐ ▝ ▐ ▐▘▜ ▛ ▘▐▘▜
▐ ▐ ▐▀▀ ▐▀▀ ▐ ▐ ▐▀▀ ▗▀▜ ▐ ▐ ▌ ▐ ▐
▝▙▜ ▝▙▞ ▝▙▞ ▝▙█ ▝▙▞ ▝▄▜ ▐ ▐▙▛ ▌ ▝▙▛
▖▐ ▐
▝▘ ▝
"))
;; build steps
(defn pull-new-changes []
;; pull from content repository
(println "☠︎ Pulling from content repository...")
(shell "git" "pull" "origin" "master")
;; pull from theme repository
(println "☠︎ Pulling from theme repository...")
(shell {:dir theme-path} "git" "pull" "origin" "master"))
(defn build-theme [step]
(println (str "☠︎ " step "-building theme..."))
(shell {:dir theme-path} "bb" "build.clj" (str step "-build")))
(defn build-site [no-cache?]
(println "☠︎ Generating static site...")
(shell "hugo" "--gc" "--minify"
(cond no-cache? "--ignoreCache")))
;; main process
(defn before-build-site []
(pull-new-changes)
(build-theme "pre"))
(defn after-build-site []
(build-theme "post"))
(let [[no-cache?] *command-line-args*]
(banner)
(before-build-site)
(build-site (parse-boolean (or no-cache? "false")))
(after-build-site))
|