This repository has been archived by the owner on Jan 24, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.boot
125 lines (111 loc) · 4.2 KB
/
build.boot
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
(set-env!
:dependencies '[[org.clojure/clojure "1.8.0" :scope "test"]
[org.clojure/clojurescript "1.9.293" :scope "test"]
[adzerk/boot-cljs "1.7.228-1" :scope "test"]
[adzerk/boot-reload "0.4.12" :scope "test"]
[cirru/boot-stack-server "0.1.23" :scope "test"]
[binaryage/devtools "0.5.2" :scope "test"]
[adzerk/boot-test "1.1.2" :scope "test"]
[mvc-works/hsl "0.1.2" :scope "test"]
[mvc-works/respo "0.3.2" :scope "test"]
[org.clojure/core.async "0.2.374"]
[cumulo/recollect "0.1.0"]
[cumulo/shallow-diff "0.1.1"]])
(require '[adzerk.boot-cljs :refer [cljs]]
'[adzerk.boot-reload :refer [reload]]
'[stack-server.core :refer [start-stack-editor! transform-stack]]
'[respo.alias :refer [html head title script style meta' div link body]]
'[respo.render.static-html :refer [make-html]]
'[adzerk.boot-test :refer :all]
'[clojure.java.io :as io])
(def +version+ "0.1.1")
(task-options!
pom {:project 'cumulo/client
:version +version+
:description "Cumulo client runner"
:url "https://github.com/Cumulo/cumulo-client"
:scm {:url "https://github.com/Cumulo/cumulo-client"}
:license {"MIT" "http://opensource.org/licenses/mit-license.php"}})
(defn use-text [x] {:attrs {:innerHTML x}})
(defn html-dsl [data fileset]
(make-html
(html {}
(head {}
(title (use-text "Cumulo"))
(link {:attrs {:rel "icon" :type "image/png" :href "http://logo.cirru.org/cirru-400x400.png"}})
(meta'{:attrs {:charset "utf-8"}})
(meta' {:attrs {:name "viewport" :content "width=device-width, initial-scale=1"}})
(meta' {:attrs {:id "ssr-stages" :content "#{}"}})
(style (use-text "body {margin: 0;}"))
(style (use-text "body * {box-sizing: border-box;}"))
(script {:attrs {:id "config" :type "text/edn" :innerHTML (pr-str data)}}))
(body {}
(div {:attrs {:id "app"}})
(script {:attrs {:src "main.js"}})))))
(deftask html-file
"task to generate HTML file"
[d data VAL edn "data piece for rendering"]
(with-pre-wrap fileset
(let [tmp (tmp-dir!)
out (io/file tmp "index.html")]
(empty-dir! tmp)
(spit out (html-dsl data fileset))
(-> fileset
(add-resource tmp)
(commit!)))))
(deftask editor! []
(comp
(repl)
(start-stack-editor!)
(target :dir #{"src/"})))
(deftask dev! []
(set-env!
:asset-paths #{"assets/"})
(comp
(editor!)
(html-file :data {:build? false})
(reload :on-jsload 'cumulo-client.main/on-jsload!
:cljs-asset-path ".")
(cljs :compiler-options {:language-in :ecmascript5})
(target :no-clean true)))
(deftask generate-code []
(comp
(transform-stack :filename "stack-sepal.ir")
(target :dir #{"src/"})))
(deftask build-advanced []
(set-env!
:asset-paths #{"assets/"})
(comp
(transform-stack :filename "stack-sepal.ir")
(cljs :optimizations :advanced
:compiler-options {:language-in :ecmascript5
:pseudo-names true
:static-fns true
:parallel-build true
:optimize-constants true
:source-map true})
(html-file :data {:build? true})
(target)))
(deftask rsync []
(with-pre-wrap fileset
(sh "rsync" "-r" "target/" "tiye:repo/Cumulo/cumulo-client" "--exclude" "main.out" "--delete")
fileset))
(deftask build []
(comp
(transform-stack :filename "stack-sepal.ir")
(pom)
(jar)
(install)
(target)))
(deftask deploy []
(set-env!
:repositories #(conj % ["clojars" {:url "https://clojars.org/repo/"}]))
(comp
(build)
(push :repo "clojars" :gpg-sign (not (.endsWith +version+ "-SNAPSHOT")))))
(deftask watch-test []
(set-env!
:source-paths #{"src" "test"})
(comp
(watch)
(test :namespaces '#{cumulo-client.test})))