Easier initialization with ons-app fn

Easier initialization with ons-app fn

--- src/cordevicljs/client/app.cljs
+++ src/cordevicljs/client/app.cljs
@@ -4,7 +4,7 @@
               [cordevicljs.client.views :as views]
               [cordevicljs.client.ws :as ws]))

-(defonce state (reagent/atom {:title "cordevicljs"
+(defonce state (reagent/atom {:title "CorDeviCLJS"
                               :messages []
                               :re-render-flip false}))

@@ -21,6 +21,12 @@
   (reagent/render-component
     [(ons-component component dom-id callback) state-wrapper]
      (.getElementById js/document dom-id)))
+
+(defn ons-app [angular-app-id component reagent-id state-wrapper & [callback]]
+  (.module (.-angular js/window) angular-app-id #js ["onsen"])
+  (.ready js/ons
+    (fn []
+      (ons-render component reagent-id state-wrapper callback))))

 (defmulti handle-event (fn [data [ev-id ev-data]] ev-id))

@@ -44,8 +50,4 @@
   (.addEventListener js/document "deviceready" onDeviceReady true))

 (defn ^:export main []
-  (.module (.-angular js/window) "app" #js ["onsen"])
-  (.ready js/ons
-    (fn []
-      (ons-render app "app" state)
-      (prepare-device))))
+  (ons-app "app" app "app" state prepare-device))


kibit style fixes

kibit style fixes

--- src/ctia/stores/es/sighting.clj
+++ src/ctia/stores/es/sighting.clj
@@ -26,14 +26,14 @@
 (s/defn obs->hashes :- [s/Str]
   "transform a list of observables into hashes"
   [observables :- [Observable]]
-  (map #(observable->observable-hash %) observables))
+  (map observable->observable-hash observables))

 (s/defn stored-sighting->es-stored-sighting :- (s/maybe ESStoredSighting)
   "adds an observables hash to a sighting"
   [{:keys [observables] :as s :- (s/maybe StoredSighting)}]
   (when s
     (assoc s :observables_hash
-           (map #(observable->observable-hash %) observables))))
+           (map observable->observable-hash observables))))

 (s/defn es-stored-sighting->stored-sighting :- (s/maybe StoredSighting)
   "remove the computed observables hash from a sighting"


Don't update the state of a dead peer.

Don't update the state of a dead peer.

--- src/onyx/coordinator/impl.clj
+++ src/onyx/coordinator/impl.clj
@@ -147,6 +147,7 @@
                 (assoc peer-state :state :waiting))]

     (when (and same-task?
+               (not= (:state peer-state) :dead)
                (and (not (and (= (:state peer-state) :sealing)
                               (= (:state state) :waiting)))
                     (not (= (:state peer-state) (:state state))))


Added some splice-sep variations for testing

--- src/paredit/core_commands.clj
+++ src/paredit/core_commands.clj
@@ -445,7 +445,10 @@
                 "(foo (b|ar baz) quux)" "(foo b|ar baz quux)"
                 "(bar| baz)" "bar| baz"
                 "(bar | baz)" "bar | baz"
+                "(foo (ba|r) baz)" "(foo ba|r baz)"
                 ; TODO Following edge case tests do not pass
+                ;"(foo \"bar|\" baz)" "(foo bar| baz)"
+                ;"(foo \"ba|r\" baz)" "(foo ba|r baz)"
                 ;"(foo (|) baz)" "(foo | baz)"
                 ;"(foo (bar|) baz)" "(foo bar| baz)"
                 }]


Added the ability to get the up vector of a camera. I didn't add the set ability yet.

--- src/play_clj/core_cameras.clj
+++ src/play_clj/core_cameras.clj
@@ -186,6 +186,11 @@
     (.lookAt camera x y z)
     (.update camera)))

+(defn up [screen]
+  "Returns the up vector of the camera in `screen`."
+  (let [^Camera camera (u/get-obj screen :camera)]
+    (. camera up)))
+
 (defn near
   "Returns the near clipping plane distance of the camera in `screen`."
   [screen]


fixed issues with reagent moving to async render

--- test/kioo/reagent_test.cljs
+++ test/kioo/reagent_test.cljs
@@ -5,7 +5,7 @@
                                set-style remove-style add-class
                                remove-class wrap unwrap set-class
                                html html-content listen]]
-            [reagent.core :as reagent :refer [atom]]
+            [reagent.core :as reagent :refer [atom flush]]
             [kioo.util :as util]
             [goog.dom :as gdom])
   (:require-macros [kioo.reagent :refer [component snippet template
@@ -46,7 +46,7 @@
                            {[:div] (content @atm)})
           container (initial-render comp)
           html-str1 (inner-html container)
-          _ (reset! atm "two")
+          _ (do (reset! atm "two") (flush))
           html-str2 (inner-html container)]
       (is (= "
one
" html-str1))
       (is (= "
two
" html-str2))
@@ -60,7 +60,7 @@
                            {[:div] (content [comp2])})
           container (initial-render comp)
           html-str1 (inner-html container)
-          _ (reset! atm "two")
+          _ (do (reset! atm "two") (flush))
           html-str2 (inner-html container)]
       (is (= "

one

"
              html-str1))
@@ -73,7 +73,7 @@
                            {[:div] (append @atm)})
           container (initial-render comp)
           html-str1 (inner-html container)
-          _ (reset! atm "two")
+          _ (do (reset! atm "two") (flush))
           html-str2 (inner-html container)]
       ;;note that ract wraps text nodes in span tags
       ;;this is expected to be corrected soon in react but


use proper function call for tolowercase

--- app/src/cljs/app/components.cljs
+++ app/src/cljs/app/components.cljs
@@ -24,7 +24,7 @@
     [:li.mdl-list__item
      [:span.mdl-list__item-primary-content
       [:i.material-icons.mdl-list__item-icon icon]
-      [:a.mdl-navigation__link {:href (str "#" (.-toLowerCase name))}
+      [:a.mdl-navigation__link {:href (str "#" (.toLowerCase name))}
        name]]]))

 (defn sidenav-component


Fix deploy test.

Fix deploy test.

--- test/test_deploy.clj
+++ test/test_deploy.clj
@@ -9,7 +9,7 @@

 (deftest test-deploy
   (delete-file-recursively "/tmp/lein-repo" :silently)
-  (deploy test-project :snapshots "file:///tmp/lein-repo")
+  (deploy test-project "snapshots")
   (let [dir (file "/tmp/lein-repo/nomnomnom/nomnomnom/0.5.0-SNAPSHOT/")
         files (.list dir)
         year (+ 1900 (.getYear (java.util.Date.)))]


Add test for null component return

Add test for null component return

--- test/testcloact.cljs
+++ test/testcloact.cljs
@@ -323,3 +323,12 @@
     (is (ifn? p1))
     (is (= (reagent/partial vector 1 2) p1))
     (is (not= p1 (reagent/partial vector 1 3)))))
+
+(deftest test-null-component
+  (let [null-comp (fn [do-show]
+                    (when do-show
+                      [:div "div in test-null-component"]))]
+    (is (not (re-find #"test-null-component"
+                      (as-string [null-comp false]))))
+    (is (re-find #"test-null-component"
+                 (as-string [null-comp true])))))


Normalize metadata for more file types.

Normalize metadata for more file types.

--- src/cavm/cgdata.clj
+++ src/cavm/cgdata.clj
@@ -50,12 +50,16 @@
 (defmethod reader :cgdata.core/probemap
   [filetype docroot url]
   (-> (cgdata/probemap-file url :docroot docroot)
-      (assoc :datatype :probemap)))
+      (assoc :datatype :probemap)
+      (replace-references)
+      (update-in [:metadata] normalize-meta-keys)))

 (defmethod reader :cgdata.core/mutation
   [filetype docroot url]
   (-> (cgdata/mutation-file url :docroot docroot)
-      (assoc :datatype :mutation)))
+      (assoc :datatype :mutation)
+      (replace-references)
+      (update-in [:metadata] normalize-meta-keys)))

 (defn normalized-matrix-reader [filetype docroot url]
   (-> (cgdata/matrix-file url :docroot docroot)


Do the vec conversion later.

Do the vec conversion later.

--- src/cbfg/fence.cljs
+++ src/cbfg/fence.cljs
@@ -40,12 +40,12 @@
    [inflight-chs #{}                ; chans of requests currently being processed.
     fenced-ch nil                   ; chan of last, inflight "fenced" request.
     fenced-ch-res nil]              ; last received result from last fenced request.
-   (let [chs (vec (if (or fenced-ch ; if we're fenced or too many inflight requests,
-                        (>= (count inflight-chs) max-inflight))
-                  inflight-chs      ; then ignore in-ch & finish existing inflight requests.
-                  (conj inflight-chs in-ch)))]
+   (let [chs (if (or fenced-ch      ; if we're fenced or too many inflight requests,
+                     (>= (count inflight-chs) max-inflight))
+               inflight-chs         ; then ignore in-ch & finish existing inflight requests.
+               (conj inflight-chs in-ch))]
      (if (seq chs)                  ; empty when in-ch is closed and no inflight-chs.
-       (let [[v ch] (aalts fenced-pump chs)]
+       (let [[v ch] (aalts fenced-pump (vec chs))]
          (cond
           (= ch in-ch) (if (nil? v)
                          (recur inflight-chs out-ch nil)           ; using out-ch as a sentinel.


Fix tests related to the last dependencies version upgrading.

--- test/suricatta/dsl_test.clj
+++ test/suricatta/dsl_test.clj
@@ -151,7 +151,7 @@
                 (dsl/from :book)
                 (dsl/for-update :name))]
       (is (= (fmt/get-sql q)
-             "select name from book for update of \"name\""))))
+             "select name from book for update of name"))))

   (testing "union two selects"
     (let [q (dsl/union
@@ -254,7 +254,7 @@
     (let [q (-> (dsl/update :t1)
                 (dsl/set {:id 2 :name "foo"}))]
       (is (= (fmt/get-sql q)
-             "update t1 set name = ?, id = ?"))))
+             "update t1 set id = ?, name = ?"))))

   (testing "Update statement without condition"
     (let [q (-> (dsl/update :t1)


Filter out ignored files, not ignored dirs

--- boot/pod/src/boot/file.clj
+++ boot/pod/src/boot/file.clj
@@ -91,8 +91,9 @@
 (defn dir-set
   ([dir]
    (let [info (juxt #(relative-to dir %) #(.lastModified %))
-         mapf #(zipmap [:dir :abs :rel :mod] (list* dir % (info %)))]
-     (set (mapv mapf (filter (memfn isFile) (file-seq dir))))))
+         mapf #(zipmap [:dir :abs :rel :mod] (list* dir % (info %)))
+         ign? #(and *ignore* (*ignore* %))]
+     (set (mapv mapf (filter (memfn isFile) (remove ign? (file-seq dir)))))))
   ([dir1 dir2 & dirs]
    (reduce union (map dir-set (list* dir1 dir2 dirs)))))

@@ -125,7 +126,6 @@
   (let [d (dir-map (file dst))
         s (->> (cons src srcs)
             (map file)
-            (remove #(and *ignore* (*ignore* %)))
             (apply dir-map))
         [to-cp to-rm] (what-changed d s algo)
         cp (map #(vector :cp (:abs (s %)) (file dst %)) to-cp)


Use string replacement to display short version of proc-fns.

--- src/dsbdp/experiment_helper.clj
+++ src/dsbdp/experiment_helper.clj
@@ -21,6 +21,7 @@
       (recur (conj fns (prewalk-replace {:idx (count fns)} fn-n)))
       (do
         (println "proc-fns-full:" fns)
+        (println "proc-fns-short:" (.replaceAll (str fns) "(?<=\\()([a-zA-Z\\.\\-]++/)" ""))
         fns))))

 (defmacro create-no-op-proc-fns