-
Notifications
You must be signed in to change notification settings - Fork 0
/
dev.clj
60 lines (46 loc) · 1.42 KB
/
dev.clj
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
(ns dev
(:refer-clojure :exclude [test])
(:require
[clojure.java.io :as io]
[clojure.java.shell :as shell]
[clojure.repl :refer :all]
[clojure.tools.namespace.repl :refer [refresh]]
[duct.core :as duct]
[duct.core.repl :as duct-repl]
[eftest.runner :as eftest]
[fipp.edn :refer [pprint]]
[integrant.core :as ig]
[integrant.repl :refer [clear go halt init prep]]
[integrant.repl.state :refer [config system]]
[orchestra.spec.test :as stest]))
(duct/load-hierarchy)
(defn read-config []
(duct/read-config (io/resource "route_guide/config.edn")))
(defn reset []
(let [result (integrant.repl/reset)]
(with-out-str (stest/instrument))
result))
;;; unit testing
(defn test
([]
(eftest/run-tests (eftest/find-tests "test")
{:multithread? false}))
([sym]
(eftest/run-tests (eftest/find-tests sym)
{:multithread? false})))
;;; Protocol Buffers
(defn gen-clj []
(let [{:keys [exit out err]} (shell/sh "make" "gen-clj")]
(print out)
(when-not (zero? exit)
(print err))))
;;; namespace settings
(clojure.tools.namespace.repl/set-refresh-dirs "dev/src" "src" "test")
;; miscellaneous utilities
(defn db []
(:route-guide.boundary.db.core/db system))
(when (io/resource "local.clj")
(load "local"))
(def profiles
[:duct.profile/dev :duct.profile/local])
(integrant.repl/set-prep! #(duct/prep-config (read-config) profiles))