-
Notifications
You must be signed in to change notification settings - Fork 0
/
project.clj
180 lines (160 loc) · 6.73 KB
/
project.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
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
;; dependencies are separated by functional concerns and documented
;; here as vars. See the bottom of the file for the declaration of the
;; structure of the project.
;;;;;;;;;;
;; app ;;
;;;;;;;;;;
(def plugins
"The leiningen plugins that are necessary for this project to run stand
alone."
'[[lein-cljsbuild "1.0.6"]
[lein-environ "1.0.0"]])
(def language-deps
"Languages used in the system"
'[[org.clojure/clojure "1.7.0-master-SNAPSHOT"] ;; <- conditional readers
[org.clojure/clojurescript "0.0-3308"]])
(def channel-deps
"Used to build communication channels both inter and intra the client<->server
barrier."
'[[org.clojure/core.async "0.1.346.0-17112a-alpha"]
[com.taoensso/sente "1.6.0-RC1"]
;; Transit deps used to aid perf. of larger data payloads
;; (see reference example for details):
;; http://blog.cognitect.com/blog/2014/7/22/transit
[com.cognitect/transit-clj "0.8.259"]
[com.cognitect/transit-cljs "0.8.199"]])
(def server-deps
"Regular HTTP/WS server related deps."
'[[http-kit "2.1.19"]
[ring "1.3.2"]
[ring/ring-defaults "0.1.3"] ; Includes `ring-anti-forgery`
[fogus/ring-edn "0.3.0"]
[compojure "1.3.4"]
[enlive "1.1.5"]
[ring-ttl-session "0.3.0"]])
(def logging-deps
'[[com.taoensso/timbre "4.0.2"]])
(def auth-deps
"Dealing with authentication and authorization."
'[[buddy/buddy-hashers "0.4.2"]
[buddy/buddy-auth "0.5.3"]
[crypto-random "1.2.0"]])
(def license
"The point of unlicense is to increase the awareness that IP will not protect
this project. Speed, competence and secrecy will."
{:name "Unlicense" :url "http://unlicense.org/"})
(def environment-deps
"Controls environment-based variables, such as database connections."
'[[environ "1.0.0"]])
(def ui-deps
"Used to build the user interface widgets and their relationship with data."
'[[reagent "0.5.0"]
;; attaching a unique key to every item in a dynamically
;; generated list of components is good practice, and helps React
;; to improve performance for large lists. The key can be given
;; either (as in this example) as meta-data, or as a :key item in
;; the first argument to a component (if it is a map). See
;; React’s documentation [2] for more info.[1]
;; [1] https://holmsand.github.io/reagent/index.html
;; [2] http://facebook.github.io/react/docs/multiple-components.html#dynamic-children
[com.lucasbradstreet/cljs-uuid-utils "1.0.2"]])
(def cljsbuild-compiler-config
"Used to compile regularly and also for hot loading of cljs code in
development. For the options themselves see
https://github.com/clojure/clojurescript/wiki/Compiler-Options"
{:output-to "resources/public/js/app.js"
:output-dir "resources/public/js/out"
:main "carpet.main"
:asset-path "/js/out"
:source-map-timestamp true
:optimizations :none
:source-map true
:pretty-print true
:verbose true})
;;;;;;;;;;;;;;;;;
;; development ;;
;;;;;;;;;;;;;;;;;
(def css-dirs
"Used to hot load CSS modifications."
["resources/public/css"])
(def invariance-deps
"Quality control by ensuring some invariances. Both existential (contracts and
tests) and universal (static types) enforcers should be here."
'[[org.clojure/core.typed "0.3.4"]
[midje "1.7.0-SNAPSHOT" :exclusions [org.clojure/clojure]]])
(def workflow-deps
"Used to stablish a workflow where the CLJS is automatically builded
and hot loaded, and a CLJS repl is possible."
'[[lein-figwheel "0.3.7"]
[figwheel-sidecar "0.3.7"]
[com.cemerick/piggieback "0.2.1"]
[org.clojure/tools.nrepl "0.2.10"]
[weasel "0.7.0"]])
;;;;;;;;;;;;;;;;;;
;; source tree ;;
;;;;;;;;;;;;;;;;;;
(defn get-source-path [root]
"to understand the common-path, read the file organization part of
http://www.danielcompton.net/2015/06/10/clojure-reader-conditionals-by-example"
(let [common-path (str root "cljc")]
{:clj [common-path (str root "clj")]
:cljs [common-path (str root "cljs")]}))
(def source-paths
{:app (get-source-path "src/")
:dev (get-source-path "env/dev/")})
;;;;;;;;;;;;;;;;
;; definition ;;
;;;;;;;;;;;;;;;;
(defproject carpet "0.0.1" ; For version semantics, see http://semver.org/
:description "Web and mobile interface using a single source style."
:license ~license
:dependencies ~(concat language-deps
channel-deps
server-deps
logging-deps
auth-deps
environment-deps
ui-deps)
:plugins ~plugins
:source-paths ~(-> source-paths :app :clj)
;; Namespace with -main function called with 'lein run'.
:main carpet.server
:cljsbuild {:builds {:app {:source-paths ~(-> source-paths :app :cljs)
:compiler ~cljsbuild-compiler-config}}}
:profiles
{:dev {:global-vars {*warn-on-reflection* true
*print-length* 32
*print-level* 4}
:source-paths ~(-> source-paths :dev :clj)
:test-paths ["test/clj"]
:dependencies ~(concat invariance-deps
workflow-deps)
:repl-options {:init-ns carpet.server
;; Causes lein repl to automagically mix the
;; Piggieback nREPL middleware concat its
;; default stack.
:nrepl-middleware
[cemerick.piggieback/wrap-cljs-repl]}
:env {:is-dev true
:log-file-name "log/server.log"
;; used in generating the tokens
:secret "mysupersecret"
;; used by the hot loader (figwheel)
:hot-loading {:css-dirs ~css-dirs
:source-paths
~(concat (-> source-paths :app :cljs)
(-> source-paths :dev :cljs))
:cljsbuild-compiler-config
~cljsbuild-compiler-config}}}
:uberjar {:source-paths ["env/prod/clj"]
:hooks [leiningen.cljsbuild]
:env {:production true}
:omit-source true
:aot :all
:cljsbuild {:builds {:app
{:source-paths ["env/prod/cljs"]
:compiler {:optimizations :advanced
:pretty-print false}}}}}}
;; newer stuff may need this repository.
:repositories {"sonatype-oss-public"
"https://oss.sonatype.org/content/groups/public/"})