Added comments on kvs tests.

Added comments on kvs tests.

--- src/cbfg/test/kvs.cljs
+++ src/cbfg/test/kvs.cljs
@@ -17,416 +17,431 @@
   (act tkvs actx
        (let [n (atom 0)
              cmd-ch (make-kvs-mgr tkvs)]
-         (if (and (let [res-ch (achan tkvs)
-                        m {:opaque @n
-                           :res-ch res-ch
-                           :op :kvs-remove}]
-                    (aput tkvs cmd-ch m)
-                    (e n
-                       (atake tkvs res-ch)
-                       (merge m {:status :invalid
-                                 :status-info :missing-kvs-ident-arg})
-                       (atake tkvs res-ch)))
-                  (let [res-ch (achan tkvs)
-                        m {:opaque @n
-                           :res-ch res-ch
-                           :op :kvs-list}]
-                    (aput tkvs cmd-ch m)
-                    (e n
-                       (atake tkvs res-ch)
-                       (merge m {:status :ok})
-                       (atake tkvs res-ch)))
-                  (let [res-ch (achan tkvs)
-                        m {:opaque @n
-                           :res-ch res-ch
-                           :op :kvs-remove
-                           :kvs-ident [:bogus :ident]}]
-                    (aput tkvs cmd-ch m)
-                    (e n
-                       (atake tkvs res-ch)
-                       (merge m {:status :not-found
-                                 :status-info [:no-kvs (:kvs-ident m)]})
-                       (atake tkvs res-ch)))
-                  (let [res-ch (achan tkvs)
-                        m {:opaque @n
-                           :res-ch res-ch
-                           :op :kvs-open
-                           :name :foo}]
-                    (aput tkvs cmd-ch m)
-                    (let [res (atake tkvs res-ch)]
-                      (and (e n res
-                              (merge m {:status :ok
-                                        :status-info :created
-                                        :kvs-ident (:kvs-ident res)})
-                              (atake tkvs res-ch))
-                           (let [res-ch (achan tkvs)
-                                 m {:opaque @n
-                                    :res-ch res-ch
-                                    :op :kvs-list}]
-                             (aput tkvs cmd-ch m)
-                             (and (e n
-                                     (atake tkvs res-ch)
-                                     (merge m {:partial :ok :name :foo})
+         (if (and
+              (let [res-ch (achan tkvs) ; Test missing kvs-ident parameter.
+                    m {:opaque @n
+                       :res-ch res-ch
+                       :op :kvs-remove}]
+                (aput tkvs cmd-ch m)
+                (e n
+                   (atake tkvs res-ch)
+                   (merge m {:status :invalid
+                             :status-info :missing-kvs-ident-arg})
+                   (atake tkvs res-ch)))
+              (let [res-ch (achan tkvs) ; Test kvs-list lists nothing.
+                    m {:opaque @n
+                       :res-ch res-ch
+                       :op :kvs-list}]
+                (aput tkvs cmd-ch m)
+                (e n
+                   (atake tkvs res-ch)
+                   (merge m {:status :ok})
+                   (atake tkvs res-ch)))
+              (let [res-ch (achan tkvs) ; Test not-found kvs-ident.
+                    m {:opaque @n
+                       :res-ch res-ch
+                       :op :kvs-remove
+                       :kvs-ident [:bogus :ident]}]
+                (aput tkvs cmd-ch m)
+                (e n
+                   (atake tkvs res-ch)
+                   (merge m {:status :not-found
+                             :status-info [:no-kvs (:kvs-ident m)]})
+                   (atake tkvs res-ch)))
+              (let [res-ch (achan tkvs) ; Test create of kvs.
+                    m {:opaque @n
+                       :res-ch res-ch
+                       :op :kvs-open
+                       :name :foo}]
+                (aput tkvs cmd-ch m)
+                (let [res (atake tkvs res-ch)]
+                  (and
+                   (e n res
+                      (merge m {:status :ok
+                                :status-info :created
+                                :kvs-ident (:kvs-ident res)})
+                      (atake tkvs res-ch))
+                   (let [res-ch (achan tkvs) ; Test kvs-lists lists :foo.
+                         m {:opaque @n
+                            :res-ch res-ch
+                            :op :kvs-list}]
+                     (aput tkvs cmd-ch m)
+                     (and (e n
+                             (atake tkvs res-ch)
+                             (merge m {:partial :ok :name :foo})
+                             nil)
+                          (e n
+                             (atake tkvs res-ch)
+                             (merge m {:status :ok})
+                             (atake tkvs res-ch))))
+                   (let [res-ch2 (achan tkvs) ; Test reopen of kvs.
+                         m2 {:opaque @n
+                             :res-ch res-ch2
+                             :op :kvs-open
+                             :name :foo}]
+                     (aput tkvs cmd-ch m2)
+                     (let [res2 (atake tkvs res-ch2)]
+                       (e n res2
+                          (merge m2 {:status :ok
+                                     :status-info :reopened
+                                     :kvs-ident (:kvs-ident res)})
+                          (atake tkvs res-ch2))))
+                   (let [res-ch (achan tkvs) ; Test bogus kvs is still not-found.
+                         m {:opaque @n
+                            :res-ch res-ch
+                            :op :kvs-remove
+                            :kvs-ident [:bogus :ident]}]
+                     (aput tkvs cmd-ch m)
+                     (e n
+                        (atake tkvs res-ch)
+                        (merge m {:status :not-found
+                                  :status-info [:no-kvs (:kvs-ident m)]})
+                        (atake tkvs res-ch)))
+                   (let [res-ch3 (achan tkvs) ; Test remove of kvs.
+                         m3 {:opaque @n
+                             :res-ch res-ch3
+                             :op :kvs-remove
+                             :kvs-ident (:kvs-ident res)}]
+                     (aput tkvs cmd-ch m3)
+                     (let [res3 (atake tkvs res-ch3)]
+                       (e n res3
+                          (merge m3 {:status :ok
+                                     :status-info :removed})
+                                  (atake tkvs res-ch3))))
+                   (let [res-ch4 (achan tkvs) ; Test re-remove of kvs fails.
+                         m4 {:opaque @n
+                             :res-ch res-ch4
+                             :op :kvs-remove
+                             :kvs-ident (:kvs-ident res)}]
+                     (aput tkvs cmd-ch m4)
+                     (let [res4 (atake tkvs res-ch4)]
+                       (e n res4
+                          (merge m4 {:status :not-found
+                                     :status-info [:no-kvs (:kvs-ident res)]})
+                          (atake tkvs res-ch4))))
+                   (let [res-ch5 (achan tkvs) ; Test multi-get on non-existent kvs.
+                         m5 {:opaque @n
+                             :res-ch res-ch5
+                             :op :multi-get
+                             :kvs-ident (:kvs-ident res)}]
+                     (aput tkvs cmd-ch m5)
+                     (let [res5 (atake tkvs res-ch5)]
+                       (e n res5
+                          (merge m5 {:status :not-found
+                                     :status-info [:no-kvs (:kvs-ident res)]})
+                          (atake tkvs res-ch5))))
+                   (let [res-ch (achan tkvs) ; Test list names is still empty.
+                         m {:opaque @n
+                            :res-ch res-ch
+                            :op :kvs-list}]
+                     (aput tkvs cmd-ch m)
+                     (e n
+                        (atake tkvs res-ch)
+                        (merge m {:status :ok})
+                        (atake tkvs res-ch)))
+                   )))
+              (let [open-ch (achan tkvs) ; Create a new kvs0.
+                    m {:opaque @n
+                       :res-ch open-ch
+                       :op :kvs-open
+                       :name :kvs0}]
+                (aput tkvs cmd-ch m)
+                (let [open (atake tkvs open-ch)]
+                  (and
+                   (e n open
+                      (merge m {:status :ok
+                                :status-info :created
+                                :kvs-ident (:kvs-ident open)})
+                      (atake tkvs open-ch))
+                   (let [res-ch2 (achan tkvs) ; Test multi-get with empty keys.
+                         m2 {:opaque @n
+                             :res-ch res-ch2
+                             :op :multi-get
+                             :kvs-ident (:kvs-ident open)
+                             :keys []}]
+                     (aput tkvs cmd-ch m2)
+                     (let [res2 (atake tkvs res-ch2)]
+                       (e n res2
+                          (dissoc (merge m2 {:status :ok})
+                                  :keys)
+                          (atake tkvs res-ch2))))
+                   (let [res-ch3 (achan tkvs) ; Test multi-change with empty changes.
+                         m3 {:opaque @n
+                             :res-ch res-ch3
+                             :op :multi-change
+                             :kvs-ident (:kvs-ident open)
+                             :changes []}]
+                     (aput tkvs cmd-ch m3)
+                     (let [res3 (atake tkvs res-ch3)]
+                       (e n res3
+                          (dissoc (merge m3 {:status :ok})
+                                  :changes)
+                          (atake tkvs res-ch3))))
+                   (let [res-ch4 (achan tkvs) ; Test multi-change with noop-change.
+                         m4 {:opaque @n
+                             :res-ch res-ch4
+                             :op :multi-change
+                             :kvs-ident (:kvs-ident open)
+                             :changes [noop-change]}]
+                     (aput tkvs cmd-ch m4)
+                     (and
+                      (e n (atake tkvs res-ch4)
+                         (dissoc (merge m4 {:partial :ok})
+                                 :changes)
+                         nil)
+                      (e n (atake tkvs res-ch4)
+                         (dissoc (merge m4 {:status :ok})
+                                 :changes)
+                         (atake tkvs res-ch4))))
+                   (let [res-ch5 (achan tkvs) ; Test several noop-changes.
+                         m5 {:opaque @n
+                             :res-ch res-ch5
+                             :op :multi-change
+                             :kvs-ident (:kvs-ident open)
+                             :changes [noop-change noop-change noop-change]}]
+                     (aput tkvs cmd-ch m5)
+                     (and
+                      (e n (atake tkvs res-ch5)
+                         (dissoc (merge m5 {:partial :ok})
+                                 :changes)
+                         nil)
+                      (e n (atake tkvs res-ch5)
+                         (dissoc (merge m5 {:partial :ok})
+                                 :changes)
+                         nil)
+                      (e n (atake tkvs res-ch5)
+                         (dissoc (merge m5 {:partial :ok})
+                                 :changes)
+                         nil)
+                      (e n (atake tkvs res-ch5)
+                         (dissoc (merge m5 {:status :ok})
+                                 :changes)
+                         (atake tkvs res-ch5))))
+                   (let [res-ch6 (achan tkvs) ; Test simple entry insert.
+                         m6 {:opaque @n
+                             :res-ch res-ch6
+                             :op :multi-change
+                             :kvs-ident (:kvs-ident open)
+                             :changes [(cbfg.kvs/mutate-entry
+                                        {:key :a :val :A})]}]
+                     (aput tkvs cmd-ch m6)
+                     (let [res6 (atake tkvs res-ch6)]
+                       (and
+                        (:sq res6)
+                        (e n res6
+                           (dissoc (merge m6 {:partial :ok :key :a
+                                              :sq (:sq res6)})
+                                   :changes)
+                           nil)
+                        (e n (atake tkvs res-ch6)
+                           (dissoc (merge m6 {:status :ok})
+                                   :changes)
+                           (atake tkvs res-ch6))
+                        (let [res-ch7 (achan tkvs) ; Test multi-get returns 1 entry.
+                              m7 {:opaque @n
+                                  :res-ch res-ch7
+                                  :op :multi-get
+                                  :kvs-ident (:kvs-ident open)
+                                  :keys [:a]}]
+                          (aput tkvs cmd-ch m7)
+                          (let [res7 (atake tkvs res-ch7)]
+                            (and
+                             (e n res7
+                                (dissoc (merge m7 {:partial :ok
+                                                   :key :a
+                                                   :entry {:key :a :val :A
+                                                           :sq (:sq res6)}})
+                                        :keys)
+                                nil)
+                             (e n (atake tkvs res-ch7)
+                                (dissoc (merge m7 {:status :ok})
+                                        :keys)
+                                (atake tkvs res-ch7)))))
+                        (let [res-ch7 (achan tkvs) ; Test multi-get of several entries.
+                              m7 {:opaque @n
+                                  :res-ch res-ch7
+                                  :op :multi-get
+                                  :kvs-ident (:kvs-ident open)
+                                  :keys [:a :a :a]}]
+                          (aput tkvs cmd-ch m7)
+                          (and
+                           (e n (atake tkvs res-ch7)
+                              (dissoc (merge m7 {:partial :ok
+                                                 :key :a
+                                                 :entry {:key :a :val :A
+                                                         :sq (:sq res6)}})
+                                      :keys)
+                              nil)
+                           (e n (atake tkvs res-ch7)
+                              (dissoc (merge m7 {:partial :ok
+                                                 :key :a
+                                                 :entry {:key :a :val :A
+                                                         :sq (:sq res6)}})
+                                      :keys)
+                              nil)
+                           (e n (atake tkvs res-ch7)
+                              (dissoc (merge m7 {:partial :ok
+                                                 :key :a
+                                                 :entry {:key :a :val :A
+                                                         :sq (:sq res6)}})
+                                      :keys)
+                              nil)
+                           (e n (atake tkvs res-ch7)
+                              (dissoc (merge m7 {:status :ok})
+                                      :keys)
+                              (atake tkvs res-ch7))))
+                        (let [res-ch7bs (achan tkvs) ; Test change with bad sq.
+                              m7bs {:opaque @n
+                                    :res-ch res-ch7bs
+                                    :op :multi-change
+                                    :kvs-ident (:kvs-ident open)
+                                    :changes [(cbfg.kvs/mutate-entry
+                                               {:key :a
+                                                :val :will-be-rejected
+                                                :sq :some-wrong-sq})]}]
+                          (aput tkvs cmd-ch m7bs)
+                          (let [res7bs (atake tkvs res-ch7bs)]
+                            (and
+                             (e n res7bs
+                                (dissoc (merge m7bs
+                                               {:partial :mismatch
+                                                :partial-info [:wrong-sq
+                                                               :some-wrong-sq]
+                                                :key :a})
+                                        :changes)
+                                nil)
+                             (e n (atake tkvs res-ch7bs)
+                                (dissoc (merge m7bs {:status :ok})
+                                        :changes)
+                                (atake tkvs res-ch7bs)))))
+                        (let [res-ch7c (achan tkvs) ; Test change with right sq.
+                              m7c {:opaque @n
+                                   :res-ch res-ch7c
+                                   :op :multi-change
+                                   :kvs-ident (:kvs-ident open)
+                                   :changes [(cbfg.kvs/mutate-entry
+                                              {:key :a
+                                               :val :AA
+                                               :sq (:sq res6)})]}]
+                          (aput tkvs cmd-ch m7c)
+                          (let [res7c (atake tkvs res-ch7c)]
+                            (and
+                             (:sq res7c)
+                             (e n res7c
+                                (dissoc (merge m7c
+                                               {:partial :ok
+                                                :key :a
+                                                :sq (:sq res7c)})
+                                        :changes)
+                                nil)
+                             (e n (atake tkvs res-ch7c)
+                                (dissoc (merge m7c {:status :ok})
+                                        :changes)
+                                (atake tkvs res-ch7c))
+                             (let [res-ch7g (achan tkvs) ; Test change had effect.
+                                   m7g {:opaque @n
+                                        :res-ch res-ch7g
+                                        :op :multi-get
+                                        :kvs-ident (:kvs-ident open)
+                                        :keys [:a]}]
+                               (aput tkvs cmd-ch m7g)
+                               (let [res7g (atake tkvs res-ch7g)]
+                                 (and
+                                  (e n res7g
+                                     (dissoc (merge m7g {:partial :ok
+                                                         :key :a
+                                                         :entry {:key :a :val :AA
+                                                                 :sq (:sq res7c)}})
+                                             :keys)
                                      nil)
-                                  (e n
-                                     (atake tkvs res-ch)
-                                     (merge m {:status :ok})
-                                     (atake tkvs res-ch))))
-                           (let [res-ch2 (achan tkvs)
-                                 m2 {:opaque @n
-                                     :res-ch res-ch2
-                                     :op :kvs-open
-                                     :name :foo}]
-                             (aput tkvs cmd-ch m2)
-                             (let [res2 (atake tkvs res-ch2)]
-                               (e n res2
-                                  (merge m2 {:status :ok
-                                             :status-info :reopened
-                                             :kvs-ident (:kvs-ident res)})
-                                  (atake tkvs res-ch2))))
-                           (let [res-ch3 (achan tkvs)
-                                 m3 {:opaque @n
-                                     :res-ch res-ch3
-                                     :op :kvs-remove
-                                     :kvs-ident (:kvs-ident res)}]
-                             (aput tkvs cmd-ch m3)
-                             (let [res3 (atake tkvs res-ch3)]
-                               (e n res3
-                                  (merge m3 {:status :ok
-                                             :status-info :removed})
-                                  (atake tkvs res-ch3))))
-                           (let [res-ch4 (achan tkvs)
-                                 m4 {:opaque @n
-                                     :res-ch res-ch4
-                                     :op :kvs-remove
-                                     :kvs-ident (:kvs-ident res)}]
-                             (aput tkvs cmd-ch m4)
-                             (let [res4 (atake tkvs res-ch4)]
-                               (e n res4
-                                  (merge m4 {:status :not-found
-                                             :status-info [:no-kvs (:kvs-ident res)]})
-                                  (atake tkvs res-ch4))))
-                           (let [res-ch5 (achan tkvs)
-                                 m5 {:opaque @n
-                                     :res-ch res-ch5
-                                     :op :multi-get
-                                     :kvs-ident (:kvs-ident res)}]
-                             (aput tkvs cmd-ch m5)
-                             (let [res5 (atake tkvs res-ch5)]
-                               (e n res5
-                                  (merge m5 {:status :not-found
-                                             :status-info [:no-kvs (:kvs-ident res)]})
-                                  (atake tkvs res-ch5))))
-                           (let [res-ch (achan tkvs)
-                                 m {:opaque @n
-                                    :res-ch res-ch
-                                    :op :kvs-list}]
-                             (aput tkvs cmd-ch m)
-                             (e n
-                                (atake tkvs res-ch)
-                                (merge m {:status :ok})
-                                (atake tkvs res-ch)))
-                           )))
-                  (let [open-ch (achan tkvs)
-                        m {:opaque @n
-                           :res-ch open-ch
-                           :op :kvs-open
-                           :name :kvs0}]
-                    (aput tkvs cmd-ch m)
-                    (let [open (atake tkvs open-ch)]
-                      (and (e n open
-                              (merge m {:status :ok
-                                        :status-info :created
-                                        :kvs-ident (:kvs-ident open)})
-                              (atake tkvs open-ch))
-                           (let [res-ch2 (achan tkvs)
-                                 m2 {:opaque @n
-                                     :res-ch res-ch2
-                                     :op :multi-get
-                                     :kvs-ident (:kvs-ident open)
-                                     :keys []}]
-                             (aput tkvs cmd-ch m2)
-                             (let [res2 (atake tkvs res-ch2)]
-                               (e n res2
-                                  (dissoc (merge m2 {:status :ok})
-                                          :keys)
-                                  (atake tkvs res-ch2))))
-                           (let [res-ch3 (achan tkvs)
-                                 m3 {:opaque @n
-                                     :res-ch res-ch3
-                                     :op :multi-change
-                                     :kvs-ident (:kvs-ident open)
-                                     :changes []}]
-                             (aput tkvs cmd-ch m3)
-                             (let [res3 (atake tkvs res-ch3)]
-                               (e n res3
-                                  (dissoc (merge m3 {:status :ok})
-                                          :changes)
-                                  (atake tkvs res-ch3))))
-                           (let [res-ch4 (achan tkvs)
-                                 m4 {:opaque @n
-                                     :res-ch res-ch4
-                                     :op :multi-change
-                                     :kvs-ident (:kvs-ident open)
-                                     :changes [noop-change]}]
-                             (aput tkvs cmd-ch m4)
-                             (and
-                              (e n (atake tkvs res-ch4)
-                                 (dissoc (merge m4 {:partial :ok})
-                                         :changes)
-                                 nil)
-                              (e n (atake tkvs res-ch4)
-                                 (dissoc (merge m4 {:status :ok})
-                                         :changes)
-                                 (atake tkvs res-ch4))))
-                           (let [res-ch5 (achan tkvs)
-                                 m5 {:opaque @n
-                                     :res-ch res-ch5
-                                     :op :multi-change
-                                     :kvs-ident (:kvs-ident open)
-                                     :changes [noop-change noop-change noop-change]}]
-                             (aput tkvs cmd-ch m5)
-                             (and
-                              (e n (atake tkvs res-ch5)
-                                 (dissoc (merge m5 {:partial :ok})
-                                         :changes)
-                                 nil)
-                              (e n (atake tkvs res-ch5)
-                                 (dissoc (merge m5 {:partial :ok})
-                                         :changes)
-                                 nil)
-                              (e n (atake tkvs res-ch5)
-                                 (dissoc (merge m5 {:partial :ok})
-                                         :changes)
-                                 nil)
-                              (e n (atake tkvs res-ch5)
-                                 (dissoc (merge m5 {:status :ok})
-                                         :changes)
-                                 (atake tkvs res-ch5))))
-                           (let [res-ch6 (achan tkvs)
-                                 m6 {:opaque @n
-                                     :res-ch res-ch6
-                                     :op :multi-change
-                                     :kvs-ident (:kvs-ident open)
-                                     :changes [(cbfg.kvs/mutate-entry
-                                                {:key :a :val :A})]}]
-                             (aput tkvs cmd-ch m6)
-                             (let [res6 (atake tkvs res-ch6)]
-                               (and (:sq res6)
-                                    (e n res6
-                                       (dissoc (merge m6 {:partial :ok :key :a
-                                                          :sq (:sq res6)})
-                                               :changes)
-                                       nil)
-                                    (e n (atake tkvs res-ch6)
-                                       (dissoc (merge m6 {:status :ok})
-                                               :changes)
-                                       (atake tkvs res-ch6))
-                                    (let [res-ch7 (achan tkvs)
-                                          m7 {:opaque @n
-                                              :res-ch res-ch7
-                                              :op :multi-get
-                                              :kvs-ident (:kvs-ident open)
-                                              :keys [:a]}]
-                                      (aput tkvs cmd-ch m7)
-                                      (let [res7 (atake tkvs res-ch7)]
-                                        (and
-                                         (e n res7
-                                            (dissoc (merge m7 {:partial :ok
-                                                               :key :a
-                                                               :entry {:key :a :val :A
-                                                                       :sq (:sq res6)}})
-                                                    :keys)
-                                            nil)
-                                         (e n (atake tkvs res-ch7)
-                                            (dissoc (merge m7 {:status :ok})
-                                                    :keys)
-                                            (atake tkvs res-ch7)))))
-                                    (let [res-ch7 (achan tkvs)
-                                          m7 {:opaque @n
-                                              :res-ch res-ch7
-                                              :op :multi-get
-                                              :kvs-ident (:kvs-ident open)
-                                              :keys [:a :a :a]}]
-                                      (aput tkvs cmd-ch m7)
-                                      (and
-                                       (e n (atake tkvs res-ch7)
-                                          (dissoc (merge m7 {:partial :ok
-                                                             :key :a
-                                                             :entry {:key :a :val :A
-                                                                     :sq (:sq res6)}})
-                                                  :keys)
-                                          nil)
-                                       (e n (atake tkvs res-ch7)
-                                          (dissoc (merge m7 {:partial :ok
-                                                             :key :a
-                                                             :entry {:key :a :val :A
-                                                                     :sq (:sq res6)}})
-                                                  :keys)
-                                          nil)
-                                       (e n (atake tkvs res-ch7)
-                                          (dissoc (merge m7 {:partial :ok
-                                                             :key :a
-                                                             :entry {:key :a :val :A
-                                                                     :sq (:sq res6)}})
-                                                  :keys)
-                                          nil)
-                                       (e n (atake tkvs res-ch7)
-                                          (dissoc (merge m7 {:status :ok})
-                                                  :keys)
-                                          (atake tkvs res-ch7))))
-                                    (let [res-ch7bs (achan tkvs)
-                                          m7bs {:opaque @n
-                                                :res-ch res-ch7bs
-                                                :op :multi-change
-                                                :kvs-ident (:kvs-ident open)
-                                                :changes [(cbfg.kvs/mutate-entry
-                                                           {:key :a
-                                                            :val :will-be-rejected
-                                                            :sq :some-wrong-sq})]}]
-                                      (aput tkvs cmd-ch m7bs)
-                                      (let [res7bs (atake tkvs res-ch7bs)]
-                                        (and
-                                         (e n res7bs
-                                            (dissoc (merge m7bs
-                                                           {:partial :mismatch
-                                                            :partial-info [:wrong-sq
-                                                                           :some-wrong-sq]
-                                                            :key :a})
-                                                    :changes)
-                                            nil)
-                                         (e n (atake tkvs res-ch7bs)
-                                            (dissoc (merge m7bs {:status :ok})
-                                                    :changes)
-                                            (atake tkvs res-ch7bs)))))
-                                    (let [res-ch7c (achan tkvs)
-                                          m7c {:opaque @n
-                                               :res-ch res-ch7c
-                                               :op :multi-change
-                                               :kvs-ident (:kvs-ident open)
-                                               :changes [(cbfg.kvs/mutate-entry
-                                                          {:key :a
-                                                           :val :AA
-                                                           :sq (:sq res6)})]}]
-                                      (aput tkvs cmd-ch m7c)
-                                      (let [res7c (atake tkvs res-ch7c)]
-                                        (and
-                                         (:sq res7c)
-                                         (e n res7c
-                                            (dissoc (merge m7c
-                                                           {:partial :ok
-                                                            :key :a
-                                                            :sq (:sq res7c)})
-                                                    :changes)
-                                            nil)
-                                         (e n (atake tkvs res-ch7c)
-                                            (dissoc (merge m7c {:status :ok})
-                                                    :changes)
-                                            (atake tkvs res-ch7c))
-                                         (let [res-ch7g (achan tkvs)
-                                               m7g {:opaque @n
-                                                    :res-ch res-ch7g
-                                                    :op :multi-get
-                                                    :kvs-ident (:kvs-ident open)
-                                                    :keys [:a]}]
-                                           (aput tkvs cmd-ch m7g)
-                                           (let [res7g (atake tkvs res-ch7g)]
-                                             (and
-                                              (e n res7g
-                                                 (dissoc (merge m7g {:partial :ok
-                                                                     :key :a
-                                                                     :entry {:key :a :val :AA
-                                                                             :sq (:sq res7c)}})
-                                                         :keys)
-                                                 nil)
-                                              (e n (atake tkvs res-ch7g)
-                                                 (dissoc (merge m7g {:status :ok})
-                                                         :keys)
-                                                 (atake tkvs res-ch7g)))))
-                                         )))
-                                    )))
-                      (let [res-ch8 (achan tkvs)
-                            m8 {:opaque @n
-                                :res-ch res-ch8
-                                :op :multi-get
-                                :kvs-ident (:kvs-ident open)
-                                :keys [:does-not-exist :not-there]}]
-                        (aput tkvs cmd-ch m8)
-                        (and
-                         (e n (atake tkvs res-ch8)
-                            (dissoc (merge m8 {:partial :not-found
-                                               :key :does-not-exist})
-                                    :keys)
-                            nil)
-                         (e n (atake tkvs res-ch8)
-                            (dissoc (merge m8 {:partial :not-found
-                                               :key :not-there})
-                                    :keys)
-                            nil)
-                         (e n (atake tkvs res-ch8)
-                            (dissoc (merge m8 {:status :ok})
-                                    :keys)
-                            (atake tkvs res-ch8))))
-                      (let [res-ch9 (achan tkvs)
-                            m9 {:opaque @n
-                                :res-ch res-ch9
-                                :op :multi-change
-                                :kvs-ident (:kvs-ident open)
-                                :changes [(cbfg.kvs/mutate-entry {:key :a :deleted true
-                                                                  :sq :not-a-sq-match})]}]
-                        (aput tkvs cmd-ch m9)
-                        (let [res9 (atake tkvs res-ch9)]
-                          (and (e n res9
-                                  (dissoc (merge m9 {:partial :mismatch
-                                                     :partial-info [:wrong-sq
-                                                                    :not-a-sq-match]
-                                                     :key :a})
-                                          :changes)
-                                  nil)
-                               (e n (atake tkvs res-ch9)
-                                  (dissoc (merge m9 {:status :ok})
-                                          :changes)
-                                  (atake tkvs res-ch9)))))
-                      (let [res-ch9 (achan tkvs)
-                            m9 {:opaque @n
-                                :res-ch res-ch9
-                                :op :multi-change
-                                :kvs-ident (:kvs-ident open)
-                                :changes [(cbfg.kvs/mutate-entry {:key :a
-                                                                  :deleted true})]}]
-                        (aput tkvs cmd-ch m9)
-                        (let [res9 (atake tkvs res-ch9)]
-                          (and (:sq res9)
-                               (e n res9
-                                  (dissoc (merge m9 {:partial :ok :key :a
-                                                     :sq (:sq res9)})
-                                          :changes)
-                                  nil)
-                               (e n (atake tkvs res-ch9)
-                                  (dissoc (merge m9 {:status :ok})
-                                          :changes)
-                                  (atake tkvs res-ch9))
-                               (let [res-ch9a (achan tkvs)
-                                     m9a {:opaque @n
-                                          :res-ch res-ch9a
-                                          :op :multi-get
-                                          :kvs-ident (:kvs-ident open)
-                                          :keys [:a]}]
-                                 (aput tkvs cmd-ch m9a)
-                                 (let [res9a (atake tkvs res-ch9a)]
-                                   (and
-                                    (e n res9a
-                                       (dissoc (merge m9a {:partial :not-found
-                                                           :key :a})
-                                               :keys)
-                                       nil)
-                                    (e n (atake tkvs res-ch9a)
-                                       (dissoc (merge m9a {:status :ok})
-                                               :keys)
-                                       (atake tkvs res-ch9a))))))))
-                      ))))
-         "pass"
-         (str "FAIL: on test-lane #" @n)))))
+                                  (e n (atake tkvs res-ch7g)
+                                     (dissoc (merge m7g {:status :ok})
+                                             :keys)
+                                     (atake tkvs res-ch7g)))))
+                             )))
+                        )))
+                   (let [res-ch8 (achan tkvs) ; Test multi-get of missing keys.
+                         m8 {:opaque @n
+                             :res-ch res-ch8
+                             :op :multi-get
+                             :kvs-ident (:kvs-ident open)
+                             :keys [:does-not-exist :not-there]}]
+                     (aput tkvs cmd-ch m8)
+                     (and
+                      (e n (atake tkvs res-ch8)
+                         (dissoc (merge m8 {:partial :not-found
+                                            :key :does-not-exist})
+                                 :keys)
+                         nil)
+                      (e n (atake tkvs res-ch8)
+                         (dissoc (merge m8 {:partial :not-found
+                                            :key :not-there})
+                                 :keys)
+                         nil)
+                      (e n (atake tkvs res-ch8)
+                         (dissoc (merge m8 {:status :ok})
+                                 :keys)
+                         (atake tkvs res-ch8))))
+                   (let [res-ch9 (achan tkvs) ; Test delete with wrong sq.
+                         m9 {:opaque @n
+                             :res-ch res-ch9
+                             :op :multi-change
+                             :kvs-ident (:kvs-ident open)
+                             :changes [(cbfg.kvs/mutate-entry {:key :a :deleted true
+                                                               :sq :not-a-sq-match})]}]
+                     (aput tkvs cmd-ch m9)
+                     (let [res9 (atake tkvs res-ch9)]
+                       (and (e n res9
+                               (dissoc (merge m9 {:partial :mismatch
+                                                  :partial-info [:wrong-sq
+                                                                 :not-a-sq-match]
+                                                  :key :a})
+                                       :changes)
+                               nil)
+                            (e n (atake tkvs res-ch9)
+                               (dissoc (merge m9 {:status :ok})
+                                       :changes)
+                               (atake tkvs res-ch9)))))
+                   (let [res-ch9 (achan tkvs) ; Test delete with no sq.
+                         m9 {:opaque @n
+                             :res-ch res-ch9
+                             :op :multi-change
+                             :kvs-ident (:kvs-ident open)
+                             :changes [(cbfg.kvs/mutate-entry {:key :a
+                                                               :deleted true})]}]
+                     (aput tkvs cmd-ch m9)
+                     (let [res9 (atake tkvs res-ch9)]
+                       (and (:sq res9)
+                            (e n res9
+                               (dissoc (merge m9 {:partial :ok :key :a
+                                                  :sq (:sq res9)})
+                                       :changes)
+                               nil)
+                            (e n (atake tkvs res-ch9)
+                               (dissoc (merge m9 {:status :ok})
+                                       :changes)
+                               (atake tkvs res-ch9))
+                            (let [res-ch9a (achan tkvs) ; Test delete took effect.
+                                  m9a {:opaque @n
+                                       :res-ch res-ch9a
+                                       :op :multi-get
+                                       :kvs-ident (:kvs-ident open)
+                                       :keys [:a]}]
+                              (aput tkvs cmd-ch m9a)
+                              (let [res9a (atake tkvs res-ch9a)]
+                                (and
+                                 (e n res9a
+                                    (dissoc (merge m9a {:partial :not-found
+                                                        :key :a})
+                                            :keys)
+                                    nil)
+                                 (e n (atake tkvs res-ch9a)
+                                    (dissoc (merge m9a {:status :ok})
+                                            :keys)
+                                    (atake tkvs res-ch9a))))))))
+                   ))))
+           "pass"
+           (str "FAIL: on test-lane #" @n)))))

 (defn test [actx opaque]
   (act test actx


get db url from env

get db url from env

--- src/chat/server/db.clj
+++ src/chat/server/db.clj
@@ -1,10 +1,11 @@
 (ns chat.server.db
   (:require [datomic.api :as d]
+            [environ.core :refer [env]]
             [crypto.password.scrypt :as password]))

 (def ^:dynamic *uri*
   "URI for the datomic database"
-  "datomic:dev://localhost:4334/chat-dev")
+  (get env :db-url "datomic:dev://localhost:4334/chat-dev"))

 (def ^:dynamic *conn* nil)


(sorry testing git stuff)

(sorry testing git stuff)

--- src/helper.clj
+++ src/helper.clj
@@ -1,7 +1,7 @@
 (ns helper)

 ;;;
-;;; This file contains stuff which I think are great
+;;; This file contains great stuff
 ;;;

 (defmacro one-by-one


Remove option-printing

Remove option-printing

--- src/clj/reply/main.clj
+++ src/clj/reply/main.clj
@@ -97,7 +97,6 @@
 Available options: [:help :custom-init :skip-default-init :nrepl :attach :port :color]
 See -main for descriptions."
   [options]
-  (print "options: ") (prn options)
   (try
     (concurrency/set-signal-handler! "CONT" handle-resume)
     (with-redefs [clojure.core/print-sequential hacks.printing/print-sequential


Refactor

Refactor

--- src/cljs_xml/core.cljs
+++ src/cljs_xml/core.cljs
@@ -1,13 +1,28 @@
 (ns cljs-xml.core
-  ;(:require-macros [cljs.core.async.macros :refer [go]])
   (:require [cljs.core.async :as async :refer [put! chan]]
             [js.sax :as sax]
             [clojure.zip :as zip]
             [clojure.string :as str]))

-(def tag-idx 0)
-(def att-idx 1)
-(def val-idx 2)
+(defn- add-node-document [node document]
+  (let [keytag (keyword (.-name node))
+        att-map (js->clj (.-attributes node) :keywordize-keys true)
+        node-value [keytag att-map nil]]
+    (-> document
+        (zip/append-child (vector keytag att-map []))
+        zip/down
+        zip/rightmost
+        zip/down
+        zip/rightmost)))
+
+(defn- close-node-document [node document]
+  (-> document zip/up zip/up))
+
+(defn- add-text [text document]
+  (let [trimmed (str/trim text)]
+    (if (not (empty? trimmed))
+      (zip/append-child document trimmed)
+      document)))

 (defn xml->clj [source]
   (let [ret-chan (chan)
@@ -15,39 +30,22 @@
         document (atom (zip/vector-zip []))]
     ;; OPEN TAG
     (set! (.-onopentag parser)
-          (fn [node]
-            ;(println (str "Open >> " (.-name node)) )
-            (let [keytag (keyword (.-name node))
-                  att-map (js->clj (.-attributes node) :keywordize-keys true)
-                  node-value [keytag att-map nil]]
-              (swap! document
-                     #(-> %
-                          (zip/append-child (vector keytag att-map []))
-                          zip/down
-                          zip/rightmost
-                          zip/down
-                          zip/rightmost)))))
+          #(swap! document (partial add-node-document %)))

     ;; CLOSE TAG
     (set! (.-onclosetag parser)
-          (fn [node]
-            (swap! document #(-> % zip/up zip/up))))
+          #(swap! document (partial close-node-document %)))

     ;; GET TEXT
     (set! (.-ontext parser)
-          (fn [text]
-            (let [trimmed (str/trim text)]
-              (when (not (empty? trimmed))
-                (swap! document zip/append-child trimmed)))))
+          #(swap! document (partial add-text %)))

     ;; END PARSING
     (set! (.-onend parser)
-          (fn []
-            (put! ret-chan (first (zip/root @document)))))
+          #(put! ret-chan (first (zip/root @document))))

     (set! (.-onerror parser)
-          (fn [error]
-            (put! ret-chan {:error (str error)})))
+          #(put! ret-chan {:error (str error)}))

     (.write parser source)
     (.close parser)


Adds docstrings

Adds docstrings

--- src/expound/alpha.cljc
+++ src/expound/alpha.cljc
@@ -26,7 +26,7 @@
 (def section-size 25)
 (def indent-level 2)

-(def ^:dynamic *value-str-fn* ::not-set)
+(def ^:dynamic *value-str-fn* (fn [_ _ _ _] "NOT IMPLEMENTED"))

 #?(:cljs
    (defn format [fmt & args]
@@ -159,7 +159,6 @@
     ;;highlighted-line
     (no-trailing-whitespace (string/replace s line highlighted-line))))

-;; TODO - this is now part of the public API
 (defn value-in-context
   "Given a form and a path into that form, returns a string
    that helps the user understand where that path is located
@@ -532,16 +531,19 @@

 ;;;;;; public ;;;;;;

-(defn custom-printer [opts]
+(defn custom-printer
+  "Returns a printer, configured via opts"
+  [opts]
   (fn [explain-data]
     (print (printer-str opts explain-data))))

-;; TODO - write docstrings
-(defn printer [explain-data]
+(defn printer
+  "Prints explain-data in a human-readable format"
+  [explain-data]
   ((custom-printer {}) explain-data))

 (defn expound-str
-  "Given a spec and a value that fails to conform, returns a human-readable explanation as a string."
+  "Given a spec and a value, either returns success message or returns a human-readable explanation as a string."
   [spec form]
   ;; expound was initially released with support
   ;; for CLJS 1.9.542 which did not include
@@ -554,5 +556,7 @@
                           ::s/value form)
                    nil))))

-(defn expound [spec form]
+(defn expound
+  "Given a spec and a value, either prints a success message or prints a human-readable explanation as a string."
+  [spec form]
   (print (expound-str spec form)))


Add shaders.

Add shaders.

--- src/ezglib/render.cljs
+++ src/ezglib/render.cljs
@@ -2,24 +2,7 @@
   (:require [ezglib.asset :as asset]))

 ;The WebGl context
-(declare ^:private gl)
-
-(defn init!
-  "Initializes opengl. Returns gl context."
-  [canvas]
-  (def ^:private gl (if-let [glc (or (.getContext canvas "webgl") (.getContext canvas "experimental-webgl"))]
-    (do
-      (set! (.-viewportWidth glc) (.-width canvas))
-      (set! (.-viewportHeight glc) (.-height canvas))
-      (.enable glc (.-DEPTH_TEST glc))
-      (.clearColor glc 0.0 0.0 0.0 1.0)
-      (.enable glc (.-DEPTH_TEST glc))
-      (.depthFunc glc (.-LEQUAL glc))
-      glc)
-    (do
-      (.log js/console "Unable to load webgl context. Your browser may not support it.")
-      nil)))
-    gl)
+(declare gl)

 (defn clear!
   "Clears the gl context."
@@ -50,3 +33,76 @@
   (.deleteTexture gl tex))

 (asset/add-asset :texture load-texture free-texture)
+
+(defn- get-shader
+  [src frag-vert]
+  (let [shader (.createShader gl (case frag-vert :frag (.-FRAGMENT_SHADER gl) :vert (.-VERTEX_SHADER gl)))]
+    (.shaderSource gl shader src)
+    (.compileShader gl shader)
+    (if (not (.getShaderParameter gl shader (.-COMPILE_STATUS gl)))
+      (do
+        (.log js/console (str "An error occured while compiling the shader: " (.getShaderInfoLog gl shader)))
+        nil)
+      shader)))
+
+(defn load-shader
+  "Loads a texture from vertex and fragment shader."
+  [frag-src vert-src]
+  (let [frag (get-shader frag-src :frag)
+        vert (get-shader vert-src :vert)
+        prgrm (.createProgram gl)]
+    (.attachShader gl prgrm vert)
+    (.attachShader gl prgrm frag)
+    (.linkProgram gl prgrm)
+    (if (not (.getProgramParameter gl prgrm (.-LINK_STATUS gl)))
+      (do
+        (.log js/console "An error occured while linking the shader.")
+        nil)
+      prgrm)))
+
+(defn use-shader
+  "Bind a shader to gl context."
+  [shader-program]
+  (.useProgram gl shader-program))
+
+(defn shader-attr
+  "Gets a shader attribute location"
+  [shader attr]
+  (.getAttribLocation gl shader attr))
+
+(def ^:private default-frag-src
+  "void main(void) {
+    gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
+  }"
+  )
+
+(def ^:private default-vert-src
+  "attribute vec3 aVertexPosition;
+
+  uniform mat4 uMVMatrix;
+  uniform mat4 uPMatrix;
+
+  void main(void) {
+    gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);
+  }"
+  )
+
+(declare default-shader)
+
+(defn init!
+  "Initializes opengl. Returns gl context."
+  [canvas]
+  (def gl (if-let [glc (or (.getContext canvas "webgl") (.getContext canvas "experimental-webgl"))]
+    (do
+      (set! (.-viewportWidth glc) (.-width canvas))
+      (set! (.-viewportHeight glc) (.-height canvas))
+      (.enable glc (.-DEPTH_TEST glc))
+      (.clearColor glc 0.0 0.0 0.0 1.0)
+      (.enable glc (.-DEPTH_TEST glc))
+      (.depthFunc glc (.-LEQUAL glc))
+      (def default-shader (load-shader default-frag-src default-vert-src))
+      glc)
+    (do
+      (.log js/console "Unable to load webgl context. Your browser may not support it.")
+      nil)))
+    gl)


Parallel threads

Parallel threads

--- src/instagram/core.clj
+++ src/instagram/core.clj
@@ -4,8 +4,6 @@
            [clojure.set]))

 (def instagram-client-id "e964033fc4f7456092d43555a94fb972")
-
-(def query-params {:client_id instagram-client-id})

 (defn get-rel-url
   "get url for `follows` or `followed-by` relationship"
@@ -52,10 +50,11 @@

 (defn -main
   [user-id]
-  (let [follows (get-users-list user-id "follows")
-        followed-by (get-users-list user-id "followed-by")
-        follows-ids (get-id-set follows)
-        followed-by-ids (get-id-set followed-by)
+  (let [follows (future (get-users-list user-id "follows"))
+        followed-by (future (get-users-list user-id "followed-by"))
+        follows-ids (get-id-set @follows)
+        followed-by-ids (get-id-set @followed-by)
         difference (clojure.set/difference follows-ids followed-by-ids)]
     (println (clojure.string/join "\n"
-                (map (partial get-name-by-id follows) difference)))))
+                (map (partial get-name-by-id @follows) difference)))
+    (System/exit 0)))


use mentions in filter, including comments

--- iwaswhere-web/src/clj/iwaswhere_web/graph.clj
+++ iwaswhere-web/src/clj/iwaswhere_web/graph.clj
@@ -9,22 +9,27 @@
             [clojure.tools.logging :as log]))

 (defn entries-filter-fn
-  "Creates a filter function which ensures that all tags in the query are contained in
-  the filtered entry, and none of the not-tags."
+  "Creates a filter function which ensures that all tags and mentions in the query are
+  contained in the filtered entry or any of it's comments, and none of the not-tags."
   [q]
   (fn [entry]
-    (let [entry-tags (set (map s/lower-case (:tags entry)))
+    (let [q-tags (set (map s/lower-case (:tags q)))
+          q-not-tags (set (map s/lower-case (:not-tags q)))
+          q-mentions (set (map s/lower-case (:mentions q)))
+
+          entry-tags (set (map s/lower-case (:tags entry)))
           entry-comments-tags (apply set/union (map :tags (:comments entry)))
-          entries-and-comments-tags (set/union entry-tags entry-comments-tags)
-          q-tags (set (map s/lower-case (:tags q)))
+          tags (set (map s/lower-case (set/union entry-tags entry-comments-tags)))
+
           entry-mentions (set (map s/lower-case (:mentions entry)))
-          q-mentions (set (map s/lower-case (:mentions q)))
-          match? (or (and (empty? q-tags) (empty? q-mentions))
-                     (set/subset? #{"#new-entry"} entries-and-comments-tags)
-                     ; all tags are contained in entry or comment, and none of the not-tags
-                     (and (set/subset? q-tags entries-and-comments-tags)
-                          (empty? (set/intersection (:not-tags q) entries-and-comments-tags)))
-                     (seq (set/intersection q-mentions entry-mentions)))]
+          entry-comments-mentions (apply set/union (map :mentions (:comments entry)))
+          mentions (set (map s/lower-case (set/union entry-mentions entry-comments-mentions)))
+
+          match? (or (set/subset? #{"#new-entry"} tags)
+                     (and (set/subset? q-tags tags)
+                          (empty? (set/intersection q-not-tags tags))
+                          (or (empty? q-mentions)
+                              (seq (set/intersection q-mentions mentions)))))]
       match?)))

 (defn extract-sorted-entries


CMR-6235 removed other debug statements

CMR-6235 removed other debug statements

--- system-int-test/test/cmr/system_int_test/search/autocomplete_collection_facet_search_test.clj
+++ system-int-test/test/cmr/system_int_test/search/autocomplete_collection_facet_search_test.clj
@@ -27,12 +27,6 @@
 (use-fixtures :each (join-fixtures
                      [(ingest/reset-fixture)
                       autocomplete-fixture]))
-
-;;(deftest test-autocomplete-short
-;; (testing "the test"
-;;  (let [response (search/get-autocomplete-suggestions "q=b&type[]=platform")]
-;;    (println (json/parse-string (:body response) true))
-;;    (is (= 200 (:status response))))))

 (defn- query->json-response-body
   ([query]
@@ -144,14 +138,9 @@
      (is (= a b))))

   (testing "page_num should yield different 'first' results test"
-   (let [everything (response-body->entries (query->json-response-body "q=*&page_size=2"))
-         _ (println everything)
-
-          page-one-entry (as-> (query->json-response-body "q=b&page_size=2&page_num=1") response1
+   (let [page-one-entry (as-> (query->json-response-body "q=b&page_size=2&page_num=1") response1
                               (response-body->entries response1))

          page-two-entry (as-> (query->json-response-body "q=b&page_size=2&page_num=2") response2
-                              (response-body->entries response2))
-         _ (println page-one-entry)
-         _ (println page-two-entry)]
+                              (response-body->entries response2))]
      (is (not= page-one-entry page-two-entry)))))


Fix bug with zone-id VS zone-offset

Fix bug with zone-id VS zone-offset

--- src/java_time/data.clj
+++ src/java_time/data.clj
@@ -3,8 +3,9 @@
   (:require [clojure.core.protocols :as p]
             [clojure.datafy :as d])
   (:import (java.time YearMonth Month DayOfWeek Instant
-                      LocalTime LocalDateTime
-                      ZonedDateTime OffsetDateTime LocalDate ZoneOffset ZoneId)
+                      LocalTime LocalDate LocalDateTime
+                      ZonedDateTime OffsetDateTime
+                      ZoneOffset ZoneId)
            (java.time.format DateTimeFormatter)
            (java.time.temporal IsoFields JulianFields TemporalAccessor)))

@@ -19,6 +20,12 @@
   (cond-> x
           (string? x)
           (ZoneId/of)))
+
+(defn- zone-offset
+  ^ZoneId [x]
+  (cond-> x
+          (string? x)
+          (ZoneOffset/of)))

 (defn- julian-field
   [^TemporalAccessor o x]
@@ -31,6 +38,9 @@
 (defonce ^:private system-zone
   (delay (ZoneId/systemDefault)))

+(defonce ^:private system-offset
+  (delay (ZoneOffset/systemDefault)))
+
 (extend-protocol p/Datafiable

   Month
@@ -58,6 +68,9 @@

         {`p/nav (fn [_ k v]
                   (case k
+                    :instant (-> (.atEndOfMonth ym)
+                                 (.atStartOfDay)
+                                 (.toInstant (or (zone-offset v) @system-offset)))
                     :format (.format (dt-formatter (or v "yyyy-MM")) ym)
                     nil))})))

@@ -93,6 +106,8 @@
                     :iso-format (.format DateTimeFormatter/ISO_DATE ld)
                     :format     (.format (dt-formatter v) ld)
                     :julian     (julian-field ld v)
+                    :instant  (-> (.atStartOfDay ld)
+                                  (.toInstant (or (zone-offset v) @system-offset)))
                     :weekday    weekday
                     :year-month ym
                     nil))})))
@@ -111,7 +126,7 @@
                   (case k
                     :iso-format (.format DateTimeFormatter/ISO_LOCAL_DATE_TIME ldt)
                     :format     (.format (dt-formatter v) ldt)
-                    :instant    (.toInstant ldt ^ZoneOffset (or (zone-id v) @system-zone))
+                    :instant    (.toInstant ldt (or (zone-offset v) @system-offset))
                     :julian     (julian-field ldt v)
                     :local-time lt
                     :local-date d


CMR-2501: Addressed review comments.

CMR-2501: Addressed review comments.

--- search-app/src/cmr/search/services/acl_service.clj
+++ search-app/src/cmr/search/services/acl_service.clj
@@ -7,7 +7,8 @@
   (fn [context acls concept]
     (:concept-type concept)))

-(defmethod acls-match-concept? :default
+;; tags have no acls so we always assume it matches
+(defmethod acls-match-concept? :tag
   [context acls concept]
   true)


Cache is ruining things maybe

Cache is ruining things maybe

--- src/lazubot/master.clj
+++ src/lazubot/master.clj
@@ -21,7 +21,7 @@
         [request-in request-out] (repeatedly 2 #(chan (sliding-buffer 10)))]
     (register-socket! {:in request-in :out request-out :socket-type :req
                        :configurator (fn [socket] (.bind socket addr))})
-    (println (:out (sh "docker" "build" "-t lazubot-worker" "-" "<" "/lazubot/resources/public/WorkerDockerfile")))
+    (println (:out (sh "docker" "build" "--no-cache" "-t lazubot-worker" "-" "<" "/lazubot/resources/public/WorkerDockerfile")))
     (println (:out (sh "docker" "run" "-rm=true" "-t" "-i" "-name client" "-link master:linked-master"
         "lazubot-worker" "lein with-profile worker run")))
     (go


Fix import arity issue with 'r-commit relation.

We're no longer saving the list of parents here.

--- src/leiningen/voom.clj
+++ src/leiningen/voom.clj
@@ -1157,9 +1157,8 @@
 (defn add-commit-facts
   [pldb gitdir commit]
   (let [sha (:sha commit)]
-    (-> pldb
-        (pldb/db-fact r-commit sha (:ctime commit)
-                      (count (:parents commit)) (:parents commit))
+    (-> pldb (pldb/db-fact r-commit sha (:ctime commit)
+                           (count (:parents commit)))
         (->/for [parent (:parents commit)]
           (pldb/db-fact r-commit-parent sha parent))
         (->/for [[mode otype bsha path]


Update 'task-dir so checkouts plugin will find the box projects.

--- src/leiningen/voom.clj
+++ src/leiningen/voom.clj
@@ -97,7 +97,7 @@

 ;; === manage REPOS_HOME directory ===

-(def task-dir "/.voom")
+(def task-dir "/.voom-box")

 (def repos-home (or (System/getenv "REPOS_HOME")
                     (str (System/getProperty "user.home")


Abort on build-deps failure.

Abort on build-deps failure.

Previously, we'd print the error status to stdout and exit with a success exit
code.

--- src/leiningen/voom.clj
+++ src/leiningen/voom.clj
@@ -445,8 +445,9 @@
       (when-not (= :ok (try-once-resolve-voom-version project))
         (recur)))
     (catch clojure.lang.ExceptionInfo e
-      (println "Failed to resolve dependency:" (.getMessage e))
-      (pprint {:exception-data (ex-data e)}))))
+     (lmain/abort (with-out-str
+                   (println "Failed to resolve dependency:" (.getMessage e))
+                   (pprint {:exception-data (ex-data e)}))))))

 ;; === freshen ===


Allow use of dirty working copy in build-deps

This was necessary to build hiccup-bridge, apparently because of a checked-in
native dep in target.

--- src/leiningen/voom.clj
+++ src/leiningen/voom.clj
@@ -264,7 +264,11 @@
   [proot]
   (println "Calling recursive build-deps on:" proot)
   (print (:out (sh "lein" "voom" "build-deps" :dir proot)))
-  (let [install-cmd ["lein" "voom" "wrap" "install" :dir proot]
+  ;; BEWARE: Allowing dirty working copy here is ONLY OK because the
+  ;; working copy in question was just checked out and cleaned using
+  ;; 'safe-checkout in 'find-matching-projects above:
+  (let [install-cmd ["lein" "voom" "wrap" ":insanely-allow-dirty-working-copy"
+                     "install" :dir proot]
         _ (apply println "install-versioned-artifact:" install-cmd)
         rtn (apply sh install-cmd)]
     (when-not (zero? (:exit rtn))


cleanup; fix error caused by renaming

cleanup; fix error caused by renaming

--- test/babel/test/parse.cljc
+++ test/babel/test/parse.cljc
@@ -3,7 +3,7 @@
   (:refer-clojure :exclude [get-in])
   (:require [babel.francais.grammar :refer [small medium]]
             [babel.francais.lexicon :refer [lexicon]]
-            [babel.francais.morphology :refer [analyze fo replace-patterns]]
+            [babel.francais.morphology :refer [analyze fo]
             [babel.over :as over]
             [babel.parse :refer [parse tokenizer]]
             [clojure.string :as string]


Memory node store needs to report sizes.

--- src/merkle_db/node.clj
+++ src/merkle_db/node.clj
@@ -100,8 +100,9 @@
   (-store-node!
     [this links data]
     (let [links (link/collect-table links data)
-          id (digest/sha2-256 (pr-str [links data]))
-          node {:id id, :links links, :data data}]
+          content (pr-str [links data])
+          id (digest/sha2-256 content)
+          node {:id id, :size (count content), :links links, :data data}]
       (swap! memory assoc id node)
       node))


Workflow wip, mostly pseudocode

Workflow wip, mostly pseudocode

--- slackbot/src/org/teamweek/slackbot.clj
+++ slackbot/src/org/teamweek/slackbot.clj
@@ -140,11 +140,32 @@
     qas))

-(defjob NoOpJob [ctx]
-  (comment "Does nothing!"))
-
-(defjob QuestionnaireJob [ctx]
+(defn submit-answers [db-conn domain user answers]
+  ;; TODO insert into datomic db
+  (prn answers)
   )
+
+(defjob QuestionnaireJob [{:keys [domain db-conn]}]
+  (let [db (d/db db-conn)
+        token (:team/token (d/entity db [:team/domain domain]))
+        users (d/q '[:find ?user
+                     :in $ ?domain
+                     :where
+                     [?team :team/domain ?domain]
+                     [?team :team/members ?member]
+                     [?member :user/name ?user]]
+                   db domain)
+        questions (d/q '[:find ?question-text
+                         :in $ ?domain
+                         :where
+                         [?team :team/domain ?domain]
+                         [?team :team/questions ?question]
+                         [?question :question/text ?question-text]])
+        conn (connect token)]
+    ;; TODO in parallell, but the job is not finished before all has answered/timeout
+    (doseq [user users]
+      (let [answers (send-questionnaire conn user questions)]
+        (submit-answers db-conn domain user answers)))))

 (defn schedule-questionnaire-job [scheduler domain cron-string]
   (let [job (jobs/build


return 200s from images, so that we can show an error message in the image

--- src/pc/http/routes.clj
+++ src/pc/http/routes.clj
@@ -185,13 +185,13 @@
                :body (render/render-layers layers :invert-colors? (-> req :params :printer-friendly (= "false")))}))

           (auth/logged-in? req)
-          {:status 403
+          {:status 200
            :headers {"Content-Type" "image/svg+xml"
                      "Cache-Control" "no-cache; private"}
            :body (render/render-layers private-layers :invert-colors? (-> req :params :printer-friendly (= "false")))}

           :else
-          {:status 401
+          {:status 200
            :headers {"Content-Type" "image/svg+xml"
                      "Cache-Control" "no-cache; private"}
            :body (render/render-layers private-layers :invert-colors? (-> req :params :printer-friendly (= "false")))})))
@@ -230,7 +230,7 @@
                                                              :size-limit 800))}))

           (auth/logged-in? req)
-          {:status 403
+          {:status 200
            :headers {"Content-Type" "image/png"
                      "Cache-Control" "no-cache; private"}
            :body (convert/svg->png (render/render-layers private-layers
@@ -238,7 +238,7 @@
                                                          :size-limit 800))}

           :else
-          {:status 401
+          {:status 200
            :headers {"Content-Type" "image/png"
                      "Cache-Control" "no-cache; private"}
            :body (convert/svg->png (render/render-layers private-layers
@@ -273,14 +273,14 @@
                                      (render/svg-props layers))})

           (auth/logged-in? req)
-          {:status 403
+          {:status 200
            :headers {"Content-Type" "application/pdf"
                      "Cache-Control" "no-cache; private"}
            :body (convert/svg->pdf (render/render-layers private-layers :invert-colors? (-> req :params :printer-friendly (= "false")))
                                    (render/svg-props private-layers))}

           :else
-          {:status 401
+          {:status 200
            :headers {"Content-Type" "application/pdf"
                      "Cache-Control" "no-cache; private"}
            :body (convert/svg->pdf (render/render-layers private-layers :invert-colors? (-> req :params :printer-friendly (= "false")))


remove unnecessary twitter card meta tags #56

--- src/pronouns/pages.clj
+++ src/pronouns/pages.clj
@@ -121,6 +121,7 @@
 ;; <meta name="twitter:title" content="Small Island Developing States Photo Submission" />
 ;; <meta name="twitter:description" content="View the album on Flickr." />
 ;; <meta name="twitter:image" content="https://farm6.staticflickr.com/5510/14338202952_93595258ff_z.jpg" />
+;; not all of these are required!

 (defn format-pronoun-examples
   [pronoun-declensions]
@@ -133,11 +134,9 @@
        [:title title]
        [:meta {:name "viewport" :content "width=device-width"}]
        [:meta {:name "description" :content (u/strip-markup examples)}]
-       [:meta {:name "twitter:card" :content (u/strip-markup examples)}]
-       [:meta {:name "twitter:site" :content "@morganastra"}]
+       [:meta {:name "twitter:card" :content "summary"}]
        [:meta {:name "twitter:title" :content title}]
        [:meta {:name "twitter:description" :content (u/strip-markup examples)}]
-       [:meta {:name "twitter:image" :content "https://pronoun.is/purple-flag64.png"}]
        [:link {:rel "stylesheet" :href "/pronouns.css"}]]
       [:body
        (header-block title)


Fix typo in URL

Fix typo in URL

--- test/one/test/dispatch.clj
+++ test/one/test/dispatch.clj
@@ -4,7 +4,7 @@
   ClojureScript code which is being evaluated in the browser.

   If these tests do not run, the most likely reason is that you have not visited
-  the page http://localhost:8080/frash. Currently the client code for this page
+  the page http://localhost:8080/fresh. Currently the client code for this page
   does not get compiled until you visit the page."

   (:use [clojure.test]


rm random file

rm random file

--- test/schmetrics/gauges.clj
+++ test/schmetrics/gauges.clj
@@ -1,8 +0,0 @@
-(ns schmetrics.gauge-test
-  (:require [clojure.test :refer :all]
-            [schmetrics.gauge :as gauge]))
-
-
-(deftest gauge-test
-  (testing "gauge read"
-    (println (gauge/retrieve-gauge "foo"))))


(last pair) -> (second pair)

(last pair) -> (second pair)

`second` uses less resources and looks more appropriate for a fixed-size vector.

--- src/re_frame/subs.cljc
+++ src/re_frame/subs.cljc
@@ -176,7 +176,7 @@
                          ;; multiple sugar pairs
                          (let [pairs   (partition 2 input-args)
                                markers (map first pairs)
-                               vecs    (map last pairs)]
+                               vecs    (map second pairs)]
                            (when-not (and (every? #{:<-} markers) (every? vector? vecs))
                              (console :error err-header "expected pairs of :<- and vectors, got:" pairs))
                            (fn inp-fn


lower indent in sessions binding vectors

--- src/shale/sessions.clj
+++ src/shale/sessions.clj
@@ -84,17 +84,18 @@
 (defn session-ids []
   (with-car* (car/smembers session-set-key)))

-(defn modify-session [session-id {:keys [browser-name
-                                         node
-                                         reserved
-                                         tags
-                                         current-url]
-                                  :or {browser-name nil
-                                       node nil
-                                       reserved nil
-                                       tags nil
-                                       current-url nil}
-                                  :as modifications}]
+(defn modify-session
+  [session-id {:keys [browser-name
+                      node
+                      reserved
+                      tags
+                      current-url]
+               :or {browser-name nil
+                    node nil
+                    reserved nil
+                    tags nil
+                    current-url nil}
+               :as modifications}]
   (s/validate (s/maybe Node ) node)
   (info (format "Modifing session %s, %s" session-id (str modifications)))
   (if (some #{session-id} (session-ids))
@@ -122,20 +123,21 @@
         (car/return (view-model session-id))))
     nil))

-(defn create-session [{:keys [browser-name
-                              node
-                              tags
-                              extra-desired-capabilities
-                              reserve-after-create
-                              current-url]
-                       :or {browser-name "firefox"
-                            node nil
-                            reserved false
-                            tags []
-                            extra-desired-capabilities nil
-                            reserve-after-create nil
-                            current-url nil}
-                       :as requirements}]
+(defn create-session
+  [{:keys [browser-name
+           node
+           tags
+           extra-desired-capabilities
+           reserve-after-create
+           current-url]
+    :or {browser-name "firefox"
+         node nil
+         reserved false
+         tags []
+         extra-desired-capabilities nil
+         reserve-after-create nil
+         current-url nil}
+    :as requirements}]
   (s/validate (s/maybe Node ) node)
   (info (format "Creating a new session.\nRequirements: %s"
                 (str requirements)))
@@ -182,23 +184,24 @@
         (car/sadd session-set-key session-id)
         (car/return (modify-session session-id defaulted-reqs))))))

-(defn get-or-create-session [{:keys [browser-name
-                                     node
-                                     reserved
-                                     tags
-                                     extra-desired-capabilities
-                                     reserve-after-create
-                                     force-create
-                                     current-url]
-                              :or {browser-name "firefox"
-                                   node nil
-                                   reserved false
-                                   tags []
-                                   extra-desired-capabilities nil
-                                   reserve-after-create nil
-                                   force-create nil
-                                   current-url nil}
-                              :as requirements}]
+(defn get-or-create-session
+  [{:keys [browser-name
+           node
+           reserved
+           tags
+           extra-desired-capabilities
+           reserve-after-create
+           force-create
+           current-url]
+    :or {browser-name "firefox"
+         node nil
+         reserved false
+         tags []
+         extra-desired-capabilities nil
+         reserve-after-create nil
+         force-create nil
+         current-url nil}
+    :as requirements}]
   (s/validate (s/maybe Node ) node)
   (let [requirements (update-in requirements [:reserved] #(or % false))]


extra context in the exception

extra context in the exception

--- src/stencil/parser.clj
+++ src/stencil/parser.clj
@@ -310,6 +310,8 @@
                       :scanner tag-content-scanner}
                      (str "Attempt to close section out of order: "
                           tag-content
+                          " expected "
+                          (:name top-section)
                           " at "
                           (format-location tag-content-scanner)))
              ;; Going to close it by moving up the zipper tree, but first


Add common functions

Add common functions

--- src/storemi/common.clj
+++ src/storemi/common.clj
@@ -81,3 +81,20 @@

 (defn has-trailing [s]
   (= (peek (vec s)) \/))
+
+(defn unix-time []
+  (.getTime (java.util.Date.)))
+
+(defn throttle [f millis]
+  (let [expr (atom (future))]
+    (fn [& args]
+      (future-cancel @expr)
+      (reset!
+        expr
+        (future (Thread/sleep millis) (apply f args))))))
+
+
+
+
+
+


Allow setting root_block_device in the launch config

--- src/terraboot/core.clj
+++ src/terraboot/core.clj
@@ -174,6 +174,7 @@
                               (if ebs_block_device
                                 (assoc map :ebs_block_device ebs_block_device)
                                 map))
+        root_block_device (get spec :root_block_device {})
         asg-config
         (merge-in
          (resource "aws_iam_instance_profile" name
@@ -190,7 +191,10 @@
                                          :lifecycle { :create_before_destroy true }
                                          :key_name (get spec :key_name "ops-terraboot")
                                          :security_groups (map #(id-of "aws_security_group" %) sgs)
-                                         :associate_public_ip_address (or public_ip false)} )
+                                         :associate_public_ip_address (or public_ip false)
+                                         :root_block_device root_block_device}
+
+                                        )
                    )

          (resource "aws_autoscaling_group" name


added :doc entries for ns and def

added :doc entries for ns and def

--- src/clj/cljs/analyzer.clj
+++ src/clj/cljs/analyzer.clj
@@ -331,8 +331,10 @@
             (str "WARNING: " (symbol (str ns-name) (str sym))
                  " no longer fn, references are stale"))))
       (swap! namespaces assoc-in [ns-name :defs sym]
-                 (merge {:name name}
+                 (merge
+                   {:name name}
                    sym-meta
+                   (when doc {:doc doc})
                    (when dynamic {:dynamic true})
                    (when-let [line (:line env)]
                      {:file *cljs-file* :line line})
@@ -671,6 +673,7 @@
       (clojure.core/require nsym))
     (swap! namespaces #(-> %
                            (assoc-in [name :name] name)
+                           (assoc-in [name :doc] docstring)
                            (assoc-in [name :excludes] excludes)
                            (assoc-in [name :uses] uses)
                            (assoc-in [name :requires] requires)
@@ -680,7 +683,7 @@
                                                      [alias (find-ns nsym)])
                                                    requires-macros)))
                            (assoc-in [name :imports] imports)))
-    {:env env :op :ns :form form :name name :uses uses :requires requires :imports imports
+    {:env env :op :ns :form form :name name :doc docstring :uses uses :requires requires :imports imports
      :uses-macros uses-macros :requires-macros requires-macros :excludes excludes}))

 (defmethod parse 'deftype*


deprecate cljs.analyzer/forms-seq instead of removing to not break
existing usage.

add cljs.analyzer/forms-seq* which does the right thing and accepts a
_reader_. Prep work for CLJS-841 - now forms-seq* using code can close
the reader itself under error conditions.

--- src/clj/cljs/analyzer.clj
+++ src/clj/cljs/analyzer.clj
@@ -1947,10 +1947,34 @@
    (instance? File x) (.getAbsolutePath ^File x)
    :default (str x)))

+(defn forms-seq*
+  "Seq of Clojure/ClojureScript forms from rdr, a java.io.Reader. Optionally
+  accepts a filename argument which will be used in any emitted errors."
+  ([^Reader rdr] (forms-seq* rdr nil))
+  ([^Reader rdr filename]
+   (let [pbr (readers/indexing-push-back-reader
+               (PushbackReader. rdr) 1 filename)
+         data-readers tags/*cljs-data-readers*
+         forms-seq_
+         (fn forms-seq_ []
+           (lazy-seq
+             (let [eof-sentinel (Object.)
+                   form (binding [*ns* (create-ns *cljs-ns*)
+                                  reader/*data-readers* data-readers
+                                  reader/*alias-map*
+                                  (apply merge
+                                    ((juxt :requires :require-macros)
+                                      (get-namespace *cljs-ns*)))]
+                          (reader/read pbr nil eof-sentinel))]
+               (if (identical? form eof-sentinel)
+                 (.close rdr)
+                 (cons form (forms-seq_))))))]
+     (forms-seq_))))
+
 (defn forms-seq
-  "Seq of Clojure/ClojureScript forms from [f], which can be anything for which
-`clojure.java.io/reader` can produce a `java.io.Reader`. Optionally accepts a [filename]
-argument, which the reader will use in any emitted errors."
+  "DEPRECATED: Seq of Clojure/ClojureScript forms from [f], which can be anything
+  for which `clojure.java.io/reader` can produce a `java.io.Reader`. Optionally
+  accepts a [filename] argument, which the reader will use in any emitted errors."
   ([f] (forms-seq f (source-path f)))
   ([f filename] (forms-seq f filename false))
   ([f filename return-reader?]


fix rename-to-js regex

fix rename-to-js regex

--- src/clj/cljs/compiler.clj
+++ src/clj/cljs/compiler.clj
@@ -1602,7 +1602,7 @@
   "Change the file extension from .cljs to .js. Takes a File or a
   String. Always returns a String."
   [file-str]
-  (clojure.string/replace file-str #".cljs$" ".js"))
+  (clojure.string/replace file-str #"\.cljs$" ".js"))

 (defn mkdirs
   "Create all parent directories for the passed file."


Update comments

Update comments

--- src/clj/zetawar/data.cljs
+++ src/clj/zetawar/data.cljs
@@ -22,8 +22,7 @@
    :base          {:name "Base"
                    :image "tilesets/elite-command/terrains/base-COLOR.png"}})

-;; TODO: move transitions one level deeper under :transitions key
-;; TODO: add :description for state maps and states
+;; TODO: add :description for state maps and states (?)
 (def unit-state-maps
   {:move-attack
    {:start-state :start


Updated to support keystore / truststore in the context of a socks proxy.

--- src/clj_http/conn_mgr.clj
+++ src/clj_http/conn_mgr.clj
@@ -50,12 +50,13 @@
 (defn ^SSLConnectionSocketFactory SSLGenericSocketFactory
   "Given a function that returns a new socket, create an
   SSLConnectionSocketFactory that will use that socket."
-  [socket-factory]
-  (proxy [SSLConnectionSocketFactory] [(SSLContexts/createDefault)]
-    (connectSocket [timeout socket host remoteAddress localAddress context]
-      (let [^SSLConnectionSocketFactory this this] ;; avoid reflection
-        (proxy-super connectSocket timeout (socket-factory) host remoteAddress
-                     localAddress context)))))
+  ([socket-factory] (SSLGenericSocketFactory socket-factory (SSLContexts/createDefault)))
+  ([socket-factory ^SSLContext ssl-context]
+   (proxy [SSLConnectionSocketFactory] [ssl-context]
+     (connectSocket [timeout socket host remoteAddress localAddress context]
+       (let [^SSLConnectionSocketFactory this this] ;; avoid reflection
+         (proxy-super connectSocket timeout (socket-factory) host remoteAddress
+                      localAddress context))))))

 (defn ^PlainConnectionSocketFactory PlainGenericSocketFactory
   "Given a Function that returns a new socket, create a
@@ -69,41 +70,6 @@
   "Create a Socket proxied through socks, using the given hostname and port"
   [^String hostname ^Integer port]
   (Socket. (Proxy. Proxy$Type/SOCKS (InetSocketAddress. hostname port))))
-
-(defn make-socks-proxied-conn-manager
-  "Given an optional hostname and a port, create a connection manager that's
-  proxied using a SOCKS proxy."
-  [^String hostname ^Integer port]
-  (let [socket-factory #(socks-proxied-socket hostname port)
-        reg (-> (RegistryBuilder/create)
-                (.register "http" (PlainGenericSocketFactory socket-factory))
-                (.register "https" (SSLGenericSocketFactory socket-factory))
-                (.build))]
-    (PoolingHttpClientConnectionManager. reg)))
-
-(def insecure-scheme-registry
-  (-> (RegistryBuilder/create)
-      (.register "http" PlainConnectionSocketFactory/INSTANCE)
-      (.register "https" insecure-socket-factory)
-      (.build)))
-
-(def insecure-strategy-registry
-  (-> (RegistryBuilder/create)
-      (.register "http" NoopIOSessionStrategy/INSTANCE)
-      (.register "https" insecure-strategy)
-      (.build)))
-
-(def regular-scheme-registry
-  (-> (RegistryBuilder/create)
-      (.register "http" (PlainConnectionSocketFactory/getSocketFactory))
-      (.register "https" secure-ssl-socket-factory)
-      (.build)))
-
-(def regular-strategy-registry
-  (-> (RegistryBuilder/create)
-      (.register "http" NoopIOSessionStrategy/INSTANCE)
-      (.register "https" secure-strategy)
-      (.build)))

 (defn ^KeyStore get-keystore*
   [keystore-file keystore-type ^String keystore-pass]
@@ -138,6 +104,44 @@
      :verifier (if (opt req :insecure)
                  NoopHostnameVerifier/INSTANCE
                  (DefaultHostnameVerifier.))}))
+
+(defn make-socks-proxied-conn-manager
+  "Given an optional hostname and a port, create a connection manager that's
+  proxied using a SOCKS proxy."
+  ([^String hostname ^Integer port] (make-socks-proxied-conn-manager hostname port {}))
+  ([^String hostname ^Integer port {:keys [keystore keystore-type keystore-pass trust-store trust-store-type trust-store-pass] :as opts}]
+   (let [socket-factory #(socks-proxied-socket hostname port)
+         ssl-context (when (some (complement nil?) [keystore keystore-type keystore-pass trust-store trust-store-type trust-store-pass])
+                           (-> opts get-keystore-context-verifier :context))
+         reg (-> (RegistryBuilder/create)
+                 (.register "http" (PlainGenericSocketFactory socket-factory))
+                 (.register "https" (SSLGenericSocketFactory socket-factory ssl-context))
+                 (.build))]
+     (PoolingHttpClientConnectionManager. reg))))
+
+(def insecure-scheme-registry
+  (-> (RegistryBuilder/create)
+      (.register "http" PlainConnectionSocketFactory/INSTANCE)
+      (.register "https" insecure-socket-factory)
+      (.build)))
+
+(def insecure-strategy-registry
+  (-> (RegistryBuilder/create)
+      (.register "http" NoopIOSessionStrategy/INSTANCE)
+      (.register "https" insecure-strategy)
+      (.build)))
+
+(def regular-scheme-registry
+  (-> (RegistryBuilder/create)
+      (.register "http" (PlainConnectionSocketFactory/getSocketFactory))
+      (.register "https" secure-ssl-socket-factory)
+      (.build)))
+
+(def regular-strategy-registry
+  (-> (RegistryBuilder/create)
+      (.register "http" NoopIOSessionStrategy/INSTANCE)
+      (.register "https" secure-strategy)
+      (.build)))

 (defn ^Registry get-keystore-scheme-registry
   [req]


Revert "Update data reader to ignore #inst and #uuid"

This reverts commit abf2676b7713be315969808de9f068adf60e7f3c.

--- src/cljs/cljs/reader.cljs
+++ src/cljs/cljs/reader.cljs
@@ -333,9 +333,7 @@
    "<" (throwing-reader "Unreadable form")
    "\"" read-regex
    "!" read-comment
-   "_" read-discard
-   "i" read-discard
-   "u" read-discard})
+   "_" read-discard})

 (defn read
   "Reads the first object from a PushbackReader. Returns the object read.


remove todo

remove todo

--- src/cljs_api_gen/core.clj
+++ src/cljs_api_gen/core.clj
@@ -12,7 +12,6 @@
 ;; Usage
 ;;--------------------------------------------------------------------------------

-;; TODO: add config for output directory
 (def usage-examples
   [{:opts  {:catalog :all}    :desc "Start or resume building docs catalog for all cljs versions"}
    {:opts  {:catalog 3}       :desc "Start or resume the next 3 cljs versions"}


Holy shit its finished!

Holy shit its finished!

--- src/clojurecraft/core.clj
+++ src/clojurecraft/core.clj
@@ -379,6 +379,17 @@
   (-write-string16 conn text3)
   (-write-string16 conn text4))

+(defn write-packet-incrementstatistic [conn {statisticid :statisticid amount :amount}]
+  (-write-byte conn (:incrementstatistic packet-ids))
+
+  (-write-int conn statisticid)
+  (-write-byte conn amount))
+
+(defn write-packet-disconnectkick [conn {reason :reason}]
+  (-write-byte conn (:disconnectkick packet-ids))
+
+  (-write-string16 conn reason))
+

 ; Writing Wrappers -----------------------------------------------------------------
 (defn flushc [conn]
@@ -417,6 +428,8 @@
     :windowclick          (write-packet-windowclick conn payload)
     :transaction          (write-packet-transaction conn payload)
     :updatesign           (write-packet-updatesign conn payload)
+    :incrementstatistic   (write-packet-incrementstatistic conn payload)
+    :disconnectkick       (write-packet-disconnectkick conn payload)

     )
   (flushc conn))
@@ -844,6 +857,15 @@
                        :unknown2 (-read-short conn)
                        :textlength (-read-int conn))]
     (assoc pretext :text (-read-bytearray (:textlength pretext)))))
+
+(defn read-packet-incrementstatistic [conn]
+  (assoc {}
+    :statisticid (-read-int conn)
+    :amount (-read-byte conn)))
+
+(defn read-packet-disconnectkick [conn]
+  (assoc {}
+    :reason (-read-string16 conn)))

 ; Reading Wrappers -----------------------------------------------------------------
@@ -904,6 +926,8 @@
         :transaction               (read-packet-transaction conn)
         :updatesign                (read-packet-updatesign conn)
         :mapdata                   (read-packet-mapdata conn)
+        :incrementstatistic        (read-packet-incrementstatistic conn)
+        :disconnectkick            (read-packet-disconnectkick conn)

         :else (str "UNKNOWN PACKET TYPE: " packet-id)
         ))


Added wrap-flash middleware to compojure.handler/site function

--- src/compojure/handler.clj
+++ src/compojure/handler.clj
@@ -5,7 +5,8 @@
                          nested-params
                          multipart-params
                          cookies
-                         session]))
+                         session
+                         flash]))

 (defn- with-opts [routes middleware opts]
   (if opts
@@ -28,6 +29,7 @@
   "Create a handler suitable for a standard website. This adds the
   following middleware to your routes:
     - wrap-session
+    - wrap-flash
     - wrap-cookies
     - wrap-multipart-params
     - wrap-params
@@ -40,4 +42,5 @@
   [routes & [opts]]
   (-> (api routes)
       (with-opts wrap-multipart-params (:multipart opts))
+      (wrap-flash)
       (with-opts wrap-session (:session opts))))


allocation will now contain disk format

allocation will now contain disk format

--- src/vsphere/vijava.clj
+++ src/vsphere/vijava.clj
@@ -102,7 +102,7 @@
   {:sparse VirtualMachineRelocateTransformation/sparse
    :flat VirtualMachineRelocateTransformation/flat})

-(defn relocation-spec [{:keys [datacenter]} {:keys [disk-format]}]
+(defn relocation-spec [{:keys [datacenter disk-format]}]
   (doto (VirtualMachineRelocateSpec.)
     (.setTransform (disk-format-types disk-format))
     (.setPool (.getMOR (first (resource-pools datacenter))))))
@@ -115,7 +115,7 @@

 (defn clone-spec [allocation machine]
   (doto (VirtualMachineCloneSpec.)
-    (.setLocation (relocation-spec allocation machine))
+    (.setLocation (relocation-spec allocation))
     (.setConfig (config-spec machine))
     (.setPowerOn false)
     (.setTemplate false)))


Previous hotfix didn't compile because I used wrong variable name.

--- src/foreclojure/users.clj
+++ src/foreclojure/users.clj
@@ -89,10 +89,10 @@

 (def-page user-profile [username]
   (let [page-title (str "User: " username)]
-    {:title title
+    {:title page-title
      :content
      (list
-      [:h2 "User: " username]
+      [:h2 page-title]
       [:hr]
       [:table
        (for [difficulty ["Elementary" "Easy" "Medium" "Hard"]]


apply feedback

apply feedback

--- src/io/perun/markdown.clj
+++ src/io/perun/markdown.clj
@@ -16,38 +16,44 @@
         short-name))

 (defn extract-between [s prefix suffix]
-  (-> s
-      (str/split prefix)
-      second
-      (str/split suffix)
-      first))
+  (some-> s
+          (str/split prefix)
+          second
+          (str/split suffix)
+          first))

 (defn parse-file-metadata [file-content]
-  (let [metadata-str (extract-between file-content #"---\n" #"---\n")
-        parsed-yaml (yaml/parse-string metadata-str)]
-    ; we use `original` file flag to distinguish between generated files
-    ; (e.x. created those by plugins)
-    (assoc parsed-yaml :original true)))
+  (if-let [metadata-str (extract-between file-content #"---\n" #"---\n")]
+    (if-let [parsed-yaml (yaml/parse-string metadata-str)]
+      ; we use `original` file flag to distinguish between generated files
+      ; (e.x. created those by plugins)
+      (assoc parsed-yaml :original true)
+      {:original true})
+    {:original true}))

 (defn remove-metadata [content]
-  (first (drop 2 (str/split content #"---\n"))))
+  (let [splitted (str/split content #"---\n")]
+    (if (> (count splitted) 2)
+      (first (drop 2 splitted))
+      content)))

 (defn markdown-to-html [file-content]
+  (u/info file-content)
   (-> file-content
       remove-metadata
       markdown-converter/md-to-html-string))

 ; TODO we need to validate that create-filename is a function
 (defn process-file [file options]
-  (let [file-content (slurp file)]
-    (if-let [metadata (parse-file-metadata file-content)]
-      (let [create-filename-fn (eval (read-string (:create-filename options)))
-            filename (create-filename-fn file)
-            content (markdown-to-html file-content)
-            updated-meta (assoc metadata
-                                  :filename filename
-                                  :content content)]
-        [(.getName file) updated-meta]))))
+  (let [file-content (slurp file)
+        metadata (parse-file-metadata file-content)
+        create-filename-fn (eval (read-string (:create-filename options)))
+        filename (create-filename-fn file)
+        content (markdown-to-html file-content)
+        updated-meta (assoc metadata
+                              :filename filename
+                              :content content)]
+      [(.getName file) updated-meta]))

 (defn parse-markdown [markdown-files options]
   (let [parsed-files (into {} (map #(process-file (io/file %) options) markdown-files))]