-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathbb.edn
More file actions
64 lines (53 loc) · 3.46 KB
/
bb.edn
File metadata and controls
64 lines (53 loc) · 3.46 KB
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
54
55
56
57
58
59
60
61
62
63
64
{:paths ["scripts"]
:tasks
{:requires ([babashka.cli :as cli]
[babashka.fs :as fs]
[babashka.process :refer [shell]]
[manage :as m]
[clojure.java.io :as io]
[clojure.string :as str])
component (let [component (first *command-line-args*)]
(println (format "Creating new component: %s" component))
(m/new-component component)
(println (format "Done! \n\n Please add \"components/%s/src\" to the :paths section of your deps.edn file." component)))
base (let [base (first *command-line-args*)]
(println (format "Creating new base: %s" base))
(m/new-base base)
(println (format "Done! \n\n Please add \"bases/%s/src\" to the :paths section of your deps.edn file." base)))
project (let [project (first *command-line-args*)]
(println (format "Creating new project: %s" project))
(m/new-project project)
(println (format "Done! \n\n Please add \"projects/%s/src\" to the :paths section of your deps.edn file." project)))
;;; Commands
import-help (do
(clojure "-X:dev:import-help")
(fs/copy-tree "bases/behave-docs/XHTML_Output/Resources/Images/"
"projects/behave/resources/public/help/images"
{:replace-existing true})
(shell "find projects/behave/resources/public/help/images -type f ( -iname \"*.jpg\" -o -iname \"*.jpeg\" -o -iname \"*.png\" ) -exec sh -c 'for file do convert \"$file\" \"${file%.*}.webp\" && echo \"Converted $file to ${file%.*}.webp\"; done' sh {} +")
(shell "find projects/behave/resources/public/help/images -type f ( -iname \"*.jpg\" -o -iname \"*.jpeg\" -o -iname \"*.png\" ) -exec rm {} +"))
;;; Datomic
-today (str (java.time.LocalDate/now))
dump {:depends [-today]
:task (shell (format "pg_dump -U datomic datomic -Fc --file=datomic-backup-%s.dump" -today))}
dump-sql {:depends [-today]
:task (shell (format "pg_dump -U datomic datomic --file=datomic-backup-%s.sql" -today))}
restore (let [db-dump (:file (cli/parse-opts *command-line-args*))]
(shell "psql -U datomic -d datomic -c 'DROP TABLE IF EXISTS datomic_kvs'")
(if (str/ends-with? db-dump "sql")
(shell (format "psql -U datomic -d datomic --file %s" db-dump))
(shell (format "pg_restore -U datomic -d datomic %s" db-dump))))
-datomic (str (io/file (str (fs/home)) ".datomic" "current" "bin"))
transactor {:depends [-datomic]
:task
(let [transactor (io/file -datomic "transactor")
options "-Ddatomic.printConnectionInfo=true"
config (str (fs/cwd) "/bases/datomic_store/config/datomic-sql.properties")]
(shell
(format "%s %s %s" transactor options config)))}
console {:depends [-datomic]
:task
(let [console (io/file -datomic "console")
port (or (:port (cli/parse-opts *command-line-args* {:coerce {:port :int}})) 8000)
url "datomic:sql://?jdbc:postgresql://localhost:5432/datomic?user=datomic&password=datomic"]
(shell (format "%s -p %d db %s" console port url)))}}}