-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbb.edn
22 lines (21 loc) · 1.18 KB
/
bb.edn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
; recreating "pg_dump --create dev_blog >
; backups/dev_blog:$(date-Iseconds).dump" in bb
; run `bb backup` to backup database
{:min-bb-version "0.4.0",
:tasks {; CONSTANTS
db-name "functional_news",
backup-dir "local",
now (str (java.time.LocalDateTime/now)),
; PURE FUNCTIONS
backup-path {:depends [db-name backup-dir now], :task (str backup-dir "/" db-name "_backup:" now ".sql")},
backup-command {:depends [db-name], :task (str "pg_dump " db-name)},
; IMPURE FUNCTIONS
create-backup-dir {:depends [backup-dir], :task (babashka.fs/create-dirs backup-dir)},
backup {:depends [db-name backup-path backup-command create-backup-dir],
:task (do (println (str "Backing up database: " db-name))
(println (str "Backup location: " backup-path))
(shell {:out backup-path} backup-command)
(println "Backup successful! 🚀"))},
sass (shell "npx sass --watch resources/scss:resources/public/assets/css"),
repl (shell "rlwrap clojure -M:repl"),
db {:depends [db-name], :task (shell (str "psql " db-name))}}}