Deleted parallel display form in master; to be worked on in branch 'formsearch'

--- src/clj/webapp/routes/pvprvllg.clj
+++ src/clj/webapp/routes/pvprvllg.clj
@@ -71,6 +71,53 @@

 (defn handle-prvllgdisplay
+  [ldomain qstring]
+  ;; send SPARQL over HTTP request
+  (let [query-sparql (sparql/prvllg-sparql ldomain qstring)
+        query-sparql-pr (replace query-sparql #"<" "<")
+        req (http/get aama
+                      {:query-params
+                       {"query" query-sparql ;;generated sparql
+                        ;;"format" "application/sparql-results+json"}})]
+                        ;;"format" "text"}})]
+                        "format" "csv"}})
+        csvstring (:body req)
+        csvstr (split csvstring #"\r\n" 2)
+        ;; csvstr is a string of comma-separated cells
+        ;; whose rows are separated by \r\n
+        ;; Take off the top header
+        headers (first csvstr)
+        heads (split headers #",")
+        formstring (last csvstr)
+        formtable (csv2table heads formstring)]
+    (log/info "sparql result status: " (:status req))
+    (layout/common
+     [:body
+      [:h3#clickable "Language-Property-Values: " ]
+      [:p [:h4 "Language Domain: "]
+       [:em ldomain]]
+      [:p [:h4 "Query String: "]
+       [:em qstring]]
+      [:p "Click on column to sort (multiple sort by holding down shift key). Columns can be dragged by clicking and holding on 'drag-bar' at top of column."]
+      [:hr]
+      formtable
+      [:hr]
+      [:h3 "Parallel Display of Forms"]
+      [:p "[Under development in branch 'formsearch'.]"]
+           [:hr]
+           [:div [:h4 "======= Debug Info: ======="]
+            [:p "Query: "]
+            [:p [:pre query-sparql-pr]]
+            [:p "Response: "]
+            [:p [:pre csvstring]]
+            [:h4 "==========================="]]
+           [:script {:src "js/goog/base.js" :type "text/javascript"}]
+           [:script {:src "js/webapp.js" :type "text/javascript"}]
+           [:script {:type "text/javascript"}
+            "goog.require('webapp.core');"]])))
+
+(defn handle-prvllgdisplay2
+  "This version has form for parallel display of tokens."
   [ldomain qstring]
   ;; send SPARQL over HTTP request
   (let [query-sparql (sparql/prvllg-sparql ldomain qstring)


Make history initialization idempotent

Make history initialization idempotent

--- src/cljs/comic_reader/history.cljs
+++ src/cljs/comic_reader/history.cljs
@@ -4,12 +4,18 @@
             [secretary.core :as secretary])
   (:import goog.History))

+(defonce goog-history (atom nil))
+
 (defn hook-browser-navigation! []
-  (doto (History. false
-                  "/blank"
-                  (.getElementById js/document "history_state"))
-    (events/listen
-        EventType/NAVIGATE
-        (fn [event]
-          (secretary/dispatch! (.-token event))))
-    (.setEnabled true)))
+  (when (nil? @goog-history)
+    (let [hist (History. false
+                         "/blank"
+                         (.getElementById js/document
+                                          "history_state"))]
+      (reset! goog-history hist)
+      (doto hist
+        (events/listen
+            EventType/NAVIGATE
+            (fn [event]
+              (secretary/dispatch! (.-token event))))
+        (.setEnabled true)))))


fix race condition

fix race condition

--- src/clojure_images_server/save.clj
+++ src/clojure_images_server/save.clj
@@ -1,8 +1,6 @@
 (ns clojure-images-server.save
   (:require [ring.middleware.multipart-params :as mp])
   (:use [ring.util.json-response]))
-
-(def route-settings)

 (defn- get-files [req]
   (get (:params (mp/multipart-params-request req)) "imageFiles"))
@@ -10,16 +8,15 @@
 (defn- save-file [file]
   (:filename file))

-(defn- save-files [files]
-  (if (map? files)
-      (list (save-file files))
-      (if (:multiple route-settings)
-        (map save-file files)
-        (list (save-file (get files 0))))))
+(defn- save-files [rs files]
+  (do (println rs)
+    (if (map? files)
+        (list (save-file files))
+        (if (:multiple rs)
+          (map save-file files)
+          (list (save-file (get files 0)))))))

 (defn handler [req rs]
-  (do
-    (def route-settings rs)
-    (-> (get-files req)
-        (save-files)
-        (json-response))))
+  (-> (get-files req)
+      ((partial save-files rs))
+      (json-response)))


Remove deprecated tags

Remove deprecated tags

--- src/aero/core.clj
+++ src/aero/core.clj
@@ -33,11 +33,6 @@
         (contains? value :default) (clojure.core/get value :default)
         :otherwise nil))

-;; Deprecated
-(defmethod reader 'cond
-  [opts tag value]
-  (reader opts 'profile value))
-
 (defmethod reader 'hostname
   [{:keys [hostname]} tag value]
   (let [hostn (or hostname (-> (sh/sh "hostname") :out trim))]
@@ -64,11 +59,6 @@
   [opts tag value]
   (read-config value opts))

-;; Deprecated
-(defmethod reader 'file
-  [opts tag value]
-  (read-config value opts))
-
 (defmethod reader 'join
   [opts tag value]
   (apply str value))


add test for passé composé morphology

add test for passé composé morphology

--- test/babel/test/fr.clj
+++ test/babel/test/fr.clj
@@ -61,7 +61,6 @@

 (def etre (first (filter #(= true (get-in % [:synsem :aux]))
                          (get @lexicon "être"))))
-
 (deftest over-test
   (let [result
         (over (get @fr/small :grammar)
@@ -72,6 +71,54 @@
          (not (empty? result))
          (= 1 (.size result)))))

+(deftest passe-compose-morphology
+  (let [result
+        {:français
+         {:a {:initial true,
+              :français "nous"},
+          :b {:b {:future-stem "ir",
+                  :agr {:number :plur,
+                        :person :1st},
+                  :present {:3plur "vont",
+                            :2plur "allez",
+                            :3sing "va",
+                            :1sing "vais",
+                            :2sing "vas",
+                            :1plur "allons"},
+                  :français "aller",
+                  :infl :passe-compose,
+                  :essere true,
+                  :initial false},
+              :initial false,
+              :a {:infl :present,
+                  :infinitive "être",
+                  :initial true,
+                  :agr {:number :plur,
+                        :person :1st},
+                  :essere false,
+                  :passato "été",
+                  :imperfect {:2sing "étais",
+                              :3plur "étaient",
+                              :2plur "étiez",
+                              :1sing "étais",
+                              :3sing "était",
+                              :1plur "étions"},
+                  :present {:2sing "es",
+                            :3plur "sont",
+                            :2plur "êtes",
+                            :1sing "suis",
+                            :3sing "est",
+                            :1plur "sommes"},
+                  :futuro {:2sing "seras",
+                           :3plur "seront",
+                           :2plur "serez",
+                           :1sing "serai",
+                           :3sing "sera",
+                           :1plur "serons"},
+                  :futuro-stem "ser",
+                  :exception true,
+                  :français "sommes"}}}}]
+    (is (= (fo result) "nous sommes allées"))))

 (deftest passe-compose-1
   (let [result


Add comment describing the rationale for the workaround

--- src/status_im/ui/components/text_input/view.cljs
+++ src/status_im/ui/components/text_input/view.cljs
@@ -18,6 +18,8 @@
        :auto-focus             true
        :auto-capitalize        :none}
       (dissoc props :style :height)
+      ;; Workaround until `value` TextInput field is available on desktop:
+      ;; https://github.com/status-im/react-native-desktop/issues/320
       (when-not platform/desktop?
         {:value text}))]
     (when content content)]


Add dismiss button to the method permissions modal

--- src/cljs/org/broadinstitute/firecloud_ui/page/methods_configs_acl.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/page/methods_configs_acl.cljs
@@ -31,6 +31,7 @@
        :dismiss-self (:dismiss-self props)
        :content (react/create-element
                   [:div {:style {:background "#fff" :padding "2em"}}
+                   [comps/XButton {:dismiss (:dismiss-self props)}]
                    (cond
                      (:acl-vec @state)
                      [:div {}


PDOK-1599

--- src/test/clojure/pdok/featured/extracts_test.clj
+++ src/test/clojure/pdok/featured/extracts_test.clj
@@ -22,7 +22,7 @@
 (deftest test-one-feature
   (let [[error features] (features-for-extract "test" "one-feature" "gml2extract" (two-features) "src/test/resources/templates")
         _ (println (str "error: " error))
-        _ (prrintln (str "features" features))
+        _ (println (str "features" (first features)))
         [tiles feature] (first features)]
     (is (boolean (re-find #"<geo><gml:Polygon" feature)))))


Replace `!=` with `not=`

Replace `!=` with `not=`

I think that's what you meant, as there is no `!=` in the core library.

--- src/zprint/config.cljc
+++ src/zprint/config.cljc
@@ -294,7 +294,7 @@
    "and" :hang,
    "or" :hang,
    "=" :hang,
-   "!=" :hang,
+   "not=" :hang,
    "try" :none-body,
    "catch" :arg2,
    "with-meta" :arg1-body,
@@ -1270,4 +1270,4 @@
      " Output information to include when submitting an issue:"
      ""
      "   (zprint nil :support)"
-     ""]))+     ""]))


Cleaned up code for fix for Issue #137, comma after last map element.

--- src/zprint/zprint.cljc
+++ src/zprint/zprint.cljc
@@ -4200,32 +4200,16 @@
          first? true
          newline-count 0]
     (if (empty? coll)
-      (apply concat-no-nil (persistent! #_out
-
-           (if (zero? newline-count)
-           out
-           (conj-it! out
-                     (repeat-element-nl newline-count (first sep))
-                     #_(repeat newline-count (first sep))))
-
-      ))
+      (apply concat-no-nil
+        (persistent!
+          (if (zero? newline-count)
+            out
+            (conj-it! out (repeat-element-nl newline-count (first sep))))))
       (let [[hangflow style-vec] (first coll)
-            style-vec-empty? (and (= (count style-vec) 1)
-                                  (empty? (first (first style-vec))))
-	    [_ _ what] (first style-vec) ]
+            [_ _ what] (first style-vec)]
         #_(prn "====>>>>>>>> interpose-either-nl-hf: style-vec:" style-vec)
         (cond
-          ; TODO: Get rid of this cond clause and the check for
-          ; it above if we haven't had the exception.
-          style-vec-empty?
-            ; We have a newline that has been removed, just skip this
-            ; one and move on.
-            #_(recur (next coll) out previous-needs-comma? add-nl? no-interpose?)
-            ; I don't think we should get these anymore.
-            (throw (#?(:clj Exception.
-                       :cljs js/Error.)
-                    (str "empty style vec:" style-vec)))
-          (= what #_(nth (first style-vec) 2) :newline)
+          (= what :newline)
             ; We have a one or more newlines.  We are going to keep
             ; track of what we've seen and will actually output things
             ; later, when we know what we actually have.
@@ -4238,7 +4222,6 @@
                    first?
                    (+ newline-count (count-newline-types style-vec)))
           ;
-          #_(recur (next coll) (conj! out style-vec) nil nil true)
           :else
             ; We have a normal style-vec that we will process.  This one
             ; has no newlines.  But we might have seen plenty of newlines
@@ -4250,10 +4233,10 @@
                   ; if first? we assume that we get one newline from caller
                   interpose-count (if first? 1 interpose-count)
                   addtl-nl-needed (max (- newline-count interpose-count) 0)]
-	      ; Here is where we need to figure out if two newlines are
-	      ; coming out in order, and ensure that the first ones don't
-	      ; have any spaces after them.
-	      #_(prn "ienf: interpose-style-vec:" interpose-style-vec)
+              ; Here is where we need to figure out if two newlines are
+              ; coming out in order, and ensure that the first ones don't
+              ; have any spaces after them.
+              #_(prn "ienf: interpose-style-vec:" interpose-style-vec)
               (recur
                 (next coll)
                 (if first?
@@ -4261,32 +4244,23 @@
                     (conj! out style-vec)
                     (conj-it! out
                               (repeat-element-nl addtl-nl-needed (first sep))
-                              #_(repeat addtl-nl-needed (first sep))
                               style-vec))
                   (if (zero? addtl-nl-needed)
                     (conj-it! out interpose-style-vec style-vec)
                     (conj-it! out
                               (trimr-blanks-style-vec interpose-style-vec)
                               (repeat-element-nl addtl-nl-needed (first sep))
-                              #_(repeat addtl-nl-needed (first sep))
                               style-vec)))
-                #_(if previous-needs-comma?
-                    (conj-it! out (if add-nl? sep-comma-nl sep-comma) style-vec)
-                    (if first?
-                      ;(empty? out)
-                      (conj! out style-vec)
-                      (conj-it! out (if add-nl? sep-nl sep) style-vec)))
-		(and comma?
-		  ; We got rid of newlines above
-		  (not= what :comment)
-		  (not= what :comment-inline)
-		  ; Is there a non comment or non newline/indent element
-		  ; left in coll, or is this the last one?
-		  ; This returns the [hangflow style-vec], but we are not
-		  ; using the data, just the existence of the thing here
-		  (next-non-comment-nl (next coll)))
-
-                #_(when pred-fn (pred-fn style-vec))
+                (and comma?
+                     ; We got rid of newlines above
+                     (not= what :comment)
+                     (not= what :comment-inline)
+                     ; Is there a non comment or non newline/indent element
+                     ; left in coll, or is this the last one?
+                     ; This returns the [hangflow style-vec], but we are not
+                     ; using the data, just the existence of the thing here
+		     ; Fix for Issue #137.
+                     (next-non-comment-nl (next coll)))
                 ; should we put an extra new-line before the next element?
                 ; Two styles here:
                 ;  o  always put one if the previous pair contained a new-line
@@ -4301,125 +4275,12 @@
                 nil ;first?
                 (if (do #_(prn "interpose-either-nl-hf style-vec:" style-vec
                                "newline-count:" newline-count)
-                        nil #_(or (= (nth (last style-vec) 2) :comment)
-                            (= (nth (last style-vec) 2) :comment-inline)))
-			    ; i132
+                        nil
+                        #_(or (= (nth (last style-vec) 2) :comment)
+                              (= (nth (last style-vec) 2) :comment-inline)))
+                  ; i132
                   (do (println "******************") 1)
-                  0)
-                #_0 ;newline-count
-                )))))))
-
-(defn interpose-either-nl-hf-alt
-  "Do very specialized interpose, but different seps depending on pred-fn
-  return and nl-separator?. This assumes that sep-* does one line, and
-  sep-*-nl does two lines."
-  [sep-true sep-true-nl sep-nil sep-nil-nl
-   {:keys [nl-separator? nl-separator-flow?], :as suboptions} ;nl-separator?
-   pred-fn coll]
-  #_(prn "ienf: sep-nil:" sep-nil "coll:" coll)
-  (loop [coll coll
-         out (transient [])
-         previous-pred? nil
-         add-nl? nil
-         first? true
-         newline-count 0]
-    (if (empty? coll)
-      (apply concat-no-nil (persistent! #_out
-
-           (if (zero? newline-count)
-           out
-           (conj-it! out
-                     (repeat-element-nl newline-count (first sep-nil))
-                     #_(repeat newline-count (first sep-nil))))
-
-      ))
-      (let [[hangflow style-vec] (first coll)
-            style-vec-empty? (and (= (count style-vec) 1)
-                                  (empty? (first (first style-vec))))]
-        #_(prn "====>>>>>>>> interpose-either-nl-hf: style-vec:" style-vec)
-        (cond
-          ; TODO: Get rid of this cond clause and the check for
-          ; it above if we haven't had the exception.
-          style-vec-empty?
-            ; We have a newline that has been removed, just skip this
-            ; one and move on.
-            #_(recur (next coll) out previous-pred? add-nl? no-interpose?)
-            ; I don't think we should get these anymore.
-            (throw (#?(:clj Exception.
-                       :cljs js/Error.)
-                    (str "empty style vec:" style-vec)))
-          (= (nth (first style-vec) 2) :newline)
-            ; We have a one or more newlines.  We are going to keep
-            ; track of what we've seen and will actually output things
-            ; later, when we know what we actually have.
-            ; For now, just increase the count and don't do anything
-            ; else.
-            (recur (next coll)
-                   out
-                   previous-pred?
-                   add-nl?
-                   first?
-                   (+ newline-count (count-newline-types style-vec)))
-          ;
-          #_(recur (next coll) (conj! out style-vec) nil nil true)
-          :else
-            ; We have a normal style-vec that we will process.  This one
-            ; has no newlines.  But we might have seen plenty of newlines
-            ; before this -- or not.
-            (let [[interpose-style-vec interpose-count]
-                    (if previous-pred?
-                      (if add-nl? [sep-true-nl 2] [sep-true 1])
-                      (if add-nl? [sep-nil-nl 2] [sep-nil 1]))
-                  ; if first? we assume that we get one newline from caller
-                  interpose-count (if first? 1 interpose-count)
-                  addtl-nl-needed (max (- newline-count interpose-count) 0)]
-	      ; Here is where we need to figure out if two newlines are
-	      ; coming out in order, and ensure that the first ones don't
-	      ; have any spaces after them.
-	      #_(prn "ienf: interpose-style-vec:" interpose-style-vec)
-              (recur
-                (next coll)
-                (if first?
-                  (if (zero? addtl-nl-needed)
-                    (conj! out style-vec)
-                    (conj-it! out
-                              (repeat-element-nl addtl-nl-needed (first sep-nil))
-                              #_(repeat addtl-nl-needed (first sep-nil))
-                              style-vec))
-                  (if (zero? addtl-nl-needed)
-                    (conj-it! out interpose-style-vec style-vec)
-                    (conj-it! out
-                              (trimr-blanks-style-vec interpose-style-vec)
-                              (repeat-element-nl addtl-nl-needed (first sep-nil))
-                              #_(repeat addtl-nl-needed (first sep-nil))
-                              style-vec)))
-                #_(if previous-pred?
-                    (conj-it! out (if add-nl? sep-true-nl sep-true) style-vec)
-                    (if first?
-                      ;(empty? out)
-                      (conj! out style-vec)
-                      (conj-it! out (if add-nl? sep-nil-nl sep-nil) style-vec)))
-                (when pred-fn (pred-fn style-vec))
-                ; should we put an extra new-line before the next element?
-                ; Two styles here:
-                ;  o  always put one if the previous pair contained a new-line
-                ;     which could be (but is not) the default
-                ;     To do this you would do:
-                ;       (and nl-separator? (not (single-line? style-vec)))
-                ;  o  put one only if the previous right hand part of the
-                ;     pair did a flow (which is the current default)
-                ;     To do this, you look for whether or not the return
-                ;     from fzprint-map-two-up said it was a flow
-                (and nl-separator? (= hangflow :flow))
-                nil ;first?
-                (if (do #_(prn "interpose-either-nl-hf style-vec:" style-vec
-                               "newline-count:" newline-count)
-                        nil #_(or (= (nth (last style-vec) 2) :comment)
-                            (= (nth (last style-vec) 2) :comment-inline)))
-			    ; i132
-                  (do (println "******************") 1)
-                  0)
-                #_0 ;newline-count
+                  0) ;newline-count
                 )))))))

 (defn interpose-nl-hf
@@ -4434,8 +4295,7 @@
                           [[(str "\n") :none :indent 30]
                            [(str "\n" (blanks ind)) :none :indent 31]]
                           suboptions
-                          #_(:nl-separator? suboptions)
-                          nil
+                          nil ; comma?
                           coll))

 (defn fzprint-map*
@@ -4499,10 +4359,10 @@
       (if (empty? pair-seq)
         (concat-no-nil l-str-vec r-str-vec)
         (let [_ (dbg-pr options
-                     "fzprint-map*:" (zstring zloc)
-                     "ind:" ind
-                     "comma?" comma?
-                     "rightcnt:" (:rightcnt options))
+                        "fzprint-map*:" (zstring zloc)
+                        "ind:" ind
+                        "comma?" comma?
+                        "rightcnt:" (:rightcnt options))
               ; A possible one line representation of this map, but this is
               ; optimistic and needs to be validated.
               pair-print-one-line
@@ -4538,31 +4398,24 @@
                                                    (+ indent ind)
                                                    comma?
                                                    pair-seq)]
-                (concat-no-nil l-str-vec
-                               ;(apply concat-no-nil
-                               (interpose-either-nl-hf
-				 ; pred true
-                                 [["," ;(str "," (blanks (inc ind)))
-                                   :none :whitespace 21]
-                                  [(str "\n" (blanks (inc ind))) :none :indent 32]]
-                                 [["," ;(str "," (blanks (inc ind)))
-                                   :none :whitespace 22] ; Fix issue #59 -- don't
-                                  ; put blanks to indent before the next \n
-                                  ["\n" :none :indent 33]
-                                  [(str "\n" (blanks (inc ind))) :none :indent 34]]
-				 ; pred nil
-                                 [[(str "\n" (blanks (inc ind))) :none :indent 35]]
-                                 [[(str "\n" (blanks (inc ind))) :none :indent 36]
-                                  [(str "\n" (blanks (inc ind))) :none :indent 37]]
-                                 (:map options) ;nl-separator?
-				 comma?
-                                 #_(and comma?   ; pred
-				       ; don't put commas after comments
-                                       (not= (nth (first %) 2) :comment)
-                                       (not= (nth (first %) 2) :comment-inline))
-                                 pair-print)
-                               ; )
-                               r-str-vec)))))))))
+                (concat-no-nil
+                  l-str-vec
+                  (interpose-either-nl-hf
+                    ; comma? true
+                    [["," :none :whitespace 21]
+                     [(str "\n" (blanks (inc ind))) :none :indent 32]]
+                    [["," :none :whitespace 22] ; Fix issue #59 -- don't
+                     ; put blanks to indent before the next \n
+                     ["\n" :none :indent 33]
+                     [(str "\n" (blanks (inc ind))) :none :indent 34]]
+                    ; comma? nil
+                    [[(str "\n" (blanks (inc ind))) :none :indent 35]]
+                    [[(str "\n" (blanks (inc ind))) :none :indent 36]
+                     [(str "\n" (blanks (inc ind))) :none :indent 37]]
+                    (:map options) ;nl-separator?
+                    comma?
+                    pair-print)
+                  r-str-vec)))))))))

 (defn fzprint-map
   "Format a real map."


apply args to file

apply args to file

--- src/cake/file.clj
+++ src/cake/file.clj
@@ -29,8 +29,8 @@
   (ant Move {:file (file from)
              :tofile (file to)}))

-(defn touch [f]
-  (ant Touch {:file (file f)}))
+(defn touch [& args]
+  (ant Touch {:file (apply file args)}))

 (defn rm [f]
   (ant Delete {:file (file f)}))


removing commented out code

removing commented out code

--- test/midje/data/t_project_state.clj
+++ test/midje/data/t_project_state.clj
@@ -89,10 +89,3 @@
       (require ..ns3.. :reload) => nil)
     @failure-record => {:ns ..ns1.. :throwable throwable}))

-(comment
-  (fact "A deleted namespace will not be reloaded"
-        (let [tracker {load-key   [..n1..]
-                       unload-key [..n1.. ..n2..]
-                       deps-key   {:dependants {..n1.. #{..n2..}}}}]
-          (get-in (prepare-for-next-scan tracker) [deps-key :dependants]) => (contains {..n1.. #{}}))))
-


Bug fixes

Bug fixes

--- src-cljs/app/main.cljs
+++ src-cljs/app/main.cljs
@@ -4,7 +4,11 @@
   (:require-macros [hiccups.core :as hiccups])
   (:require
     [hiccups.runtime :as hiccupsrt]
-    [clojure.walk]))
+    [clojure.walk]
+    [goog.string]
+    [goog.string.format]))
+
+(enable-console-print!)

 ;;------------------------------------------------------------------------------
 ;; Atoms
@@ -68,25 +72,25 @@
   (.getMinutes @selected-time))

 (defn set-hours! [new-hours]
-  (swap! selected-time #(doto % .setHours new-hours)))
+  (swap! selected-time #(doto % (.setHours new-hours))))

 (defn set-minutes! [new-mins]
-  (swap! selected-time #(doto % .setMinutes new-mins)))
+  (swap! selected-time #(doto % (.setMinutes new-mins))))

 (defn sync-time-with-snapshot! []
-  (swap! selected-time #(js/Date. (:time @snapshot-index))))
+  (reset! selected-time (js/Date. (:time (@snapshot-list @snapshot-index)))))

 ; TODO: This could be improved. Probably need to rethink my data model
 (defn show-closest-snapshot! []
   (let [timestamp (.getTime @selected-time)
-        earlier-index (keep-indexed #(if (>= timestamp (:time %2)) %1) @snapshot-list)
-        later-index (dec earlier-index)
+        earlier-index (first (keep-indexed #(if (>= timestamp (:time %2)) %1) @snapshot-list))
+        later-index (max (dec earlier-index) 0)
         later (:time (@snapshot-list later-index))
         earlier (:time (@snapshot-list earlier-index))
         display-index (if (< (- later timestamp) (- timestamp earlier))
                         later-index
                         earlier-index)]
-    (swap! snapshot-index #(display-index))))
+    (reset! snapshot-index display-index)))

 (defn set-url! [timestamp]
   (let [base-url (.split js/document.URL "?")
@@ -141,14 +145,14 @@

 (defn on-popstate [e]
   (if (.-state e)
-    (swap! selected-time #(.-time e))))
+    (reset! selected-time (.-time e))))

 (defn on-datetime-change []
   (let [date (.datepicker ($ "#datepicker") "getDate")
         new-time (doto date
                     (.setMinutes (.getMinutes @selected-time))
                     (.setHours (.getHours @selected-time)))]
-    (swap! selected-time #(new-time))))
+    (reset! selected-time new-time)))

 (defn click-toggle-meridian []
   (let [hours (+ (get-hours) 12)
@@ -179,7 +183,7 @@
       (sync-time-with-snapshot!))))

 (defn click-earlier []
-  (if (>= @snapshot-index (count @snapshot-list))
+  (if (< @snapshot-index (count @snapshot-list))
     (do
       (swap! snapshot-index inc)
       (sync-time-with-snapshot!))))
@@ -192,7 +196,7 @@

 (defn add-events []
   (aset js/window "onpopstate" on-popstate)
-  (on ($ "datepicker") "changeDate" on-datetime-change)
+  (on ($ "#datepicker") "changeDate" on-datetime-change)
   (on ($ js/document) "keydown" on-keydown)

   (-> ($ "body")
@@ -209,20 +213,21 @@
 ;;------------------------------------------------------------------------------

 (defn init-snapshot-list []
-  (swap! snapshot-list (fn []
-    (-> (.-SNAPSHOT_LIST js/window) ; server injected to this in a <script>
-      (js->clj)
-      (clojure.walk/keywordize-keys)))))
+  (->> (.-SNAPSHOT_LIST js/window) ; server injected to this in a <script>
+        (js->clj)
+        (clojure.walk/keywordize-keys)
+        (reset! snapshot-list)))

 (defn init-snapshot-index []
   (let [image (attr ($ "#currentSnapshot") "src")
         starting-index (first (keep-indexed #(if (= image (:image %2)) %1) @snapshot-list))]
-    (swap! snapshot-index #(if (pos? starting-index)
-                                starting-index
-                                0))))
+    (reset! snapshot-index
+      (if (pos? starting-index)
+        starting-index
+        0))))

 (defn init []
-  (html ($ "timepickerContainer") (build-timepicker))
+  (html ($ "#timepickerContainer") (build-timepicker))
   (init-snapshot-list)
   (init-snapshot-index)
   (sync-time-with-snapshot!)


(maint) Fix report integration test

(maint) Fix report integration test

--- test/puppetlabs/puppetdb/integration/reports.clj
+++ test/puppetlabs/puppetdb/integration/reports.clj
@@ -253,7 +253,7 @@
                   (filter #(= "notice" (:level %))
                           logs))))

-        (is (= 5 (count
+        (is (= 6 (count
                   (filter #(= "info" (:level %))
                           logs))))))))


Add fns for listing a user's books on a shelf.

Also add fns for converting that xml data into useful hash-maps.

--- src/myshelf/core.clj
+++ src/myshelf/core.clj
@@ -69,3 +69,42 @@
         first
         :attrs
         :id)))
+
+(defn element->map
+  "Convert a clojure.data.xml Element into a hashmap"
+  [element]
+  {(:tag element)
+   (if (string? (first (:content element)))
+     (first (:content element))
+     (apply merge (map element->map (:content element))))})
+
+(defn extract-book-data
+  "Given a <book> in a <review>, pull out the book's info into
+  a more useful hashmap"
+  [review-element]
+  (->> review-element
+       :content
+       (filter #(= :book (:tag %)))
+       first
+       :content
+       (reduce (fn [book-map book-tag]
+                 (merge book-map (element->map book-tag)))
+               {})))
+
+(defn get-books-on-shelf
+  "Returns list of hashmaps representing the books on a given
+  user's bookshelf"
+  [consumer access-token user-id shelf]
+  (let [shelf-url (str "https://www.goodreads.com/review/list/"
+                       user-id)
+        resp (make-auth-request-GET consumer
+                                    access-token
+                                    shelf-url
+                                    {:shelf shelf
+                                     :format "xml"
+                                     :v 2})]
+    (->> resp
+         :content
+         second
+         :content
+         (map extract-book-data))))


remove dcompare hack

remove dcompare hack

--- test/linkification.clj
+++ test/linkification.clj
@@ -1,19 +1,6 @@
 (ns linkification
   (:use clojure.test
         [statuses.views.common :only [linkify]]))
-
-
-(defn dcompare [actual expected]
-  (cond (not= actual expected)
-    (str ; XXX: unecessary hack
-        (println actual)
-        (println "        ^")
-        (println "        |")
-        (println "---- actual vs. expected ----")
-        (println "                    |")
-        (println "                    v")
-        (println expected)))
-  (is (= actual expected)))

 (deftest linkify-basic []
   (is (= (linkify "lorem ipsum") "lorem ipsum")))
@@ -41,12 +28,12 @@
       "lipsum #hashtag")))

 (deftest linkify-uris-with-fragment-identifier []
-  (dcompare
+  (is (=
       (linkify "lorem http://example.org#anchor ipsum")
-      "lorem http://example.org#anchor ipsum"))
-  (dcompare
+      "lorem http://example.org#anchor ipsum")))
+  (is (=
       (linkify "#hashtag lipsum http://example.org#anchor-name")
-      "#hashtag lipsum http://example.org#anchor-name")
-  (dcompare
+      "#hashtag lipsum http://example.org#anchor-name"))
+  (is (=
       (linkify "lipsum http://example.org#anchor-name #hashtag")
-      "lipsum http://example.org#anchor-name #hashtag")
+      "lipsum http://example.org#anchor-name #hashtag"))


fix bugs

fix bugs

--- labs/architecture-examples/om/src/todomvc/item.cljs
+++ labs/architecture-examples/om/src/todomvc/item.cljs
@@ -1,6 +1,6 @@
 (ns todomvc.item
   (:require-macros [cljs.core.async.macros :refer [go]])
-  (:require [cljs.core.async :refer [>! <! put! alts!]]
+  (:require [cljs.core.async :refer [>! <! put!]]
             [todomvc.utils :refer [now]]
             [clojure.string :as string]
             [om.core :as om]
@@ -42,7 +42,7 @@
     (-render [_ owner]
       (let [m {:owner owner :chans chans}]
         (dom/li #js {:className (str (and completed "completed") " "
-                                  (and editing "editing"))}
+                                     (and editing "editing"))}
           (dom/div #js {:className "view"}
             (dom/input #js {:className "toggle"
                             :type "checkbox"
@@ -51,7 +51,7 @@
             (dom/label #js {:onDoubleClick #(handle-edit % todo owner)}
               (:title todo))
             (dom/button #js {:className "destroy"
-                             :onClick (fn [_] (put! (:delete chans) todo))})
+                             :onClick (fn [_] (put! (:destroy chans) todo))})
             (dom/input #js {:ref "editField"
                             :className "edit"
                             :value (:edit-text todo)


Tests: check if input is present before clear attempt

--- test/warehouse/selenium/test.clj
+++ test/warehouse/selenium/test.clj
@@ -182,6 +182,7 @@
   (wait-until #(present? "//li[@class='component']"))

   (click "//button[contains(text(), 'Edit')]")
+  (wait-until #(present? "//input[@name='name']"))
   (clear "//input[@name='name']")
   (input-text "//input[@name='name']" "wtf")
   (click "//button[contains(text(), 'Save')]")


Replace '#(do %)' with 'identity'

Replace '#(do %)' with 'identity'

--- src/cyanite_remover/path_store.clj
+++ src/cyanite_remover/path_store.clj
@@ -87,7 +87,7 @@
 (defn- search
   "Search for a path."
   [search-fn scroll-fn tenant leafs-only limit-depth path batch-size batch-rate]
-  (let [throttle-fn (utils/fn-or-trtlfn #(do %) batch-rate)
+  (let [throttle-fn (utils/fn-or-trtlfn identity batch-rate)
         query (build-query (build-filter tenant leafs-only limit-depth path))
         _ (log/trace (str "ES search query: " query))
         resp (search-fn :query query :size batch-size


update tests

update tests

--- test/metabase/driver/generic_sql/query_processor_test.clj
+++ test/metabase/driver/generic_sql/query_processor_test.clj
@@ -1,11 +1,11 @@
 (ns metabase.driver.generic-sql.query-processor-test
   (:require [clojure.math.numeric-tower :as math]
             [expectations :refer :all]
-            [metabase.driver.generic-sql.query-processor :refer :all]
+            [metabase.driver :as driver]
             [metabase.test-data :refer [db-id table->id field->id]]))

-(def venues-columns
-  (delay ["ID" "CATEGORY_ID" "PRICE" "LONGITUDE" "LATITUDE" "NAME"]))
+(def ^:const venues-columns
+  ["ID" "CATEGORY_ID" "PRICE" "LONGITUDE" "LATITUDE" "NAME"])

 (def venues-cols
   (delay [{:extra_info {} :special_type :id, :base_type :BigIntegerField, :description nil, :name "ID", :table_id (table->id :venues), :id (field->id :venues :id)}
@@ -26,13 +26,13 @@
                         :id nil
                         :table_id nil
                         :description nil}]}}
-        (process-and-run {:type :query
-                          :database @db-id
-                          :query {:source_table (table->id :venues)
-                                  :filter [nil nil]
-                                  :aggregation ["count"]
-                                  :breakout [nil]
-                                  :limit nil}}))
+  (driver/process-query {:type :query
+                         :database @db-id
+                         :query {:source_table (table->id :venues)
+                                 :filter [nil nil]
+                                 :aggregation ["count"]
+                                 :breakout [nil]
+                                 :limit nil}}))

 ;; ## "SUM" AGGREGATION
 (expect {:status :completed
@@ -45,13 +45,13 @@
                         :id nil
                         :table_id nil
                         :description nil}]}}
-        (process-and-run {:type :query
-                          :database @db-id
-                          :query {:source_table (table->id :venues)
-                                  :filter [nil nil]
-                                  :aggregation ["sum" (field->id :venues :price)]
-                                  :breakout [nil]
-                                  :limit nil}}))
+  (driver/process-query {:type :query
+                         :database @db-id
+                         :query {:source_table (table->id :venues)
+                                 :filter [nil nil]
+                                 :aggregation ["sum" (field->id :venues :price)]
+                                 :breakout [nil]
+                                 :limit nil}}))

 ;; ## "DISTINCT COUNT" AGGREGATION
 (expect {:status :completed
@@ -64,13 +64,13 @@
                         :id nil
                         :table_id nil
                         :description nil}]}}
-        (process-and-run {:type :query
-                          :database @db-id
-                          :query {:source_table (table->id :checkins)
-                                  :filter [nil nil]
-                                  :aggregation ["distinct" (field->id :checkins :user_id)]
-                                  :breakout [nil]
-                                  :limit nil}}))
+  (driver/process-query {:type :query
+                         :database @db-id
+                         :query {:source_table (table->id :checkins)
+                                 :filter [nil nil]
+                                 :aggregation ["distinct" (field->id :checkins :user_id)]
+                                 :breakout [nil]
+                                 :limit nil}}))

 ;; ## "AVG" AGGREGATION
 ;; TODO - try this with an integer field. (Should the average of an integer field be a float or an int?)
@@ -84,13 +84,13 @@
                         :id nil
                         :table_id nil
                         :description nil}]}}
-        (process-and-run {:type :query
-                          :database @db-id
-                          :query {:source_table (table->id :venues)
-                                  :filter [nil nil]
-                                  :aggregation ["avg" (field->id :venues :latitude)]
-                                  :breakout [nil]
-                                  :limit nil}}))
+  (driver/process-query {:type :query
+                         :database @db-id
+                         :query {:source_table (table->id :venues)
+                                 :filter [nil nil]
+                                 :aggregation ["avg" (field->id :venues :latitude)]
+                                 :breakout [nil]
+                                 :limit nil}}))

 ;; ## "STDDEV" AGGREGATION
 (expect {:status :completed
@@ -103,13 +103,13 @@
                         :id nil
                         :table_id nil
                         :description nil}]}}
-        (process-and-run {:type :query
-                          :database @db-id
-                          :query {:source_table (table->id :venues)
-                                  :filter [nil nil]
-                                  :aggregation ["stddev" (field->id :venues :latitude)]
-                                  :breakout [nil]
-                                  :limit nil}}))
+  (driver/process-query {:type :query
+                         :database @db-id
+                         :query {:source_table (table->id :venues)
+                                 :filter [nil nil]
+                                 :aggregation ["stddev" (field->id :venues :latitude)]
+                                 :breakout [nil]
+                                 :limit nil}}))

 ;; ## "ROWS" AGGREGATION
 ;; Test that a rows aggregation just returns rows as-is.
@@ -126,16 +126,16 @@
                  [8 11 2 -118.342 34.1015 "25°"]
                  [9 71 1 -118.301 34.1018 "Krua Siri"]
                  [10 20 2 -118.292 34.1046 "Fred 62"]]
-          :columns @venues-columns
+          :columns venues-columns
           :cols @venues-cols}}
-        (process-and-run {:type :query
-                          :database @db-id
-                          :query {:source_table (table->id :venues)
-                                  :filter nil
-                                  :aggregation ["rows"]
-                                  :breakout [nil]
-                                  :limit 10
-                                  :order_by [[(field->id :venues :id) "ascending"]]}}))
+  (driver/process-query {:type :query
+                         :database @db-id
+                         :query {:source_table (table->id :venues)
+                                 :filter nil
+                                 :aggregation ["rows"]
+                                 :breakout [nil]
+                                 :limit 10
+                                 :order_by [[(field->id :venues :id) "ascending"]]}}))

 ;; ## "PAGE" CLAUSE
 ;; Test that we can get "pages" of results.
@@ -151,13 +151,13 @@
                 :columns ["ID", "NAME"]
                 :cols [{:extra_info {} :special_type :id, :base_type :BigIntegerField, :description nil, :name "ID", :table_id (table->id :categories), :id (field->id :categories :id)}
                        {:extra_info {} :special_type nil, :base_type :TextField, :description nil, :name "NAME", :table_id (table->id :categories), :id (field->id :categories :name)}]}}
-  (process-and-run {:type :query
-                    :database @db-id
-                    :query {:source_table (table->id :categories)
-                            :aggregation ["rows"]
-                            :page {:items 5
-                                   :page 1}
-                            :order_by [[(field->id :categories :name) "ascending"]]}}))
+  (driver/process-query {:type :query
+                         :database @db-id
+                         :query {:source_table (table->id :categories)
+                                 :aggregation ["rows"]
+                                 :page {:items 5
+                                        :page 1}
+                                 :order_by [[(field->id :categories :name) "ascending"]]}}))

 ;; ### PAGE - Get the second page
 (expect {:status :completed
@@ -170,13 +170,13 @@
                 :columns ["ID", "NAME"]
                 :cols [{:extra_info {} :special_type :id, :base_type :BigIntegerField, :description nil, :name "ID", :table_id (table->id :categories), :id (field->id :categories :id)}
                        {:extra_info {} :special_type nil, :base_type :TextField, :description nil, :name "NAME", :table_id (table->id :categories), :id (field->id :categories :name)}]}}
-  (process-and-run {:type :query
-                    :database @db-id
-                    :query {:source_table (table->id :categories)
-                            :aggregation ["rows"]
-                            :page {:items 5
-                                   :page 2}
-                            :order_by [[(field->id :categories :name) "ascending"]]}}))
+  (driver/process-query {:type :query
+                         :database @db-id
+                         :query {:source_table (table->id :categories)
+                                 :aggregation ["rows"]
+                                 :page {:items 5
+                                        :page 2}
+                                 :order_by [[(field->id :categories :name) "ascending"]]}}))

 ;; ## "FIELDS" CLAUSE
 ;; Test that we can restrict the Fields that get returned to the ones specified, and that results come back in the order of the IDs in the `fields` clause
@@ -195,16 +195,16 @@
                 :columns ["NAME" "ID"],
                 :cols [{:extra_info {} :special_type nil, :base_type :TextField, :description nil, :name "NAME", :table_id (table->id :venues), :id (field->id :venues :name)}
                        {:extra_info {} :special_type :id, :base_type :BigIntegerField, :description nil, :name "ID", :table_id (table->id :venues), :id (field->id :venues :id)}]}}
-        (process-and-run {:type :query
-                          :database @db-id
-                          :query {:source_table (table->id :venues)
-                                  :filter [nil nil]
-                                  :aggregation ["rows"]
-                                  :fields [(field->id :venues :name)
-                                           (field->id :venues :id)]
-                                  :breakout [nil]
-                                  :limit 10
-                                  :order_by [[(field->id :venues :id) "ascending"]]}}))
+  (driver/process-query {:type :query
+                         :database @db-id
+                         :query {:source_table (table->id :venues)
+                                 :filter [nil nil]
+                                 :aggregation ["rows"]
+                                 :fields [(field->id :venues :name)
+                                          (field->id :venues :id)]
+                                 :breakout [nil]
+                                 :limit 10
+                                 :order_by [[(field->id :venues :id) "ascending"]]}}))

 ;; ## "ORDER_BY" CLAUSE
 ;; Test that we can tell the Query Processor to return results ordered by multiple fields
@@ -215,17 +215,17 @@
                 :cols [{:extra_info {:target_table_id (table->id :venues)} :special_type :fk, :base_type :IntegerField, :description nil, :name "VENUE_ID", :table_id (table->id :checkins), :id (field->id :checkins :venue_id)}
                        {:extra_info {:target_table_id (table->id :users)} :special_type :fk, :base_type :IntegerField, :description nil, :name "USER_ID", :table_id (table->id :checkins), :id (field->id :checkins :user_id)}
                        {:extra_info {} :special_type :id, :base_type :BigIntegerField, :description nil, :name "ID", :table_id (table->id :checkins), :id (field->id :checkins :id)}]}}
-        (process-and-run {:type :query
-                          :database @db-id
-                          :query {:source_table (table->id :checkins)
-                                  :aggregation ["rows"]
-                                  :limit 10
-                                  :fields [(field->id :checkins :venue_id)
-                                           (field->id :checkins :user_id)
-                                           (field->id :checkins :id)]
-                                  :order_by [[(field->id :checkins :venue_id) "ascending"]
-                                             [(field->id :checkins :user_id) "descending"]
-                                             [(field->id :checkins :id) "ascending"]]}}))
+  (driver/process-query {:type :query
+                         :database @db-id
+                         :query {:source_table (table->id :checkins)
+                                 :aggregation ["rows"]
+                                 :limit 10
+                                 :fields [(field->id :checkins :venue_id)
+                                          (field->id :checkins :user_id)
+                                          (field->id :checkins :id)]
+                                 :order_by [[(field->id :checkins :venue_id) "ascending"]
+                                            [(field->id :checkins :user_id) "descending"]
+                                            [(field->id :checkins :id) "ascending"]]}}))

 ;; ## "FILTER" CLAUSE

@@ -239,17 +239,17 @@
                  [77 40 4 -74.0045 40.7318 "Sushi Nakazawa"]
                  [79 40 4 -73.9736 40.7514 "Sushi Yasuda"]
                  [81 40 4 -73.9533 40.7677 "Tanoshi Sushi & Sake Bar"]]
-          :columns @venues-columns
+          :columns venues-columns
           :cols @venues-cols}}
-        (process-and-run {:type :query
-                          :database @db-id
-                          :query {:source_table (table->id :venues)
-                                  :filter ["AND"
-                                           [">" (field->id :venues :id) 50]
-                                           [">=" (field->id :venues :price) 4]]
-                                  :aggregation ["rows"]
-                                  :breakout [nil]
-                                  :limit nil}}))
+  (driver/process-query {:type :query
+                         :database @db-id
+                         :query {:source_table (table->id :venues)
+                                 :filter ["AND"
+                                          [">" (field->id :venues :id) 50]
+                                          [">=" (field->id :venues :price) 4]]
+                                 :aggregation ["rows"]
+                                 :breakout [nil]
+                                 :limit nil}}))

 ;; ### FILTER -- "AND", "<", ">", "!="
 (expect
@@ -257,18 +257,18 @@
      :row_count 2
      :data {:rows [[21 58 2 -122.421 37.7441 "PizzaHacker"]
                    [23 50 2 -122.42 37.765 "Taqueria Los Coyotes"]]
-            :columns @venues-columns
+            :columns venues-columns
             :cols @venues-cols}}
-  (process-and-run {:type :query
-                    :database @db-id
-                    :query {:source_table (table->id :venues)
-                            :filter ["AND"
-                                     ["<" (field->id :venues :id) 24]
-                                     [">" (field->id :venues :id) 20]
-                                     ["!=" (field->id :venues :id) 22]]
-                            :aggregation ["rows"]
-                            :breakout [nil]
-                            :limit nil}}))
+  (driver/process-query {:type :query
+                         :database @db-id
+                         :query {:source_table (table->id :venues)
+                                 :filter ["AND"
+                                          ["<" (field->id :venues :id) 24]
+                                          [">" (field->id :venues :id) 20]
+                                          ["!=" (field->id :venues :id) 22]]
+                                 :aggregation ["rows"]
+                                 :breakout [nil]
+                                 :limit nil}}))

 ;; ### FILTER -- "BETWEEN", single subclause (neither "AND" nor "OR")
 (expect
@@ -276,15 +276,15 @@
      :row_count 2
      :data {:rows [[21 58 2 -122.421 37.7441 "PizzaHacker"]
                    [22 50 1 -122.484 37.7822 "Gordo Taqueria"]]
-            :columns @venues-columns
+            :columns venues-columns
             :cols @venues-cols}}
-  (process-and-run {:type :query
-                    :database @db-id
-                    :query {:source_table (table->id :venues)
-                            :filter ["BETWEEN" (field->id :venues :id) 21 22]
-                            :aggregation ["rows"]
-                            :breakout [nil]
-                            :limit nil}}))
+  (driver/process-query {:type :query
+                         :database @db-id
+                         :query {:source_table (table->id :venues)
+                                 :filter ["BETWEEN" (field->id :venues :id) 21 22]
+                                 :aggregation ["rows"]
+                                 :breakout [nil]
+                                 :limit nil}}))

 ;; ### FILTER -- "OR", "<=", "="
 (expect
@@ -294,17 +294,17 @@
                    [2 11 2 -118.329 34.0996 "Stout Burgers & Beers"]
                    [3 11 2 -118.428 34.0406 "The Apple Pan"]
                    [5 20 2 -118.261 34.0778 "Brite Spot Family Restaurant"]]
-            :columns @venues-columns
+            :columns venues-columns
             :cols @venues-cols}}
-  (process-and-run {:type :query
-                    :database @db-id
-                    :query {:source_table (table->id :venues)
-                            :filter ["OR"
-                                     ["<=" (field->id :venues :id) 3]
-                                     ["=" (field->id :venues :id) 5]]
-                            :aggregation ["rows"]
-                            :breakout [nil]
-                            :limit nil}}))
+  (driver/process-query {:type :query
+                         :database @db-id
+                         :query {:source_table (table->id :venues)
+                                 :filter ["OR"
+                                          ["<=" (field->id :venues :id) 3]
+                                          ["=" (field->id :venues :id) 5]]
+                                 :aggregation ["rows"]
+                                 :breakout [nil]
+                                 :limit nil}}))

 ;; TODO - These are working, but it would be nice to have some tests that covered
 ;; *  NOT_NULL
@@ -313,24 +313,24 @@
 ;; ### FILTER -- "INSIDE"
 ;; TODO - add "NEAR"
 (expect
-  {:status :completed
-   :row_count 1
-   :data {:rows [[1 4 3 -165.374 10.0646 "Red Medicine"]]
-          :columns @venues-columns
-          :cols @venues-cols}}
-  (process-and-run {:type :query
-                    :database @db-id
-                    :query {:source_table (table->id :venues)
-                            :filter ["INSIDE"
-                                     (field->id :venues :latitude)
-                                     (field->id :venues :longitude)
-                                     10.0649
-                                     -165.379
-                                     10.0641
-                                     -165.371]
-                            :aggregation ["rows"]
-                            :breakout [nil]
-                            :limit nil}}))
+    {:status :completed
+     :row_count 1
+     :data {:rows [[1 4 3 -165.374 10.0646 "Red Medicine"]]
+            :columns venues-columns
+            :cols @venues-cols}}
+  (driver/process-query {:type :query
+                         :database @db-id
+                         :query {:source_table (table->id :venues)
+                                 :filter ["INSIDE"
+                                          (field->id :venues :latitude)
+                                          (field->id :venues :longitude)
+                                          10.0649
+                                          -165.379
+                                          10.0641
+                                          -165.371]
+                                 :aggregation ["rows"]
+                                 :breakout [nil]
+                                 :limit nil}}))

 ;; ## "BREAKOUT"
 ;; ### "BREAKOUT" - SINGLE COLUMN
@@ -340,14 +340,14 @@
                 :columns ["USER_ID" "count"],
                 :cols [{:extra_info {:target_table_id (table->id :users)} :special_type :fk, :base_type :IntegerField, :description nil, :name "USER_ID", :table_id (table->id :checkins) :id (field->id :checkins :user_id)}
                        {:base_type :IntegerField, :special_type :number, :name "count", :id nil, :table_id nil, :description nil}]}}
-        (process-and-run {:type :query
-                          :database @db-id
-                          :query {:source_table (table->id :checkins)
-                                  :filter [nil nil]
-                                  :aggregation ["count"]
-                                  :breakout [(field->id :checkins :user_id)]
-                                  :order_by [[(field->id :checkins :user_id) "ascending"]]
-                                  :limit nil}}))
+  (driver/process-query {:type :query
+                         :database @db-id
+                         :query {:source_table (table->id :checkins)
+                                 :filter [nil nil]
+                                 :aggregation ["count"]
+                                 :breakout [(field->id :checkins :user_id)]
+                                 :order_by [[(field->id :checkins :user_id) "ascending"]]
+                                 :limit nil}}))

 ;; ### "BREAKOUT" - MULTIPLE COLUMNS W/ IMPLICT "ORDER_BY"
 ;; Fields should be implicitly ordered :ASC for all the fields in `breakout` that are not specified in `order_by`
@@ -358,13 +358,13 @@
                 :cols [{:extra_info {:target_table_id (table->id :users)} :special_type :fk, :base_type :IntegerField, :description nil, :name "USER_ID", :table_id (table->id :checkins), :id (field->id :checkins :user_id)}
                        {:extra_info {:target_table_id (table->id :venues)} :special_type :fk, :base_type :IntegerField, :description nil, :name "VENUE_ID", :table_id (table->id :checkins), :id (field->id :checkins :venue_id)}
                        {:base_type :IntegerField, :special_type :number, :name "count", :id nil, :table_id nil, :description nil}]}}
-        (process-and-run {:type :query
-                          :database @db-id
-                          :query {:source_table (table->id :checkins)
-                                  :limit 10
-                                  :aggregation ["count"]
-                                  :breakout [(field->id :checkins :user_id)
-                                             (field->id :checkins :venue_id)]}}))
+  (driver/process-query {:type :query
+                         :database @db-id
+                         :query {:source_table (table->id :checkins)
+                                 :limit 10
+                                 :aggregation ["count"]
+                                 :breakout [(field->id :checkins :user_id)
+                                            (field->id :checkins :venue_id)]}}))

 ;; ### "BREAKOUT" - MULTIPLE COLUMNS W/ EXPLICIT "ORDER_BY"
 ;; `breakout` should not implicitly order by any fields specified in `order_by`
@@ -375,27 +375,27 @@
                 :cols [{:extra_info {:target_table_id (table->id :users)} :special_type :fk, :base_type :IntegerField, :description nil, :name "USER_ID", :table_id (table->id :checkins), :id (field->id :checkins :user_id)}
                        {:extra_info {:target_table_id (table->id :venues)} :special_type :fk, :base_type :IntegerField, :description nil, :name "VENUE_ID", :table_id (table->id :checkins), :id (field->id :checkins :venue_id)}
                        {:base_type :IntegerField, :special_type :number, :name "count", :id nil, :table_id nil, :description nil}]}}
-        (process-and-run {:type :query
-                          :database @db-id
-                          :query {:source_table (table->id :checkins)
-                                  :limit 10
-                                  :aggregation ["count"]
-                                  :breakout [(field->id :checkins :user_id)
-                                             (field->id :checkins :venue_id)]
-                                  :order_by [[(field->id :checkins :user_id) "descending"]
-                                             [(field->id :checkins :venue_id) "ascending"]]}}))
+  (driver/process-query {:type :query
+                         :database @db-id
+                         :query {:source_table (table->id :checkins)
+                                 :limit 10
+                                 :aggregation ["count"]
+                                 :breakout [(field->id :checkins :user_id)
+                                            (field->id :checkins :venue_id)]
+                                 :order_by [[(field->id :checkins :user_id) "descending"]
+                                            [(field->id :checkins :venue_id) "ascending"]]}}))

 ;; ## EMPTY QUERY
 ;; Just don't barf
 (expect {:status :completed, :row_count 0, :data {:rows [], :columns [], :cols []}}
-        (process-and-run {:type :query
-                          :database @db-id
-                          :native {}
-                          :query {:source_table 0
-                                  :filter [nil nil]
-                                  :aggregation ["rows"]
-                                  :breakout [nil]
-                                  :limit nil}}))
+  (driver/process-query {:type :query
+                         :database @db-id
+                         :native {}
+                         :query {:source_table 0
+                                 :filter [nil nil]
+                                 :aggregation ["rows"]
+                                 :breakout [nil]
+                                 :limit nil}}))

 ;; # POST PROCESSING TESTS
@@ -408,13 +408,13 @@
          :data {:rows [[1] [3] [6] [10] [15] [21] [28] [36] [45] [55] [66] [78] [91] [105] [120]]
                 :columns ["ID"]
                 :cols [{:extra_info {} :special_type :id, :base_type :BigIntegerField, :description nil, :name "ID", :table_id (table->id :users), :id (field->id :users :id)}]}}
-  (process-and-run {:type :query
-                    :database @db-id
-                    :query {:limit nil
-                            :source_table (table->id :users)
-                            :filter [nil nil]
-                            :breakout [nil]
-                            :aggregation ["cum_sum" (field->id :users :id)]}}))
+  (driver/process-query {:type :query
+                         :database @db-id
+                         :query {:limit nil
+                                 :source_table (table->id :users)
+                                 :filter [nil nil]
+                                 :breakout [nil]
+                                 :aggregation ["cum_sum" (field->id :users :id)]}}))

 ;; ### Cumulative sum w/ a breakout field
 (expect {:status :completed
@@ -423,13 +423,13 @@
                 :columns ["CAST(LAST_LOGIN AS DATE)" "ID"]
                 :cols [{:extra_info {} :special_type :category :base_type :DateTimeField, :description nil, :name "LAST_LOGIN", :table_id (table->id :users), :id (field->id :users :last_login)}
                        {:extra_info {} :special_type :id, :base_type :BigIntegerField, :description nil, :name "ID", :table_id (table->id :users), :id (field->id :users :id)}]}}
-  (-> (process-and-run {:type :query
-                        :database @db-id
-                        :query {:limit nil
-                                :source_table (table->id :users)
-                                :filter [nil nil]
-                                :breakout [(field->id :users :last_login)]
-                                :aggregation ["cum_sum" (field->id :users :id)]}})
+  (-> (driver/process-query {:type :query
+                             :database @db-id
+                             :query {:limit nil
+                                     :source_table (table->id :users)
+                                     :filter [nil nil]
+                                     :breakout [(field->id :users :last_login)]
+                                     :aggregation ["cum_sum" (field->id :users :id)]}})
       ;; Rows come back like `[value timestamp]` but it is hard to compare timestamps directly since the values that come back are casted
       ;; to Dates and the exact value depends on the locale of the machine running the tests. So just drop the timestamps from the results.
       (update-in [:data :rows] (partial map last))))
@@ -441,10 +441,10 @@
 (expect
     {:status :failed
      :error "Column \"CHECKINS.NAME\" not found; SQL statement:\nSELECT \"CHECKINS\".* FROM \"CHECKINS\" WHERE (\"CHECKINS\".\"NAME\" = ?)"}
-  (process-and-run {:database @db-id
-                    :type :query
-                    :query {:source_table (table->id :checkins)
-                            :filter ["=" (field->id :venues :name) 1] ; wrong Field
-                            :aggregation ["rows"]
-                            :breakout [nil]
-                            :limit nil}}))
+  (driver/process-query {:database @db-id
+                         :type :query
+                         :query {:source_table (table->id :checkins)
+                                 :filter ["=" (field->id :venues :name) 1] ; wrong Field
+                                 :aggregation ["rows"]
+                                 :breakout [nil]
+                                 :limit nil}}))


add docker content to homepage

add docker content to homepage


more tests

more tests

--- test/babel/test/fr.clj
+++ test/babel/test/fr.clj
@@ -1,4 +1,5 @@
-(ns babel.test.fr
+(ns ^{:doc "French Testing Code"}
+    babel.test.fr
   (:refer-clojure :exclude [get-in])
   (:require [babel.engine :as engine]
             [babel.forest :as forest]
@@ -56,11 +57,15 @@
     (and (is (not (empty? result)))
          (is (= (get-in (first result) [:rule]) "vp-aux")))))

-(def vp-aux (first (filter #(= (:rule %) "vp-aux")
-                           (:grammar @small))))
+(deftest vp-aux-test
+  (let [rule (first (filter #(= (:rule %) "vp-aux")
+                            (:grammar @small)))]
+    ))

-(def etre (first (filter #(= true (get-in % [:synsem :aux]))
-                         (get (:lexicon @small) "être"))))
+(def etre-test
+  (first (filter #(= true (get-in % [:synsem :aux]))
+                 (get (:lexicon @small) "être"))))
+
 (deftest over-test
   (let [lexicon (:lexicon @small)
         grammar (:grammar @small)


[scamp] bump to clojure 1.9.0-alpha14

[scamp] bump to clojure 1.9.0-alpha14

--- modules/scamp/project.clj
+++ modules/scamp/project.clj
@@ -3,6 +3,6 @@
   :url "http://example.com/FIXME"
   :license {:name "Eclipse Public License"
             :url "http://www.eclipse.org/legal/epl-v10.html"}
-  :dependencies [[org.clojure/clojure "1.8.0"]
+  :dependencies [[org.clojure/clojure "1.9.0-alpha14"]
                  [com.taoensso/timbre "4.3.1"]
                  [prismatic/schema "1.1.1"]])


More tests

More tests

--- test/io/perun_test.clj
+++ test/io/perun_test.clj
@@ -2,6 +2,7 @@
   (:require [boot.core :as boot :refer [deftask]]
             [boot.test :as boot-test :refer [deftesttask]]
             [clojure.java.io :as io]
+            [clojure.string :as str]
             [clojure.test :refer [deftest testing is]]
             [io.perun :as p]
             [io.perun.meta :as pm])
@@ -102,7 +103,7 @@
 ---
 # Hello there

-This be ___markdown___.")
+This --- be ___markdown___.")

 (def js-content "(function somejs() { console.log('foo'); })();")

@@ -125,7 +126,7 @@
         (p/markdown)
         (testing "markdown"
           (value-test :path "2017-01-01-test.md"
-                      :value-fn #(meta= % :content "
Hello there
\n
This be markdown.
")
+                      :value-fn #(meta= % :content "
Hello there
\n
This --- be markdown.
")
                       :msg "`markdown` should set `:content` metadata on markdown file"))

         (p/ttr)
@@ -137,7 +138,7 @@
         (p/word-count)
         (testing "word-count"
           (value-test :path "2017-01-01-test.md"
-                      :value-fn #(meta= % :word-count 7)
+                      :value-fn #(meta= % :word-count 8)
                       :msg "`word-count` should set `:word-count` metadata"))

         (p/gravatar :source-key :email :target-key :gravatar)
@@ -201,3 +202,106 @@
           (file-exists? :path "2017-01-01-test.md"
                         :negate? true
                         :msg "`draft` should remove files"))))
+
+(deftesttask with-arguments-test []
+  (comp (add-txt-file :path "test.md" :content md-content)
+        (boot/with-pre-wrap fileset
+          (pm/set-global-meta fileset {:base-url "http://example.com/"
+                                       :site-title "Test Title"
+                                       :description "Test Desc"}))
+        (p/markdown :meta {:markdown-set :metadata} :options {:extensions {:smarts true}})
+        (testing "markdown"
+          (value-test :path "test.md"
+                      :value-fn #(meta= % :content "
Hello there
\n
This — be markdown.
")
+                      :msg "`markdown` should set `:content` metadata on markdown file"))
+
+        (p/ttr :filterer :markdown-set)
+        (testing "ttr"
+          (value-test :path "test.md"
+                      :value-fn #(meta= % :ttr 1)
+                      :msg "`ttr` should set `:ttr` metadata"))
+
+        (p/word-count :filterer :markdown-set)
+        (testing "word-count"
+          (value-test :path "test.md"
+                      :value-fn #(meta= % :word-count 8)
+                      :msg "`word-count` should set `:word-count` metadata"))
+
+        (p/gravatar :source-key :email :target-key :gravatar :filterer :markdown-set)
+        (testing "gravatar"
+          (value-test :path "test.md"
+                      :value-fn
+                      #(meta= % :gravatar "http://www.gravatar.com/avatar/a1a361f6c96acb1e31ad4b3bbf7aa444")
+                      :msg "`gravatar` should set `:gravatar` metadata"))
+
+        (p/build-date :filterer :markdown-set)
+        (testing "build-date"
+          (key-test :path "test.md"
+                    :key :date-build
+                    :msg "`build-date` should set `:date-build` metadata"))
+
+        (p/slug :filterer :markdown-set :slug-fn (fn [filename] (->> (str/split filename #"\.")
+                                                                     drop-last
+                                                                     str/join
+                                                                     str/lower-case)))
+
+        (testing "slug"
+          (value-test :path "test.md"
+                      :value-fn #(meta= % :slug "test")
+                      :msg "`slug` should set `:slug` metadata"))
+
+        (p/permalink :filterer :markdown-set :permalink-fn (fn [_] "/foo.html"))
+        (testing "permalink"
+          (value-test :path "test.md"
+                      :value-fn #(meta= % :permalink "/foo.html")
+                      :msg "`permalink` should set `:permalink` metadata"))
+
+        (p/canonical-url :filterer :markdown-set)
+        (testing "canonical-url"
+          (value-test :path "test.md"
+                      :value-fn #(meta= % :canonical-url "http://example.com/foo.html")
+                      :msg "`canonical-url` should set `:canonical-url` metadata"))
+
+        (p/sitemap :filterer :markdown-set :filename "test.xml" :out-dir "foo" :url "http://bar.com/")
+        (testing "sitemap"
+          (file-exists? :path "foo/test.xml"
+                        :msg "`sitemap` should write test.xml"))
+
+        (p/rss :filterer :markdown-set
+               :filename "test.rss"
+               :out-dir "foo"
+               :base-url "http://bar.com/"
+               :site-title "Test Site"
+               :description "Here we go a-testing")
+        (testing "rss"
+          (file-exists? :path "foo/test.rss"
+                        :msg "`rss` should write test.rss"))
+
+        (p/atom-feed :filterer :markdown-set
+                     :filename "test-atom.xml"
+                     :out-dir "foo"
+                     :base-url "http://bar.com/"
+                     :site-title "Test Site"
+                     :subtitle "Sub-test"
+                     :description "Here we go a-testing")
+        (testing "atom-feed"
+          (file-exists? :path "foo/test-atom.xml"
+                        :msg "`atom-feed` should write test-atom.xml"))
+
+        (p/render :renderer 'io.perun-test/render
+                  :filterer :markdown-set
+                  :out-dir "bar"
+                  :meta {:set-by-render true})
+
+        (add-txt-file :path "test.js" :content js-content)
+        (add-txt-file :path "baz.html" :content "")
+        (p/inject-scripts :scripts #{"test.js"} :filter #{#"foo"})
+        (p/inject-scripts :scripts #{"test.js"} :remove #{#"baz"})
+        (testing "inject-scripts"
+          (boot/with-pass-thru fileset
+            (is (.contains (slurp (boot/tmp-file (boot/tmp-get fileset "bar/foo.html")))
+                           (str ""))
+                "`inject-scripts` should alter the contents of an included file")
+            (is (not (.contains (slurp (boot/tmp-file (boot/tmp-get fileset "baz.html")))
+                                (str "")))
+                "`inject-scripts` should not alter the contents of a removed file")))))


cleanup showkr.data

cleanup showkr.data

--- src/showkr/data.cljs
+++ src/showkr/data.cljs
@@ -15,9 +15,21 @@
 (defn- flickr-error [payload]
   (js/console.error "Error fetching data with parameters:" payload))

-(defn call-flickr [payload callback]
+(defn flickr-call [payload callback]
   (let [q (Jsonp. URL "jsoncallback")]
     (.send q (clj->js (merge OPTS payload)) callback flickr-error)))
+
+(defn flickr-fetch [path attr payload & [cb]]
+  (when-not (get-in @world path)
+    (swap! world assoc-in path ^{:state :waiting} {})
+    (flickr-call payload
+      (fn [data]
+        (let [data (js->clj data :keywordize-keys true)]
+          (swap! world assoc-in path
+            (condp = (:stat data)
+              "ok"   (with-meta (attr data) {:state :fetched})
+              "fail" (with-meta data {:state :failed})))
+          (when cb (cb)))))))

 (defn fetched? [data]
   (= :fetched (:state (meta data))))
@@ -25,53 +37,29 @@
 ;;; A-la flux or something, call it and data will appear

 (defn fetch-set [id]
-  (when-not (get-in @world [:data :sets id])
-    (swap! world assoc-in [:data :sets id]
-      ^{:state :waiting} {})
-    (call-flickr {:method "flickr.photosets.getPhotos"
-                  :photoset_id id
-                  :extras "original_format,description,path_alias"}
-      (fn [data]
-        (swap! world assoc-in [:data :sets id]
-          (with-meta (js->clj (aget data "photoset") :keywordize-keys true)
-            {:state :fetched}))))))
+  (flickr-fetch [:data :sets id] :photoset
+    {:method "flickr.photosets.getPhotos"
+     :photoset_id id
+     :extras "original_format,description,path_alias"}))

 (defn fetch-comments [set-id idx]
-  (let [photo (get-in @world [:data :sets set-id :photo idx])]
-    (when (and photo (not (:comments photo)))
-      (swap! world assoc-in [:data :sets set-id :photo idx :comments]
-        ^{:state :waiting} {})
-      (call-flickr {:method "flickr.photos.comments.getList"
-                    :photo_id (:id photo)}
-        (fn [data]
-          (swap! world assoc-in [:data :sets set-id :photo idx :comments]
-            (with-meta (js->clj (aget data "comments") :keywordize-keys true)
-              {:state :fetched})))))))
+  (when (fetched? (get-in @world [:data :sets set-id]))
+    (flickr-fetch [:data :sets set-id :photo idx :comments] :comments
+      {:method "flickr.photos.comments.getList"
+       :photo_id (get-in @world [:data :sets set-id :photo idx :id])})))

 (defn fetch-user-sets [username]
   (let [user (get-in @world [:data :users username])]
-    (when (and (fetched? user) (not (:sets user)))
-      (swap! world assoc-in [:data :users username :sets]
-        ^{:state :waiting} {})
-      (call-flickr {:method "flickr.photosets.getList"
-                    :user_id (:id user)}
-        (fn [data]
-          (swap! world assoc-in [:data :users username :sets]
-            (with-meta (js->clj (aget data "photosets") :keywordize-keys true)
-              {:state :fetched})))))))
+    (when (fetched? user)
+      (flickr-fetch [:data :users username :sets] :photosets
+        {:method "flickr.photosets.getList"
+         :user_id (:id user)}))))

 (defn fetch-user [username]
-  (when-not (get-in @world [:data :users username])
-    (swap! world assoc-in [:data :users username]
-      ^{:state :waiting} {})
-    (call-flickr {:method "flickr.urls.lookupUser"
-                  :url (str "https://flickr.com/photos/" username)}
-      (fn [data]
-        (swap! world assoc-in [:data :users username]
-          (with-meta (js->clj (aget data "user") :keywordize-keys true)
-            {:state :fetched}))
-        (fetch-user-sets username)
-        #_ (fetch-user-info username)))))
+  (flickr-fetch [:data :users username] :user
+    {:method "flickr.urls.lookupUser"
+     :url (str "https://flickr.com/photos/" username)}
+    #(fetch-user-sets username)))

 ;;; not sure this is the right place


test for x86_64 rather than Darwin

test for x86_64 rather than Darwin

--- config/software/spidermonkey.clj
+++ config/software/spidermonkey.clj
@@ -22,7 +22,7 @@
        {:command "make" :args ["BUILD_OPT=1" "JS_DIST=/opt/opscode/embedded" "-f" "Makefile.ref" "export"]}]
       steps
       (cond
-       (is-os? "darwin")
+       (is-machine? "x86_64")
        (concat
         initial-steps
         [{:command "mv" :args ["/opt/opscode/embedded/lib64/libjs.a" "/opt/opscode/embedded/lib"]}


Added some weather related localizations.

--- app/src/weather/localization.cljc
+++ app/src/weather/localization.cljc
@@ -1,7 +1,14 @@
 (ns weather.localization)

 (def dictionary {:title "Weather with Clojure from Wunderground!"
-                 :submit "Show me the weather!"})
+                 :submit "Show me the weather!"
+                 :data-arrived "Here is the weather data you wanted:"
+                 :fog "There was some fog!"
+                 :rain "It rained..."
+                 :snow "It snowed!"
+                 :hail "It hailed!"
+                 :highest "Highest temp: "
+                 :lowest "Lowest temp: "})

 (defn tr
   [key]


+println diagnostic while loading model

+println diagnostic while loading model

--- src/babel/english.cljc
+++ src/babel/english.cljc
@@ -20,7 +20,7 @@
            (realized? medium-model))
     @medium-model
     @(do
-       (print (str "creating model..(will be slow the first time).."))
+       (println (str "creating model..(will be slow the first time).."))
        (let [result (deliver medium-model (grammar/medium))]
          (println (str "done."))
          result))))


fix test: forest/generate now needs another parameter: a morphological function to realize feature structures as strings

--- src/babel/italiano.clj
+++ src/babel/italiano.clj
@@ -69,7 +69,8 @@
     (forest/generate spec
                      (:grammar model)
                      (:lexicon model)
-                     (:index model))))
+                     (:index model)
+                     fo)))

 ;; TODO: factor out to forest/.
 (defn generate-all [ & [spec {use-grammar :grammar


Four tests for function string/replaceAll

--- test/zg/utils_test.clj
+++ test/zg/utils_test.clj
@@ -271,3 +271,34 @@
         (is (thrown? NullPointerException (endsWith "text" nil)))
         (is (thrown? NullPointerException (endsWith nil "text")))))

+(deftest test-replaceAll-1
+    "Check the function zg.utils/replaceAll."
+    (testing "the function zg.utils/replaceAll."
+        (are [x y] (= x y)
+            ""    (replaceAll "" "" "")
+            "b"   (replaceAll "a" "a" "b")
+            "bb"  (replaceAll "aa" "a" "b")
+            "bcb" (replaceAll "aca" "a" "b"))))
+
+(deftest test-replaceAll-2
+    "Check the function zg.utils/replaceAll."
+    (testing "the function zg.utils/replaceAll."
+        (are [x y] (= x y)
+            "b"     (replaceAll "aa" "aa" "b")
+            "bb"    (replaceAll "aaaa" "aa" "b")
+            "xbbx"  (replaceAll "xaaaax" "aa" "b")
+            "xbxbx" (replaceAll "xaaxaax" "aa" "b"))))
+
+(deftest test-replaceAll-not-NPE
+    "Check the function zg.utils/replaceAll."
+    (testing "the function zg.utils/replaceAll."
+        (is (= "a" (replaceAll "a" "b" nil)))))
+
+(deftest test-replaceAll-NPE
+    "Check the function zg.utils/replaceAll."
+    (testing "the function zg.utils/replaceAll."
+        (is (thrown? NullPointerException (replaceAll nil "a" "b")))
+        (is (thrown? NullPointerException (replaceAll "a" nil "b")))
+        (is (thrown? NullPointerException (replaceAll "a" "a" nil)))
+        (is (thrown? NullPointerException (replaceAll nil nil "b")))))
+


Handle nil :trial_end times (mostly for ease of testing.)

--- frontend/models/plan.cljs
+++ frontend/models/plan.cljs
@@ -44,10 +44,11 @@
   [plan]
   (let [trial-end (time-format/parse (:trial_end plan))
         now (time/now)]
-    (if (time/after? trial-end now)
-      ;; count partial days as a full day
-      (inc (time/in-days (time/interval now trial-end)))
-      (- (time/in-days (time/interval trial-end now))))))
+    (when (not (nil? trial-end))
+      (if (time/after? trial-end now)
+        ;; count partial days as a full day
+        (inc (time/in-days (time/interval now trial-end)))
+        (- (time/in-days (time/interval trial-end now)))))))

 (defn pretty-trial-time [plan]
   (let [trial-interval (time/interval (time/now) (time-format/parse (:trial_end plan)))


Make the empty byte array a constant too

--- src/caesium/crypto/generichash.clj
+++ src/caesium/crypto/generichash.clj
@@ -1,6 +1,7 @@
 (ns caesium.crypto.generichash
   (:import (org.abstractj.kalium.crypto Hash)))

+(def ^:private empty-byte-array (byte-array 0))
 (def ^:private sixteen-nuls (byte-array 16))

 (defn blake2b
@@ -11,5 +12,5 @@
   ([message & {salt :salt key :key personal :personal
                :or {salt sixteen-nuls
                     personal sixteen-nuls
-                    key (byte-array 0)}}]
+                    key empty-byte-array}}]
      (.blake2 (new Hash) message key salt personal)))


add generate boot task

add generate boot task

--- ssclj/jar/build.boot
+++ ssclj/jar/build.boot
@@ -11,8 +11,7 @@
                   [sixsq/build-utils "0.1.4" :scope "test"]])

 (require '[sixsq.build-fns :refer [merge-defaults
-                                   sixsq-nexus-url
-                                   lein-generate]])
+                                   sixsq-nexus-url]])

 (set-env!
   :repositories
@@ -67,8 +66,9 @@
                    [boot-environ]
                    [adzerk/boot-test]
                    [adzerk/boot-reload]
-                   [tolitius/boot-check]]))))
-
+                   [tolitius/boot-check]
+                   [onetom/boot-lein-generate]]))))
+
 (require
   '[environ.boot :refer [environ]]
   '[adzerk.boot-test :refer [test]]
@@ -76,7 +76,8 @@
   '[tolitius.boot-check :refer [with-yagni
                                 with-eastwood
                                 with-kibit
-                                with-bikeshed]])
+                                with-bikeshed]]
+  '[boot.lein :refer [generate]])

 (set-env!
   :resource-paths #{"src" "resources"})


missing doto

missing doto

--- src/main/cljs/cljs/source_map.cljs
+++ src/main/cljs/cljs/source_map.cljs
@@ -249,7 +249,7 @@
                                      (map (set/map-invert @names->idx)
                                        (range (count @names->idx))))}
             (:sources-content opts)
-            (gobj/set "sourcesContent" (:sources-content opts)))]
+            (doto (gobj/set "sourcesContent" (:sources-content opts))))]
       (.stringify js/JSON source-map-file-contents))))

 ;; -----------------------------------------------------------------------------


Separate out filter-examples, add default-plan

--- src/main/clojure/lazytest/plan.clj
+++ src/main/clojure/lazytest/plan.clj
@@ -47,7 +47,7 @@
 	 (keyword? t)]}
   (contains? (:tags (meta x)) t))

-(defn flat-plan
+(defn filter-examples
   "Returns a flat sequence of RunnableExamples for all examples in Groups gs.
   Examples are filtered by the following options:

@@ -56,14 +56,29 @@
      :exclude [tags]
         Every example must NOT have any of the tags.
   "
-  [gs & options]
-  {:pre [(coll? gs)]}
+  [examples & options]
+  {:pre [(coll? examples)
+	 (every? example? examples)]}
   (let [{:keys [tags exclude]} options]
-    (let [examples (mapcat flatten-group gs)]
-      (filter (fn [ex]
-		(and (not-any? #(has-tag? ex %) exclude)
-		     (every? #(has-tag? ex %) tags)))
-	      examples))))
+    (filter (fn [ex]
+	      (and (not-any? #(has-tag? ex %) exclude)
+		   (every? #(has-tag? ex %) tags)))
+	    examples)))
+
+(defn flat-plan [groups]
+  (mapcat flatten-group groups))
+
+(defn default-filter [examples]
+  (let [examples (filter-examples examples :exclude [:skip])
+	focused (filter-examples examples :tags [:focus])]
+    (if (seq focused) focused examples)))
+
+(defn default-plan
+  "Returns the default test plan.  Examples/groups wth tag :skip are
+  omitted.  If any groups/examples have the tag :focus then only those
+  groups/examples will run."
+  []
+  (default-filter (flat-plan (all-groups))))

 ;;; self-tests


Turn down jclouds log verbosity

Turn down jclouds log verbosity

--- src/circle/logging.clj
+++ src/circle/logging.clj
@@ -9,6 +9,9 @@
   (:import (org.apache.log4j.rolling TimeBasedRollingPolicy
                                      RollingFileAppender))
   (:import org.apache.commons.logging.LogFactory))
+
+(defn set-level [logger level]
+  (. (Logger/getLogger logger) (setLevel level)))

 (defn init []
   (let [rolling-policy (doto (TimeBasedRollingPolicy.)
@@ -24,4 +27,7 @@
       (.removeAllAppenders)
       (.addAppender rolling-log-appender)
       (.addAppender (ConsoleAppender. layout))))
-  (. (Logger/getRootLogger) (setLevel Level/DEBUG)))
+  (. (Logger/getRootLogger) (setLevel Level/DEBUG))
+  (set-level "jclouds.wire" Level/OFF)
+  (set-level "jclouds.headers" Level/OFF)
+  (set-level "jclouds.signature" Level/OFF))


fix failing tests

fix failing tests

--- backend/test/lambdaui/api_test.clj
+++ backend/test/lambdaui/api_test.clj
@@ -52,6 +52,8 @@
                                   :state     running-status
                                   :name      "do-stuff"
                                   :startTime "2016-01-01T12:00:00.000Z"
+                                  :type :step
+                                  :steps []
                                   :endTime   nil}]}
                       (subject/build-details-from-pipeline foo-pipeline (foo-pipeline-build-state running-status) buildId)))))))
   (testing "that it returns build details of a finished step"
@@ -61,6 +63,8 @@
                        :steps   [{:stepId    "1"
                                   :state     finished-status
                                   :name      "do-stuff"
+                                  :type :step
+                                  :steps []
                                   :startTime "2016-01-01T12:00:00.000Z"
                                   :endTime   "2016-01-01T14:00:00.000Z"}]}
                       (subject/build-details-from-pipeline foo-pipeline (foo-pipeline-build-state finished-status) buildId)))))))
@@ -75,6 +79,8 @@
                          :type      :container
                          :steps     [{:stepId    "1-1"
                                       :state     :running
+                                      :type :step
+                                      :steps []
                                       :name      "do-stuff"
                                       :startTime "2016-01-01T12:00:00.000Z"
                                       :endTime   nil}
@@ -82,6 +88,8 @@
                                      {:stepId    "2-1"
                                       :state     :pending
                                       :name      "do-stuff"
+                                      :type :step
+                                      :steps []
                                       :startTime nil
                                       :endTime   nil}]}]} (subject/build-details-from-pipeline pipeline-with-substeps pipeline-with-substeps-state buildId)))))

@@ -96,6 +104,8 @@
                          :endTime   nil
                          :steps     [{:stepId    "1-1"
                                       :state     :running
+                                      :type :step
+                                      :steps []
                                       :name      "do-stuff"
                                       :startTime "2016-01-01T12:00:00.000Z"
                                       :endTime   nil}
@@ -103,6 +113,8 @@
                                      {:stepId    "2-1"
                                       :state     :pending
                                       :name      "do-stuff"
+                                      :type :step
+                                      :steps []
                                       :startTime nil
                                       :endTime   nil}]}]} (subject/build-details-from-pipeline pipeline-with-substeps-parallel pipeline-with-substeps-state buildId))))))

@@ -185,12 +197,16 @@
                            :steps     [{:stepId    "1-1"
                                         :state     "pending"
                                         :name      "do-stuff"
+                                        :type "step"
+                                        :steps []
                                         :startTime nil
                                         :endTime   nil}

                                        {:stepId    "2-1"
                                         :state     "pending"
                                         :name      "do-stuff"
+                                        :type "step"
+                                        :steps []
                                         :startTime nil
                                         :endTime   nil}]}]}


Fix indentation of fn in search.clj

Fix indentation of fn in search.clj

--- src/clojars/search.clj
+++ src/clojars/search.clj
@@ -159,31 +159,31 @@
            (catch Exception e query)))))

 ; http://stackoverflow.com/questions/963781/how-to-achieve-pagination-in-lucene
-  (defn -search [stats index query page]
-    (if (empty? query)
-      []
-      (binding [clucy/*analyzer* analyzer]
-        (with-open [searcher (IndexSearcher. index)]
-          (let [per-page 24
-                offset (* per-page (- page 1))
-                parser (QueryParser. clucy/*version*
-                                     "_content"
-                                     clucy/*analyzer*)
-                query  (.parse parser (replace-time-range query))
-                query  (CustomScoreQuery. query (download-values stats))
-                hits   (.search searcher query (* per-page page))
-                highlighter (#'clucy/make-highlighter query searcher nil)]
-            (doall
-             (let [dhits (take per-page (drop offset (.scoreDocs hits)))]
-               (with-meta (for [hit dhits]
-                            (#'clucy/document->map
-                             (.doc searcher (.doc hit))
-                             (.score hit)
-                             highlighter))
-                 {:total-hits (.totalHits hits)
-                  :max-score (.getMaxScore hits)
-                  :results-per-page per-page
-                  :offset offset}))))))))
+(defn -search [stats index query page]
+  (if (empty? query)
+    []
+    (binding [clucy/*analyzer* analyzer]
+      (with-open [searcher (IndexSearcher. index)]
+        (let [per-page 24
+              offset (* per-page (- page 1))
+              parser (QueryParser. clucy/*version*
+                                   "_content"
+                                   clucy/*analyzer*)
+              query  (.parse parser (replace-time-range query))
+              query  (CustomScoreQuery. query (download-values stats))
+              hits   (.search searcher query (* per-page page))
+              highlighter (#'clucy/make-highlighter query searcher nil)]
+          (doall
+           (let [dhits (take per-page (drop offset (.scoreDocs hits)))]
+             (with-meta (for [hit dhits]
+                          (#'clucy/document->map
+                           (.doc searcher (.doc hit))
+                           (.score hit)
+                           highlighter))
+               {:total-hits (.totalHits hits)
+                :max-score (.getMaxScore hits)
+                :results-per-page per-page
+                :offset offset}))))))))

 (defrecord LuceneSearch [stats index-factory index]
   Search


clean up notes

clean up notes

--- src/clj/com/rpl/specter/macros.clj
+++ src/clj/com/rpl/specter/macros.clj
@@ -278,8 +278,5 @@
                 coerce-tfns-rich)
      ))

-;;TODO: hmm... not sure how to proxy it as don't know if its paramsneeded/compiler or rich/regular
-;;could require later definition to be done with "defproxiedpath" or wrapped in proxied-path
-
 (defmacro extend-protocolpath [protpath & extensions]
   `(extend-protocolpath* ~protpath ~(protpath-sym protpath) ~(vec extensions)))


Remove dead code (received )

Remove dead code (received )

--- src/clj/momentum/core/deferred.clj
+++ src/clj/momentum/core/deferred.clj
@@ -10,15 +10,12 @@

 (defprotocol DeferredValue
   (received? [_])
-  (received  [_])
   (receive   [_ success error]))

 (extend-protocol DeferredValue
   AsyncVal
   (received? [val]
     (.isRealized val))
-  (received [val]
-    (deref val 0 nil))
   (receive [val success error]
     (doto val
       (.receive
@@ -29,8 +26,6 @@
   AsyncSeq
   (received? [seq]
     (.isRealized seq))
-  (received [seq]
-    seq)
   (receive [seq success error]
     (doto seq
       (.receive
@@ -41,8 +36,6 @@
   Pipeline
   (received? [pipeline]
     (.isRealized pipeline))
-  (received [pipeline]
-    (deref pipeline 0 nil))
   (receive [val success error]
     (doto val
       (.receive
@@ -52,14 +45,12 @@

   Object
   (received? [o] true)
-  (received  [o] o)
   (receive [o success _]
     (success o)
     o)

   nil
   (received? [_] true)
-  (received  [_])
   (receive [_ success _]
     (success nil)
     nil))


Placeholder for multiple vehicle input screen

--- src/cljs/ikea_clojure_cup/car.cljs
+++ src/cljs/ikea_clojure_cup/car.cljs
@@ -6,8 +6,8 @@

 (defn- multiple-vehicle-entry
   [car-state-fn]
-
-  )
+  [bootstrap/panel {:header "You and which army?"}
+   [:p "This feature is coming soon..."]])

 (defn- single-vehicle-entry
   [single-state]
@@ -36,7 +36,6 @@
   [vehicles]
   (every?
    (fn [{:keys [width height depth] :as v}]
-     (println v (and width height depth))
      (and width height depth))
    vehicles))