Fix resolution of direction transformer.

--- src/afterglow/effects/params.clj
+++ src/afterglow/effects/params.clj
@@ -630,9 +630,8 @@
                       result))
           resolve-fn (fn [show snapshot head]
                        (with-show show
-                         (build-direction-transformer :aim (resolve-unless-frame-dynamic direction show snapshot head)
-                                                      :transform (resolve-unless-frame-dynamic transform
-                                                                                show snapshot head)
+                         (build-direction-transformer (resolve-unless-frame-dynamic direction show snapshot head)
+                                                      (resolve-unless-frame-dynamic transform show snapshot head)
                                                       :frame-dynamic dyn)))]
       (reify
         IParam


Fixes STORM-1001

Fixes STORM-1001

--- storm-core/src/clj/backtype/storm/util.clj
+++ storm-core/src/clj/backtype/storm/util.clj
@@ -605,7 +605,7 @@
     (if (nil? storm-dir)
       (current-classpath)
       (str/join class-path-separator
-                (concat (get-full-jars storm-lib-dir) (get-full-jars storm-extlib-dir) [extcp] [storm-conf-dir])))))
+                (remove nil? (concat (get-full-jars storm-lib-dir) (get-full-jars storm-extlib-dir) [extcp] [storm-conf-dir]))))))

 (defn add-to-classpath
   [classpath paths]


CMR-662: Fixed expected resulted for sort-key.

--- test/cmr/system_int_test/search/aql_search_test.clj
+++ test/cmr/system_int_test/search/aql_search_test.clj
@@ -127,7 +127,7 @@
          "SHORT" {:page-size 1} [coll1]
          "SHORT" {:page-size 1 :page-num 3} [coll3]
          ; TODO - enable this test when sort-key is supported
-         ;"SHORT" {:sort-key :entry-title} [coll2]
+         ;"SHORT" {:sort-key :entry-title} [coll1 coll2 coll3 coll4]
          "SHORT" {} [coll1 coll2 coll3 coll4])))


Remove trailing whitespace

Remove trailing whitespace

--- src/braid/ui/styles/message.cljs
+++ src/braid/ui/styles/message.cljs
@@ -108,4 +108,3 @@
       [:&:hover
        {:text-overflow "initial"
         :overflow-x "scroll"}]]])
-


Fix typo in ns docstring

Fix typo in ns docstring

--- src/buddy/core/codecs/base64.clj
+++ src/buddy/core/codecs/base64.clj
@@ -14,7 +14,7 @@

 (ns buddy.core.codecs.base64
   "Util functions for make conversion between string, bytes
-  and encode them to base64 ot hex format."
+  and encode them to base64 hex format."
   (:require [buddy.core.codecs :as codecs])
   (:import org.apache.commons.codec.binary.Base64))


Capture stdout and log it. Fix the logger name

--- src/circle/backend/build/run.clj
+++ src/circle/backend/build/run.clj
@@ -15,10 +15,7 @@
 (defn log-ns
   "returns the name of the logger to use for this build "
   [build]
-  (str "circle.build." (-> build :project-name) "-" (-> build :build-num)))
-
-(defn log-filename [build]
-  (str "build-" (-> build :project-name) "-" (-> build :build-num) ".log"))
+  (str "circle.build." (-> @build :project-name) "-" (-> @build :build-num)))

 (defn start* [build]
   (dosync
@@ -47,15 +44,14 @@

   (when (= :deploy (:type build))
     (throw-if-not (:vcs-revision build) "version-control revision is required for deploys"))
-
-  (add-file-appender (log-ns build) (log-filename build))

   (try
     (with-pwd "" ;; bind here, so actions can set! it
-      (do-build* build)
-      (when (-> build :notify-email)
-        (email/send-build-email build))
-      build)
+      (with-logs (log-ns build)
+        (do-build* build)
+        (when (-> build :notify-email)
+          (email/send-build-email build))
+        build))
     (catch Exception e
       (error e (format "caught exception on %s %s" (-> build :project-name) (-> build :build-num)))
       (when env/production?


Compile routes already in `reitit.core/router`

--- modules/reitit-core/src/reitit/core.cljc
+++ modules/reitit-core/src/reitit/core.cljc
@@ -142,8 +142,7 @@
   ([routes]
    (linear-router routes {}))
   ([routes opts]
-   (let [compiled (compile-routes routes opts)
-         names (find-names routes opts)
+   (let [names (find-names routes opts)
          [pl nl] (reduce
                    (fn [[pl nl] [p {:keys [name] :as data} result]]
                      (let [{:keys [params] :as route} (impl/create [p data result])
@@ -152,7 +151,7 @@
                                 (->PartialMatch p data result % params))]
                        [(conj pl route)
                         (if name (assoc nl name f) nl)]))
-                   [[] {}] compiled)
+                   [[] {}] routes)
          lookup (impl/fast-map nl)]
      ^{:type ::router}
      (reify
@@ -160,7 +159,7 @@
        (router-name [_]
          :linear-router)
        (routes [_]
-         compiled)
+         routes)
        (options [_]
          opts)
        (route-names [_]
@@ -190,14 +189,13 @@
          (str "can't create :lookup-router with wildcard routes: " wilds)
          {:wilds wilds
           :routes routes})))
-   (let [compiled (compile-routes routes opts)
-         names (find-names routes opts)
+   (let [names (find-names routes opts)
          [pl nl] (reduce
                    (fn [[pl nl] [p {:keys [name] :as data} result]]
                      [(assoc pl p (->Match p data result {} p))
                       (if name
                         (assoc nl name #(->Match p data result % p))
-                        nl)]) [{} {}] compiled)
+                        nl)]) [{} {}] routes)
          data (impl/fast-map pl)
          lookup (impl/fast-map nl)]
      ^{:type ::router}
@@ -205,7 +203,7 @@
        (router-name [_]
          :lookup-router)
        (routes [_]
-         compiled)
+         routes)
        (options [_]
          opts)
        (route-names [_]
@@ -225,8 +223,7 @@
   ([routes]
    (segment-router routes {}))
   ([routes opts]
-   (let [compiled (compile-routes routes opts)
-         names (find-names routes opts)
+   (let [names (find-names routes opts)
          [pl nl] (reduce
                    (fn [[pl nl] [p {:keys [name] :as data} result]]
                      (let [{:keys [params] :as route} (impl/create [p data result])
@@ -235,7 +232,7 @@
                                 (->PartialMatch p data result % params))]
                        [(segment/insert pl p (->Match p data result nil nil))
                         (if name (assoc nl name f) nl)]))
-                   [nil {}] compiled)
+                   [nil {}] routes)
          lookup (impl/fast-map nl)]
      ^{:type ::router}
      (reify
@@ -243,7 +240,7 @@
        (router-name [_]
          :segment-router)
        (routes [_]
-         compiled)
+         routes)
        (options [_]
          opts)
        (route-names [_]
@@ -272,7 +269,7 @@
          (str ":single-static-path-router requires exactly 1 static route: " routes)
          {:routes routes})))
    (let [[n :as names] (find-names routes opts)
-         [[p data result] :as compiled] (compile-routes routes opts)
+         [[p data result] :as compiled] routes
          p #?(:clj (.intern ^String p) :cljs p)
          match (->Match p data result {} p)]
      ^{:type ::router}
@@ -280,7 +277,7 @@
        (router-name [_]
          :single-static-path-router)
        (routes [_]
-         compiled)
+         routes)
        (options [_]
          opts)
        (route-names [_]
@@ -304,7 +301,6 @@
    (mixed-router routes {}))
   ([routes opts]
    (let [{wild true, lookup false} (group-by impl/wild-route? routes)
-         compiled (compile-routes routes opts)
          ->static-router (if (= 1 (count lookup)) single-static-path-router lookup-router)
          wildcard-router (segment-router wild opts)
          static-router (->static-router lookup opts)
@@ -314,7 +310,7 @@
        (router-name [_]
          :mixed-router)
        (routes [_]
-         compiled)
+         routes)
        (options [_]
          opts)
        (route-names [_]
@@ -350,6 +346,7 @@
    (let [{:keys [router] :as opts} (meta-merge default-router-options opts)
          routes (resolve-routes raw-routes opts)
          conflicting (conflicting-routes routes)
+         routes (compile-routes routes opts)
          wilds? (boolean (some impl/wild-route? routes))
          all-wilds? (every? impl/wild-route? routes)
          router (cond


add method to no match 404

add method to no match 404

--- src/clj/clj_money/web/server.clj
+++ src/clj/clj_money/web/server.clj
@@ -57,7 +57,7 @@
               trading-api/routes
               (ANY "/api/*" req
                    (do
-                     (log/debugf "unable to match API route for \"%s\"." (:uri req))
+                     (log/debugf "unable to match API route for %s \"%s\"." (:request-method req) (:uri req))
                      (api/not-found))))
       (wrap-routes wrap-integer-id-params)
       (wrap-json-body {:keywords? true :bigdecimals? true})


switch away from asserts, just throw RuntimeException instead so reader can communication file, line, column of tagged literal error

--- src/clj/cljs/tagged_literals.clj
+++ src/clj/cljs/tagged_literals.clj
@@ -3,12 +3,14 @@

 (defn read-queue
   [form]
-  (assert (vector? form) "Queue literal expects a vector for its elements.")
+  (when-not (vector? form)
+    (throw (RuntimeException. "Queue literal expects a vector for its elements.")))
   (list 'cljs.core/into 'cljs.core.PersistentQueue.EMPTY form))

 (defn read-uuid
   [form]
-  (assert (string? form) "UUID literal expects a string as its representation.")
+  (when-not (string? form)
+    (throw (RuntimeException. "UUID literal expects a string as its representation.")))
   (try
     (let [uuid (java.util.UUID/fromString form)]
       (list (symbol "UUID.") form))
@@ -17,7 +19,8 @@

 (defn read-inst
   [form]
-  (assert (string? form) "Instance literal expects a string for its timestamp.")
+  (when-not (string? form)
+    (throw (RuntimeException. "Instance literal expects a string for its timestamp.")))
   (try
     (let [^java.util.Date d (inst/read-instant-date form)]
       (list (symbol "js/Date.") (.getTime d)))
@@ -31,11 +34,11 @@

 (defn read-js
   [form]
-  (assert (or (vector? form) (map? form))
-    "JavaScript literal must use map or vector notation")
-  (assert (or (not (map? form))
-              (every? valid-js-literal-key? (keys form)))
-    "JavaScript literal keys must be strings or unqualified keywords")
+  (when-not (or (vector? form) (map? form))
+    (throw (RuntimeException. "JavaScript literal must use map or vector notation")))
+  (when-not (or (not (map? form))
+                (every? valid-js-literal-key? (keys form)))
+    (throw (RuntimeException. "JavaScript literal keys must be strings or unqualified keywords")))
   (if (map? form)
     `(cljs.core/js-obj
        ~@(apply concat (map (fn [[k v]] [(name k) v]) form)))


use *out* rebinding in shell command

use *out* rebinding in shell command

--- src/clj/lambdacd/steps/shell.clj
+++ src/clj/lambdacd/steps/shell.clj
@@ -33,15 +33,13 @@
     (.readLine reader)
     (catch IOException e nil)))

-(defn- read-and-print-shell-output [proc-result ctx]
-  (let [out-reader (io/reader (:out proc-result))
-        printer (support/new-printer)]
+(defn- read-and-print-shell-output [proc-result]
+  (let [out-reader (io/reader (:out proc-result))]
     (loop []
       (let [line (safe-read-line out-reader)]
         (when line
-          (support/print-to-output ctx printer line)
-          (recur))))
-    (support/printed-output printer)))
+          (println line)
+          (recur))))))

 (defn- execte-shell-command [cwd shell-script ctx env]
   (let [x (sh/proc "bash" "-e" shell-script
@@ -53,7 +51,7 @@
         kill-switch (:is-killed ctx)
         watch-ref (UUID/randomUUID)
         _ (add-kill-handling ctx proc was-killed watch-ref)
-        out (read-and-print-shell-output x ctx)
+        out (read-and-print-shell-output x)
         exit-code (sh/exit-code x)
         status (exit-code->status exit-code @was-killed)]
     (remove-watch kill-switch watch-ref)
@@ -70,4 +68,5 @@
         command-lines (string/join "\n" commands)]
     (spit temp-file command-lines)
     (util/with-temp temp-file
-      (execte-shell-command cwd temp-file ctx env))))+                    (support/capture-output ctx
+                      (execte-shell-command cwd temp-file ctx env)))))


Remove unneccessary static files route

Remove unneccessary static files route

--- src/clj/rumahsewa141/handler.clj
+++ src/clj/rumahsewa141/handler.clj
@@ -34,7 +34,6 @@
         (wrap-routes middleware/wrap-csrf)
         (wrap-routes middleware/wrap-formats)
         (wrap-routes middleware/wrap-admin-only))
-    (route/resources "/")
     (route/not-found
      (:body
       (error-page {:status 404


Db migration config

Db migration config

--- src/clj/salava/core/migrator.clj
+++ src/clj/salava/core/migrator.clj
@@ -15,15 +15,13 @@

 (defn plugins [] (cons :core (:plugins (dev-config))))

-(defn dev-ds [] (:datasource (dev-config)))

-(defn test-ds [] (:datasource (test-config)))
-
-(defn jdbc-uri [source]
-  (str "jdbc:" (:adapter source "mysql") "://"
-       (:server-name source "localhost")  "/" (:database-name source)
-       "?user=" (:username source)
-       (if (not-empty (:password source)) (str "&password=" (:password source)))))
+(defn jdbc-uri [conf]
+  (let [source (:datasource conf)]
+    (str "jdbc:" (:adapter source "mysql") "://"
+         (:server-name source "localhost")  "/" (:database-name source)
+         "?user=" (:username source)
+         (if (not-empty (:password source)) (str "&password=" (:password source))))))

 (def schema-table "schema_migrations")
@@ -37,9 +35,9 @@
   (str "migrations/" (name plugin) "/seed"))

-(defn seed-insert [ds data-file]
+(defn seed-insert [conf data-file]
   (doseq [seed (-> data-file slurp read-string)]
-    (jdbc/insert! (jdbc-uri ds) (:table seed) (:data seed))))
+    (jdbc/insert! (jdbc-uri conf) (:table seed) (:data seed))))

 (defn copy-file [source-path dest-path]
@@ -48,61 +46,61 @@
     (io/copy (io/file source-path) (io/file dest-path))))

-(defn seed-copy [plugin]
+(defn seed-copy [conf plugin]
   (when-let [data-dir (io/resource (str (seed-dir plugin) "/public"))]
     (doseq [source-file (-> data-dir io/as-file file-seq rest)]
-      (copy-file source-file (str "resources/public/" (public-path source-file))))))
+      (copy-file source-file (str (:data-dir conf "resources/public") "/" (public-path source-file))))))

-(defn migratus-config [ds plugin]
+(defn migratus-config [conf plugin]
   {:store                :database
-   :db                   (jdbc-uri ds)
+   :db                   (jdbc-uri conf)
    :migration-dir        (migration-dir plugin)
    :migration-table-name schema-table})

 (defn applied-migrations
-  ([ds]
+  ([conf]
    (try
-     (map :id (jdbc/query (jdbc-uri ds) [(str "SELECT id from " schema-table " ORDER BY id ASC")]))
+     (map :id (jdbc/query (jdbc-uri conf) [(str "SELECT id from " schema-table " ORDER BY id ASC")]))
      (catch Exception e)))

-  ([ds plugin]
-   (let [applied (applied-migrations ds)
+  ([conf plugin]
+   (let [applied (applied-migrations conf)
         available (->> (migration-dir plugin) find-migrations keys (map str) set)]
     (filter available (map str applied)))))

-(defn run-down [ds plugin applied]
+(defn run-down [conf plugin applied]
   (doseq [id applied]
-    (migratus/down (migratus-config ds plugin) (parse-migration-id id))))
+    (migratus/down (migratus-config conf plugin) (parse-migration-id id))))

-(defn run-seed [ds plugin]
+(defn run-seed [conf plugin]
   (when-let [data-file (io/resource (str (seed-dir plugin) "/data.edn"))]
     (log/info "running seed functions for plugin" (name plugin))
-    (seed-insert ds data-file)
-    (seed-copy plugin)))
+    (seed-insert conf data-file)
+    (seed-copy conf plugin)))

-(defn run-reset [ds plugin]
-  (let [applied (reverse (applied-migrations ds plugin))]
+(defn run-reset [conf plugin]
+  (let [applied (reverse (applied-migrations conf plugin))]
     (do
       (log/info "running reset functions for plugin" (name plugin))
-      (run-down ds plugin applied)
-      (migratus/migrate (migratus-config ds plugin))
-      (run-seed ds plugin))))
+      (run-down conf plugin applied)
+      (migratus/migrate (migratus-config conf plugin))
+      (run-seed conf plugin))))

 (defn run-test-reset []
   (doseq [plugin (plugins)]
-    (run-reset (test-ds) plugin)))
+    (run-reset (test-config) plugin)))

 (defn migrate-all [config-path]
   (let [config (read-config config-path)]
     (doseq [plugin (:plugins config)]
-      (migratus/migrate (migratus-config (:datasource config) plugin)))))
+      (migratus/migrate (migratus-config config plugin)))))

 ;;;

@@ -110,27 +108,27 @@
 (defn migrate [& args]
   (doseq [plugin (or args (plugins))]
     (log/info "running migrations for plugin" (name plugin))
-    (migratus/migrate (migratus-config (dev-ds) plugin)))
+    (migratus/migrate (migratus-config (dev-config) plugin)))
   (System/exit 0))

 (defn rollback [plugin]
-  (when-let [id (last (applied-migrations (dev-ds) plugin))]
+  (when-let [id (last (applied-migrations (dev-config) plugin))]
     (log/info "rolling back latest migration for plugin" (name plugin))
-    (run-down dev-ds plugin [id]))
+    (run-down (dev-config) plugin [id]))
   (System/exit 0))

 (defn remove-plugin [plugin]
   (log/info "rolling back all migrations for plugin" (name plugin))
-  (let [applied (reverse (applied-migrations (dev-ds) plugin))]
-    (run-down (dev-ds) plugin applied))
+  (let [applied (reverse (applied-migrations (dev-config) plugin))]
+    (run-down (dev-config) plugin applied))
   (System/exit 0))

 (defn seed [& args]
   (doseq [plugin (or args (plugins))]
-    (run-seed (dev-ds) plugin))
+    (run-seed (dev-config) plugin))
   (System/exit 0))

 (defn reset [& args]
   (doseq [plugin (or args (plugins))]
-    (run-reset (dev-ds) plugin))
+    (run-reset (dev-config) plugin))
   (System/exit 0))


Fix selenium url

Fix selenium url

--- src/clj/shale/node_providers.clj
+++ src/clj/shale/node_providers.clj
@@ -91,7 +91,7 @@
                   first)
         _ (assert port)
         port-num (:containerPort port)]
-    (str "http://" (-> pod :status :podIP) ":" port-num)))
+    (str "http://" (-> pod :status :podIP) ":" port-num "/wd/hub")))

 (defrecord KubeNodeProvider [api-url]
   INodeProvider


Components refactoring

Components refactoring

--- src/cljs/db_quiz/components.cljs
+++ src/cljs/db_quiz/components.cljs
@@ -1,19 +1,21 @@
 (ns db-quiz.components
-  (:require [db-quiz.layout :refer [hex-triangle]]
-            [db-quiz.logic :refer [init-board make-a-guess]]
+  (:require [db-quiz.layout :refer [hex-triangle shade-colour]]
+            [db-quiz.logic :refer [annull-game! init-board make-a-guess]]
             [db-quiz.model :as model]
             [db-quiz.state :refer [app-state]]
             [db-quiz.util :refer [join-by-space now redirect toggle]]
             [db-quiz.modals :as modals]
             [db-quiz.geometry :as geo]
             [db-quiz.config :refer [config]]
-            [db-quiz.layout :refer [shade-colour]]
+            [db-quiz.normalize :refer [trim-player-name]]
             [clojure.string :as string]
             [reagent.core :as reagent :refer [atom]]
             [reagent-forms.core :refer [bind-fields]]
             [reagent-modals.modals :as reagent-modals]))

 (defn parse-hash
+  "Parse 'query parameters' from hash fragment in the URL.
+  For example '#?doc=1234' is parsed to {:doc \"1234\"}."
   [h]
   (let [kv-pairs (-> h
                      (string/replace #"^#\?" "")
@@ -24,31 +26,80 @@
                kv-pairs))))

 (defn set-hash-options!
+  "Set options based on the params in URL's hash fragment.
+  Used to set Google Spreadsheet URL."
   []
   (let [location (.-location js/window)
         h (js/decodeURIComponent (.-hash location))]
     (when h
       (when-let [doc-url (:doc (parse-hash h))]
-        ; TODO: Refactor
         (swap! app-state (comp #(assoc-in % [:options :doc] (js/decodeURIComponent doc-url))
                                #(assoc-in % [:options :data-source] :gdrive)
                                #(assoc-in % [:options :share-url] (.-href location))))))))

+(defn set-language!
+  "Set preferred language based on the browser's settings.
+  Only supports Czech and English with Czech as default."
+  []
+  (let [language (case (.slice (.-language js/navigator) 0 2)
+                       "en" :english
+                       "cs" :czech
+                       :czech)]
+    (swap! app-state #(assoc-in % [:options :language] language))))
+
+(defn set-defaults!
+  "Set default options on load."
+  []
+  (set-hash-options!)
+  (set-language!))
+
 ; ----- Common components -----

+(def info-button
+  [:button#info-button.btn.btn-default {:on-click #(reagent-modals/modal! modals/game-info
+                                                                          {:size :lg})}
+   [:span.glyphicon.glyphicon-info-sign.glyphicon-start]
+   "O hře"])
+
 (defn label-element
+  "Label with text for input identified with for-id"
   [for-id text]
   [:label.col-sm-4.control-label {:for for-id} text])

-(def info-button
-  [:button#info-button.btn.btn-default {:on-click #(reagent-modals/modal! modals/game-info
-                                                                          {:size :lg})
-                                        :title "O hře"}
-   [:span.glyphicon.glyphicon-info-sign]])
+(defn select-box
+  "Form select box.
+  If single? is true then only 1 value can be selected at a time.
+  Otherwise, multiple values can be selected.
+  id is a string identifier of the select's input.
+  label is used to label the input.
+  buttons are maps of [:label :value] pairs for the buttons in the select box.
+  Less than 3 buttons are presented in a row. More than 3 buttons are presented
+  vertically."
+  [single? id label & buttons]
+  {:pre [(= (type single?) js/Boolean)
+         (= (type id) js/String)]}
+  (let [btn-group-class (if (> (count buttons) 3)
+                          "btn-group-vertical"
+                          "btn-group")]
+    [:div.form-group
+     [label-element id label]
+     [:div {:class (join-by-space "col-sm-8" btn-group-class)
+            :field (if single? :single-select :multi-select)
+            :id (keyword id)
+            :role "group"}
+      (for [{:keys [value label]} buttons]
+        [:button.btn.btn-default {:key value} label])]]))
+
+(def single-select
+  (partial select-box true))
+
+(def multi-select
+  (partial select-box false))

 ; ----- Home page -----

 (defn loading-indicator
+  "Indicates if data is loaded."
   []
   (when (:loading? @app-state)
     [:div#loading
@@ -56,6 +107,7 @@
      [:p.vcenter "Načítání..."]]))

 (defn player-form-field
+  "Form field for player's name"
   [id label]
   (let [local-id (keyword (str "players." id))]
     [:div {:class (join-by-space "form-group" "player-field" id)}
@@ -67,6 +119,7 @@
        "Jméno hráče musí být vyplněno!"]]]))

 (def google-spreadsheet-url
+  "Input for URL of a Google Spreadsheet to load data from"
   [:div.form-group
    [:p [:label.control-label {:for "options.doc"} "Google Spreadsheet URL"]
          [:a {:on-click #(reagent-modals/modal! modals/google-spreadsheet-help)}
@@ -75,6 +128,7 @@
     [:input.form-control {:field :text :id :options.doc :type "url"}]]])

 (def share-url
+  "URL of the game based on given Google Spreadsheet"
   [:div.form-group
    [:p [:label.control-label {:for "options.share-url"} "URL hry"]]
    [:p [:textarea.form-control {:field :text
@@ -82,22 +136,6 @@
                                 :readOnly "readOnly"
                                 :rows 4}]]])

-(defn select-box
-  [single? id label & buttons]
-  [:div.form-group
-   [label-element id label]
-   [:div.col-sm-8.btn-group {:field (if single? :single-select :multi-select)
-                              :id (keyword id)
-                              :role "group"}
-    (for [{:keys [value label]} buttons]
-      [:button.btn.btn-default {:key value} label])]])
-
-(def single-select
-  (partial select-box true))
-
-(def multi-select
-  (partial select-box false))
-
 (def field-labelling
   (single-select "options.labels"
                  "Označování políček"
@@ -118,19 +156,33 @@
                  {:label "Vysoká" :value :hard}))

 (def class-picker
-  (multi-select "options.classes"
+  (multi-select "options.selectors"
                 "Druhy otázek"
-                {:label "Osoby" :value "http://dbpedia.org/ontology/Person"}
-                {:label "Místa" :value "http://dbpedia.org/ontology/Place"}
-                {:label "Díla" :value "http://dbpedia.org/ontology/Work"}))
+                {:label "Osoby" :value {:p "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
+                                        :o "http://dbpedia.org/ontology/Person"}}
+                {:label "Místa" :value {:p "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
+                                        :o "http://dbpedia.org/ontology/Place"}}
+                {:label "Díla" :value {:p "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
+                                       :o "http://dbpedia.org/ontology/Work"}}
+                {:label "Lidé z Brna" :value {:p "http://purl.org/dc/terms/subject"
+                                              :o "http://cs.dbpedia.org/resource/Kategorie:Narození_v_Brně"}}
+                {:label "Členové KSČ" :value {:p "http://purl.org/dc/terms/subject"
+                                              :o "http://cs.dbpedia.org/resource/Kategorie:Členové_KSČ"}}
+                {:label "Umělci" :value {:p "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
+                                         :o "http://dbpedia.org/ontology/Artist"}}
+                {:label "Politici" :value {:p "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
+                                           :o "http://dbpedia.org/ontology/Politician"}}
+                {:label "Hudebníci" :value {:p "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
+                                            :o "http://dbpedia.org/ontology/MusicalArtist"}}
+                {:label "Filmy" :value {:p "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
+                                        :o "http://dbpedia.org/ontology/Film"}}))

 (def google-spreadsheet-options
   [:div google-spreadsheet-url
         share-url])

 (def dbpedia-options
-  [:div language-picker
-        class-picker
+  [:div class-picker
         difficulty-picker
         field-labelling])

@@ -171,13 +223,15 @@

 (def basic-options
   [:div
+   language-picker
    (player-form-field "player-1" "1. hráč")
    (player-form-field "player-2" "2. hráč")])

 (def start-menu
   (let [options-hidden (atom true)]
-    (set-hash-options!)
+    (set-defaults!)
     (fn []
+      (annull-game!)
       [:div.col-sm-6.col-sm-offset-3
        [:div#start-menu.form-horizontal
         [bind-fields basic-options app-state]
@@ -211,7 +265,7 @@

 ; ----- Play page -----

-(def autocomplete
+(def guess
   [:input.form-control {:autoFocus "autoFocus"
                         :field :text
                         :id :answer
@@ -224,6 +278,7 @@
                         :type "text"}])

 (defn timeout
+  "Progress bar showing the ellapsed time from player's turn."
   [on-turn completion]
   [:div.row
    [:div#timeout {:class (name on-turn)}]
@@ -280,7 +335,7 @@
   (canvas-element "tick-canvas"
                   [20 20]
                   [[[0.2 0.6] [0.4 0.8] [0.8 0.4]]]
-                  :line-width 0.2
+                  :line-width 0.15
                   :stroke-colour "#3C763D"))

 (defn cross-canvas
@@ -294,6 +349,7 @@
                   :stroke-colour "#A94442"))

 (defn verdict-component
+  "Show verdict if answer was correct or not."
   []
   (let [{:keys [board current-field verdict]} @app-state
         correct-answer (get-in board [current-field :label])
@@ -309,7 +365,7 @@
     (when-not (nil? verdict)
       [:div#verdict.row
        [:div.col-sm-12
-        [:p {:class (str "alert " verdict-class)}
+        [:p {:class (join-by-space "alert" verdict-class)}
          [icon]
          success ". Správná odpověď je " [:strong correct-answer] "."]]])))

@@ -325,7 +381,7 @@
       [:div.row
         [:div.col-sm-12
           [:div.input-group
-            [bind-fields autocomplete app-state]
+            [bind-fields guess app-state]
             [:span.input-group-btn
              [:button.btn.btn-primary
               {:on-click make-a-guess
@@ -340,13 +396,14 @@
       [verdict-component]]))

 (defn easter-egg
-  []
+  "Easter egg that renders a symbol of fish."
+  [player]
   (let [[width height] [40 20]]
     (reagent/create-class
       {:component-did-mount (fn [this]
                               (let [context (.getContext (reagent/dom-node this) "2d")
                                     _ (set! (.-fillStyle context)
-                                            (shade-colour (get-in config [:colours :player-1]) -30))
+                                            (shade-colour (get-in config [:colours player]) -30))
                                     relative-path [[[0 0.5] [0.2 0] [0.55 0] [0.8 0.45]]
                                                    [[0.8 0.45] [1 0.2] [0.8 0.45] [1 0.2]]
                                                    [[1 0.2] [0.93 0.5] [0.93 0.5] [1 0.8]]
@@ -373,29 +430,28 @@
   (let [{{:keys [completion start]} :timer
          :keys [on-turn players]} @app-state
         player-name (on-turn players)
-        player-name-length (count player-name)
-        font-class (cond (< player-name-length 6) "font-large"
-                         (< player-name-length 10) "font-regular"
-                         :else "font-small")]
+        [trimmed-name font-class] (trim-player-name player-name)]
     [:div
       [:div.row
-        [:div#on-turn {:class (str (name on-turn) " " font-class)}
-          (if (> player-name-length 20)
-            (str (subs player-name 0 17) "...")
-            player-name)
-          (when (and (= on-turn :player-1) (= player-name "Rybička")) [easter-egg])]]
+        [:div#on-turn {:class (join-by-space (name on-turn) font-class)}
+          trimmed-name
+          (when (= player-name "Rybička") [easter-egg on-turn])]]
       [timeout on-turn completion]]))

 (defn play-page
   []
-  (let [{:keys [current-field]} @app-state]
-    [:div.container-fluid
-     [:div.row
-      [:div.col-sm-6 [hex-triangle]]
-      [:div#question-box.col-sm-6
-       [player-on-turn]
-       (when current-field
-         [question-box current-field])]]]))
+  (let [{:keys [board current-field]} @app-state]
+    (if (empty? board)
+      (redirect "/") ; If no data is loaded, redirect to home page. TODO: Can we redirect to root?
+      [:div.container-fluid
+       info-button
+       [:div.row
+        [:div.col-sm-6 [hex-triangle]]
+        [:div#question-box.col-sm-6
+         [player-on-turn]
+         (when current-field
+           [question-box current-field])]]
+       [reagent-modals/modal-window]])))

 ; ----- End page -----


Forgot to repeat arguments in the render function

--- src/cljs/db_quiz/layout/svg.cljs
+++ src/cljs/db_quiz/layout/svg.cljs
@@ -45,7 +45,7 @@
   [{:keys [center id size text]}]
   (let [absolute-offset (* (/ size 100) (get-in config [:layout :inner-hex-offset]))
         [x y] center]
-    (fn []
+    (fn [{:keys [center id size text]}]
       (let [{:keys [board current-field loading?]} @app-state
             {:keys [abbreviation deselected? ownership]} (board id)
             disabled? (not (nil? current-field))


Change year input props

Change year input props

Need to cast year as int otherwise the save fails.

--- src/cljs/whatishistory/core.cljs
+++ src/cljs/whatishistory/core.cljs
@@ -212,10 +212,11 @@
                           (swap! app-atom assoc :author evt.target.value))}]
     [:input {:type "text"
              :class "yearInput"
+             :max-length 4
              :placeholder "Enter Year (YYYY)"
              :on-change (fn [evt]
                           (js/console.log (@app-atom :year))
-                          (swap! app-atom assoc :year evt.target.value))}]
+                          (swap! app-atom assoc :year (js/parseInt evt.target.value)))}]
     [:a {:class "button formToggle"
          :on-click #(swap! app-atom assoc :defn-form-mode "default")} "Add Your Own Definition"]
     [:br]


Is the db url not good?

Is the db url not good?

--- src/clojure/staircase/config.clj
+++ src/clojure/staircase/config.clj
@@ -36,9 +36,9 @@
     (str "jdbc:postgresql://" (.getHost parsed) ":" (.getPort parsed) (.getPath parsed) "?user=" user "&password=" password)))

 (defn db-options [opts]
-  (if-let [url (:database-url opts)]
-    {:connection-uri (parse-url url)}
-    (options opts "db-")))
+  ;;(if-let [url (:database-url opts)]
+  ;;  {:connection-uri (parse-url url)}
+    (options opts "db-"));)

 (defn app-options [opts]
   (options opts "web-"))


simplify3d.clj: further fiddling with 2-cut reduction

--- clojure/org/gavrog/clojure/simplify3d.clj
+++ clojure/org/gavrog/clojure/simplify3d.clj
@@ -104,7 +104,7 @@
                              [i (into {} (for [D (orbit-reps t [i j])
                                                E (orbit-elements t [i j] D)]
                                            [E 1]))]))]
-          [(make-dsymbol (dim t) (size t) ops* vs*) d])))
+          [(make-dsymbol (dim t) (size t) ops* vs*) d*])))

 (defn- o-range [ds i j start end]
   (if (= start end)
@@ -112,12 +112,8 @@
     (lazy-seq (cons start (o-range ds i j (walk ds start i j) end)))))

 (defn- liftable? [ds [A B C D]]
-  (let [r (o-range ds 0 1 A C)
-        s (map #(walk ds % 3 1) r)
-        t (filter #{B D} s)
-        u (count t)]
-    (println [A B C D] r s t u)
-    (not= 1 u)))
+  (->> (o-range ds 0 1 A C) (map #(walk ds % 3 1)) (filter #{B D}) count
+    (not= 1)))

 (defn- kf-complexity [ds]
   (reduce + (for [D (orbit-reps ds [0 1 3])] (- (r ds 0 1 D) 2))))
@@ -128,8 +124,10 @@
 (defn pinch-first-local-2-cut [ds]
   (if-let [[A B C D] (first (filter (partial liftable? ds) (local-2-cuts ds)))]
     (let [[ds E1] (cut-face ds A C)
-          [ds E2] (cut-face ds D B)]
-      (merge-volumes (pinch-tile ds E1 E2)))
+          [ds E2] (cut-face ds D B)
+          ds (pinch-tile ds E1 E2)
+          _ (println ds)]
+      (merge-volumes ds))
     ds))

 (defn simplified [ds]


Add some tests for random nonces

Add some tests for random nonces

--- test/caesium/magicnonce/secretbox_test.clj
+++ test/caesium/magicnonce/secretbox_test.clj
@@ -16,6 +16,12 @@
         two (byte-array [0 1 0])]
     (is (identical? (#'ms/xor-inplace! one two) one))
     (is (u/array-eq (byte-array [1 1 1]) one))))
+
+(deftest random-nonce!-test
+  (let [a (ms/random-nonce!)
+        b (ms/random-nonce!)]
+    (is (not (u/array-eq a b)))
+    (is (= s/noncebytes (alength ^bytes a) (alength ^bytes b)))))

 (deftest secretbox-pfx-test
   (let [nonce (byte-array (range s/noncebytes))


Fix #1386

Fix #1386

--- backend/project.clj
+++ backend/project.clj
@@ -9,8 +9,8 @@
                  [org.slf4j/log4j-over-slf4j "1.7.25"]
                  [org.slf4j/jcl-over-slf4j "1.7.25"]
                  [org.slf4j/jul-to-slf4j "1.7.25"]
-                 [cheshire "5.8.0"]
-                 [clj-http "3.7.0"]
+                 [cheshire "5.8.0" :exclusions [com.fasterxml.jackson.core/jackson-core]]
+                 [clj-http "3.7.0" :exclusions [org.apache.httpcomponents/httpcore org.apache.httpcomponents/httpclient org.apache.httpcomponents/httpmime]]
                  [clj-time "0.14.2"]
                  [com.layerware/hugsql "0.4.8"]
                  [com.stuartsierra/component "0.3.2"]
@@ -25,8 +25,14 @@
                  [org.akvo/commons "0.4.5" :exclusions [org.postgresql/postgresql org.clojure/java.jdbc]]
                  [org.akvo/resumed "1.17.be5e74d2518253bb87ce087c15f5e04bd4b8b824"]
                  [org.apache.tika/tika-core "1.17"]
-                 [org.apache.tika/tika-parsers "1.17" :exclusions [org.slf4j/slf4j-api]]
-                 [org.clojure/clojure "1.9.0-beta1"]
+                 [org.apache.tika/tika-parsers "1.17" :exclusions [org.slf4j/slf4j-api com.fasterxml.jackson.core/jackson-core org.apache.httpcomponents/httpcore org.apache.httpcomponents/httpclient org.apache.httpcomponents/httpmime]]
+                 ;; explicit versions of commons deps used by tika-parsers and clj-http
+                 [com.fasterxml.jackson.core/jackson-core "2.9.2"]
+                 [org.apache.httpcomponents/httpcore "4.4.7"]
+                 [org.apache.httpcomponents/httpclient "4.5.4"]
+                 [org.apache.httpcomponents/httpmime "4.5.4"]
+
+                 [org.clojure/clojure "1.9.0"]
                  [org.clojure/data.csv "0.1.4"]
                  [org.clojure/core.match "0.3.0-alpha5"]
                  [org.clojure/java.jdbc "0.7.5"]
@@ -34,14 +40,15 @@
                  [org.postgresql/postgresql "42.2.1"]
                  [ragtime/ragtime.jdbc "0.6.4"]
                  [raven-clj "1.5.1"]
-                 [ring "1.6.3"]
+                 [ring "1.6.3" :exclusions [ring/ring-core]]
+                 [ring/ring-core "1.6.3"]
                  [ring/ring-defaults "0.3.1"]
                  [ring/ring-json "0.4.0"]
                  [selmer "1.11.5"]
                  [net.postgis/postgis-jdbc "2.2.1" :exclusions [org.postgresql/postgresql]]]
   :uberjar-name "akvo-lumen.jar"
   :repl-options {:timeout 120000}
-  ;; :pedantic? :abort
+  :pedantic? :abort
   :plugins [[lein-ancient "0.6.15"]
             [lein-codox "0.9.6"]
             [lein-environ "1.0.3"]


Changes in how we update extensions: don't check for URL to be different

Signed-off-by: Aleksandr Pantiukhov <33cce7019c5ec80a74fe74102c4c2175a8341f94@gmail.com>

--- src/status_im/extensions/core.cljs
+++ src/status_im/extensions/core.cljs
@@ -356,16 +356,10 @@
               #(toggle-fn id %))))

 (fx/defn load
-  [cofx url]
-  (if (->> (get-in cofx [:db :account/account :extensions])
-           vals
-           (filter #(= (:url %) (string/trim url)))
-           first)
-    {:utils/show-popup {:title   (i18n/label :t/error)
-                        :content (i18n/label :t/extension-is-already-added)}}
-    {:extensions/load {:extensions [{:url     (string/trim url)
-                                     :active? true}]
-                       :follow-up  :extensions/stage}}))
+  [_ url]
+  {:extensions/load {:extensions [{:url     (string/trim url)
+                                   :active? true}]
+                     :follow-up  :extensions/stage}})

 (fx/defn activate-extensions
   [{{:account/keys [account]} :db}]


remove code sample

remove code sample

--- moebius/src/moebius/kv.clj
+++ moebius/src/moebius/kv.clj
@@ -107,27 +107,3 @@

 (defn make-in-memory-kvstore []
   (InMemoryKVstore. {:version 0 :snapshot {} :tx-log []}))
-
-
-(comment
-  ;; create empty kvstores
-  (def kv1 (make-in-memory-kvstore))
-  (def kv2 (make-in-memory-kvstore))
-
-  ;; both same
-  (= kv1 kv2)
-
-  ;; make some changes
-  (def kv1'
-    (-> kv1
-        (set "a" :test 1)
-        (set "a" :test 2)))
-
-  ;; restore state based on tx-log
-  (def kv2' (restore kv2 (tx-log kv1')))
-
-  ;; still the same
-  (= kv1' kv2')
-
-  (get kv1' "a" :test)
-)


RS | 15 | Remove redundant test

RS | 15 | Remove redundant test

--- test/stonecutter/test/controller/oauth.clj
+++ test/stonecutter/test/controller/oauth.clj
@@ -14,11 +14,6 @@
           :after (storage/reset-in-memory-stores!)))

 (facts "about authorisation end-point"
-       (future-fact "request with no parameters returns 403"
-             (let [request (r/request :get "/authorisation")
-                   response (oauth/authorise request)]
-               (:status response) => 403))
-
        (fact "request with client-id, response_type and redirect_uri returns redirect to login page if there is no user session"
              (let [client-details (cl-client/register-client "ClientTestApp" "localhost:3001") ;FORMAT => {:client-secret "XLFCQRKJXSV3T6YQJL5ZJJVGFUJNT6LD", :client-id "RXBX6ZXAER5KPDSZ3ZCZJDOBS27FLDE7", :name "ClientTestApp", :url "localhost:3001"}
                    request (-> (r/request :get "/authorisation" {:client_id (:client-id client-details) :response_type "code" :redirect_uri "callback"})


CMR-2420 Remove explict assignment and just leave the test

--- umm-lib/src/cmr/umm/dif/collection/progress.clj
+++ umm-lib/src/cmr/umm/dif/collection/progress.clj
@@ -15,7 +15,6 @@
       "in work"  :in-work
       "complete" :complete
       "completed" :complete
-      "ongoing" :in-work
       :in-work)))

 (defn generate


Tighten up on-click syntax

Tighten up on-click syntax

--- src-cljs/frontend/components/pages/projects.cljs
+++ src-cljs/frontend/components/pages/projects.cljs
@@ -150,7 +150,7 @@
                  :header-actions (html
                                   [:a.btn.btn-primary
                                    {:href (routes/v1-add-projects)
-                                    :on-click (fn []
-                                                ((om/get-shared owner :track-event) {:event-type :add-project-clicked
-                                                                                :properties {:view :projects}}))}
+                                    :on-click #((om/get-shared owner :track-event)
+                                                {:event-type :add-project-clicked
+                                                 :properties {:view :projects}})}
                                    "Add Project"])}))))


Fix bug causing result for text to not show.

--- src/cljs/clj_templates/pages/templates/page.cljs
+++ src/cljs/clj_templates/pages/templates/page.cljs
@@ -56,6 +56,6 @@
      (if (pos? page-count)
        [pagination page-count]
        [:div.pagination [:div.pagination-link.current-page ":("]])
-     [results-for-text]
+     [results-for-text templates query-string]
      [results templates query-string error?]
      (when (< 1 page-count) [pagination page-count])]))


Fix missing argument

Fix missing argument

--- src/matchmaker_sparql/evaluation/fold/setup.clj
+++ src/matchmaker_sparql/evaluation/fold/setup.clj
@@ -42,5 +42,5 @@
   [evaluation limit-and-offset]
   (timbre/info "Setting up an evaluation fold...")
   (withdraw-matches evaluation limit-and-offset)
-  (are-matches-withdrawn?)
+  (are-matches-withdrawn? evaluation)
   (load-matches evaluation))


fix typo

fix typo

--- src/wombats/handlers/simulator.clj
+++ src/wombats/handlers/simulator.clj
@@ -99,7 +99,7 @@
                         :params [template-id]}))

        (when-not user
-         (wombat-error {:code :handlers.simulator.initialize-simulator/misssing-user
+         (wombat-error {:code :handlers.simulator.initialize-simulator/missing-user
                         :params [user-id]}))

        (when-not wombat


Fix ContainerBuilderClientComponent

Fix ContainerBuilderClientComponent

--- src/puppeteer/infra/client/container_builder.clj
+++ src/puppeteer/infra/client/container_builder.clj
@@ -11,22 +11,22 @@

 (defn create-build
   [{:keys [project-id client access-token] :as comp} build]
-  (println access-token)
+  (println (-> (GoogleCredential/getApplicationDefault) .getAccessToken))
   (-> client
       .projects
       .builds
       (.create project-id build)
-      (.setAccessToken access-token)
+      (.setAccessToken
+        (-> (GoogleCredential/getApplicationDefault) .getAccessToken))
       .execute))

-(defrecord ContainerBuilderClientComponent [project-id client access-token]
+(defrecord ContainerBuilderClientComponent [project-id client]
   component/Lifecycle
   (start [this]
     (println ";; Starting ContainerBuilderClientComponent")
+    (.refreshToken (GoogleCredential/getApplicationDefault))
     (-> this
         (assoc :project-id (ServiceOptions/getDefaultProjectId))
-        (assoc :access-token (-> (doto (GoogleCredential/getApplicationDefault) .refreshToken)
-                                 .getAccessToken))
         (assoc :client (-> (CloudBuild$Builder. (GoogleNetHttpTransport/newTrustedTransport)
                                                 (JacksonFactory.)
                                                 nil)


Link to incise svg logo instead of slurping it in.

--- resources/content/index.clj
+++ resources/content/index.clj
@@ -3,14 +3,14 @@

 (require '[incise.parsers.impl.markdown :refer [markdown-to-html]])
 (require '[hiccup.core :refer [html]])
-(require '[hiccup.element :refer [link-to]])
+(require '[hiccup.element :refer [link-to image]])
 (require '[clojure.string :refer [replace-first]])

 (def md-source (slurp "README.md"))
-(def svg-logo (slurp "assets/logo.svg"))
+(def svg-logo "/assets/images/logo.svg")
 (def svg-logo-link
-  (html (link-to "https://github.com/RyanMcG/incise" svg-logo)))
-
+  (html (link-to "https://github.com/RyanMcG/incise"
+                 (image {:id "logo"} svg-logo "incise logo"))))
 (-> md-source
     (markdown-to-html)
     (replace-first #"\<img.*/\> " svg-logo-link))


Tweak connect setup

Tweak connect setup

--- src/lt/plugins/elm_light/clients.cljs
+++ src/lt/plugins/elm_light/clients.cljs
@@ -10,13 +10,19 @@
             [lt.objs.eval :as eval]
             [lt.objs.editor.pool :as pool]
             [lt.objs.dialogs :as dialogs]
-            [lt.objs.sidebar.clients :as scl])
+            [lt.objs.sidebar.clients :as scl]
+            [lt.objs.popup :as popup]
+            [lt.objs.platform :as platform])
   (:require-macros [lt.macros :refer [behavior]]))

 (def cp (js/require "child_process"))
 (def os (js/require "os"))
 (def elm-client-path (files/join u/elm-plugin-dir "node/elm-client.js"))
 (def elm-node-path (files/join u/elm-plugin-dir "node_modules"))
+(def shelljs (js/require (files/join elm-node-path "shelljs")))
+
+
+

 (declare elm)

@@ -140,42 +146,95 @@
                           (object/add-behavior! client ::send!)))))

+
+
+(defn handle-no-elm []
+  (notifos/done-working)
+  (console/log (.-PATH (.-env js/process)))
+  (popup/popup! {:header "We couldn't find Elm (elm-make) in your path"
+                 :body (str "In order to use elm-light, Elm must be installed and on your system PATH."
+                            "(Check the console for PATH as seen from Light Table")
+                 :buttons [{:label "Install Elm"
+                            :action (fn []
+                                      (platform/open "https://guide.elm-lang.org/install.html"))}
+                           {:label "ok"}]}))
+
+
+(defn check-elm []
+  (.which shelljs "elm-make"))
+
+
+
 (defn try-connect [{:keys [info] :as props}]
-  (let [path (:path info)
-        proj-path (u/project-path path)
-        client (cs/client! :elm-client)]
-
-    (if proj-path
-      (start-elm-client {:path path
-                         :proj-path proj-path
-                         :client client})
-      (do
-        (notifos/done-working)
-        (notifos/set-msg! (str "Couldn't find a elm-package.json in any parent of path: " path) {:class "error"})
-        (cs/rem! client)))
-    client))
-
+  (if (check-elm)
+    (let [path (:path info)
+         proj-path (u/project-path path)
+         client (cs/client! :elm-client)]
+
+     (if proj-path
+       (start-elm-client {:path path
+                          :proj-path proj-path
+                          :client client})
+       (do
+         (notifos/done-working)
+         (notifos/set-msg! (str "Couldn't find a elm-package.json in any parent of path: " path) {:class "error"})
+         (cs/rem! client)))
+     client)
+    (do
+      (handle-no-elm)
+      nil)))
+
+
+
+
+(defn find-client [{:keys [origin command info create] :as opts}]
+  (let [proj-path (u/project-path (:path info))
+        [result client] (cs/discover command info)]
+
+    (condp = result
+      :none (if create
+              (create opts)
+              (do
+                (notifos/done-working)
+                (object/raise eval/evaler :no-client opts)
+                (cs/placeholder)))
+      :found (if (= (:dir @client) proj-path)
+               client
+               (create opts))
+      :select (do
+                (object/raise eval/evaler
+                              :select-client
+                              client
+                              (fn [client]
+                                (cs/swap-client! (-> @origin :client :default) client)
+                                (object/update! origin [:client] assoc :default client)))
+                (cs/placeholder)))))

 (defn get-eval-client
   "Helper method to get eval client for a given editor and command
   If none found it will try to connect"
-  [ed cmd]
-  (eval/get-client! {:command cmd
-                     :origin ed
-                     :info (:info @ed)
-                     :create try-connect}))
+  ([ed cmd] (get-eval-client ed cmd try-connect))
+  ([ed cmd create]
+   (let [cur (-> @ed :client :default)]
+     (if (and cur (cs/available? cur))
+       cur
+       (let [neue (find-client {:command cmd
+                                :origin ed
+                                :info (:info @ed)
+                                :create create})]
+
+         (object/update! ed [:client] assoc :default neue)
+         (object/raise ed :set-client neue)
+         neue)))))

 (defn get-eval-client-if-connected
   "Helper method to get eval client for a given editor and command"
   [ed cmd]
-  (eval/get-client! {:command cmd
-                     :origin ed
-                     :info (:info @ed)
-                     :create (fn [opts]
+  (get-eval-client ed cmd (fn [opts]
                                (notifos/done-working "")
-                               nil)}))
+                               nil)))

 ;; TODO : Need to have this here for now, because behaviour must be defined before Elm object is created


implementing b+tree via defrecords

implementing b+tree via defrecords

--- sample/src/sample/btree.clj
+++ sample/src/sample/btree.clj
@@ -5,14 +5,14 @@

 (defprotocol TreeModify
-  (add [this k v]))
-
-(defprotocol TreeSearch
-  (search [this k]))
-
-
-
-(defrecord BinaryTreeNode [k* v* l r]
+  (insert [this k v]))
+
+(defprotocol TreeLookup
+  (lookup [this k]))
+
+
+
+#_(defrecord BinaryTreeNode [k* v* l r]

   TreeModify

@@ -41,54 +41,9 @@

-#_(defn- binary-tree-leafnode? [{:keys [l r] :as this}]
-  (and (nil? l) (nil? r)))
-
-#_(defrecord Binary+TreeNode [k* v* l r]
-
-  TreeModify
-
-  (add [this k v]
-    (let [[l r] (if (<= (compare k k*) 0)
-                  [(if-not (nil? l)
-                     (add l k v)
-                     (Binary+TreeNode. k v nil nil))
-                   r]
-                  [l
-                   (if-not (nil? r)
-                     (add r k v)
-                     (Binary+TreeNode. k v nil nil))])]
-      (BinaryTreeNode. k* )))
-
-  TreeSearch
-
-  (search [this k]
-    ))
-
-
-
-#_(defrecord B+TreeChildren [children-map largest-child]
-
-  TreeModify
-
-  (add [this v]
-    )
-
-  TreeSearch
-
-  (search [this k]
-    (if-let [child (get children-map k)]
-      child
-      largest-child)))
-
-
-#_(defn- b+tree-children []
-  (->B+TreeChildren (rm/range-map :find-ceiling) nil))
-
-
-(declare insert*)
-
-(defn- internal-node [b ks vs size]
+#_(declare insert*)
+
+#_(defn- internal-node [b ks vs size]
   {:pre [(= (count vs)
             (inc (count ks)))]}
   {:b b
@@ -97,7 +52,7 @@
    :vs vs
    :size size})

-(defn- inode-lookup [{:keys [ks vs] :as n} k]
+#_(defn- inode-lookup [{:keys [ks vs] :as n} k]
   ;;; TODO: implement binary search
   (loop [[k* & ks*] ks
          [v* & vs*] vs]
@@ -106,7 +61,7 @@
       (<= (compare k k*) 0) [k* v*]
       true                  (recur ks* vs*))))

-(defn- inode-split [{:keys [b ks vs size] :as n}]
+#_(defn- inode-split [{:keys [b ks vs size] :as n}]
   (let [partition-size  (-> size (/ 2) Math/ceil int)
         [ks1 ks2]       (partition-all partition-size ks)
         [ks1 nk]        [(butlast ks1) (last ks1)]
@@ -117,7 +72,7 @@
      nk
      (internal-node b ks2 vs2 (- partition-size (rem size 2)))]))

-(defn- inode-ins [{:keys [b ks vs size] :as n} k v]
+#_(defn- inode-ins [{:keys [b ks vs size] :as n} k v]
   (if-not (= k ::inf)
     (let [[ks1 ks2] (split-with #(< (compare % k) 0) ks)
           [vs1 vs2] (split-at (count ks1) vs)
@@ -133,7 +88,7 @@
       #_(println "IINS (INF)" ks nvs)
       (internal-node b ks nvs size))))

-(defn- inode-insert [{:keys [b ks vs] :as n} k v]
+#_(defn- inode-insert [{:keys [b ks vs] :as n} k v]
   (let [[childk childv] (inode-lookup n k)
         [n1 nk n2]      (insert* childv k v)
         nn              (if (nil? n2)
@@ -145,7 +100,7 @@
       [nn])))

-(defn- leaf-node
+#_(defn- leaf-node
   ([b ks vs size]
    {:pre [(= (count vs)
              (count ks))]}
@@ -164,10 +119,10 @@
     :m m
     :size size}))

-(defn- lnode-lookup [{:keys [m] :as n} k]
+#_(defn- lnode-lookup [{:keys [m] :as n} k]
   [nil (get m k)])

-(defn- lnode-split [{:keys [b m size] :as n}]
+#_(defn- lnode-split [{:keys [b m size] :as n}]
   (let [partition-size (-> size (/ 2) Math/ceil int)
         [ks1 ks2] (partition-all partition-size (keys m))
         m1 (apply dissoc m ks2)
@@ -177,53 +132,153 @@
      (last ks1)
      (leaf-node b m2 (- partition-size (rem size 2)))]))

-(defn- lnode-ins [{:keys [b m size] :as n} k v]
+#_(defn- lnode-ins [{:keys [b m size] :as n} k v]
   (let [nm (assoc m k v)]
     #_(println "LINS" nm)
     (leaf-node b nm (inc size))))

-(defn- lnode-insert [{:keys [b m] :as n} k v]
+#_(defn- lnode-insert [{:keys [b m] :as n} k v]
   (let [nn (lnode-ins n k v)]
     (if (>= (-> nn :m count) b)
       (lnode-split nn)
       [nn])))

-(defn- node? [{:keys [type] :as n}]
+#_(defn- node? [{:keys [type] :as n}]
   (or (= type :internal)
       (= type :leaf)))

-(defn- insert* [{:keys [type] :as n} k v]
+#_(defn- insert* [{:keys [type] :as n} k v]
   (case type
     :internal (inode-insert n k v)
     :leaf     (lnode-insert n k v)))

-(defn- lookup* [{:keys [type] :as n} k]
+#_(defn- lookup* [{:keys [type] :as n} k]
   #_(print "L")
   (case type
     :internal (inode-lookup n k)
     :leaf     (lnode-lookup n k)))

-(defn insert [{:keys [b] :as n} k v]
+#_(defn insert [{:keys [b] :as n} k v]
   #_(println "=== INSERT ===")
   (let [[n1 k n2] (insert* n k v)]
     (if (nil? n2)
       n1
       (internal-node b [k] [n1 n2] 1))))

-(defn lookup [n k]
+#_(defn lookup [n k]
   #_(println "=== LOOKUP ===")
   (loop [[_ v] (lookup* n k)]
     (if (node? v)
       (recur (lookup* v k))
       v)))

-(defn tree [b]
-  (leaf-node b))
-
-
-#_(-> (tree 3)
+
+(defrecord B+TreeInternalNode [b size ks vs]
+
+  TreeModify
+
+  (insert [this k v]
+    (letfn [(split [{:keys [b ks vs size] :as n}]
+              (let [partition-size  (-> size (/ 2) Math/ceil int)
+                    [ks1 ks2]       (partition-all partition-size ks)
+                    [ks1 nk]        [(butlast ks1) (last ks1)]
+                    [vs1 vs2a vs2b] (partition-all partition-size vs)
+                    vs2             (concat vs2a vs2b)]
+                [(->B+TreeInternalNode b (dec partition-size) ks1 vs1)
+                 nk
+                 (->B+TreeInternalNode b (- partition-size (rem size 2)) ks2 vs2)]))
+
+            (ins [{:keys [b ks vs size] :as n} k v]
+              (if-not (= k ::inf)
+                (let [[ks1 ks2] (split-with #(< (compare % k) 0) ks)
+                      [vs1 vs2] (split-at (count ks1) vs)
+                      replace?  (= (compare (first ks2) k) 0)
+                      ks2       (if replace? (rest ks2) ks2)
+                      vs2       (if replace? (rest vs2) vs2)
+                      nsize     (if replace? size (inc size))
+                      nks       (concat ks1 [k] ks2)
+                      nvs       (concat vs1 [v] vs2)]
+                  (->B+TreeInternalNode b nsize nks nvs))
+                (let [nvs (-> vs butlast (concat [v]))]
+                  (->B+TreeInternalNode b size ks nvs))))]
+
+      (let [[childk childv] (lookup this k)
+            [n1 nk n2]      (insert childv k v)
+            nn              (if (nil? n2)
+                              (ins this childk n1)
+                              (-> (ins this nk n1)
+                                  (ins childk n2)))]
+        (if (>= (-> nn :size) b)
+          (split nn)
+          [nn]))))
+
+  TreeLookup
+
+  (lookup [this k]
+    (loop [[k* & ks*] ks
+           [v* & vs*] vs]
+      (cond
+        (nil? k*)             [::inf v*]
+        (<= (compare k k*) 0) [k* v*]
+        true                  (recur ks* vs*)))))
+
+
+(defrecord B+TreeLeafNode [b size m]
+
+  TreeModify
+
+  (insert [this k v]
+    (letfn [(split [{:keys [b m size] :as n}]
+              (let [partition-size (-> size (/ 2) Math/ceil int)
+                    [ks1 ks2] (partition-all partition-size (keys m))
+                    m1 (apply dissoc m ks2)
+                    m2 (apply dissoc m ks1)]
+                [(->B+TreeLeafNode b partition-size m1)
+                 (last ks1)
+                 (->B+TreeLeafNode b (- partition-size (rem size 2)) m2)]))
+
+            (ins [{:keys [b m size] :as n} k v]
+              (let [nm (assoc m k v)]
+                (->B+TreeLeafNode b (inc size) nm)))]
+
+      (let [nn (ins this k v)]
+        (if (>= (-> nn :size) b)
+          (split nn)
+          [nn]))))
+
+  TreeLookup
+
+  (lookup [this k]
+    [k (get m k)]))
+
+
+(defrecord B+Tree [b root]
+
+  TreeModify
+
+  (insert [this k v]
+    (let [[n1 k n2] (insert root k v)
+          nroot (if (nil? n2)
+                  n1
+                  (->B+TreeInternalNode b 1 [k] [n1 n2]))]
+      (->B+Tree b nroot)))
+
+  TreeLookup
+
+  (lookup [this k]
+    (loop [[_ v] (lookup root k)]
+      (if (satisfies? TreeLookup v)
+        (recur (lookup v k))
+        v))))
+
+
+(defn b+tree [b]
+  (->B+Tree b (->B+TreeLeafNode b 0 (sorted-map))))
+
+
+#_(-> (b+tree 3)
     (insert 5 55)
     (insert 9 99)
     (insert 3 33)
@@ -235,19 +290,26 @@
 #_(let [kvs (take 100000 (repeatedly #(let [k (-> (rand-int 9000000)
                                                 (+ 1000000))]
                                       [k (str "v" k)])))
+      ts (atom [])
       t (time (reduce (fn [t [k v]]
-                        (insert t k v))
-                      (tree 100)
-                      kvs))]
-  [(first kvs)
-   (time (lookup t (-> kvs first first)))])
-
-
-(defrecord B+TreeNode [b size children leaf?]
+                        (let [nt (insert t k v)]
+                          (swap! ts #(take 10 (conj % nt)))
+                          #_(reset! ts t)
+                          nt))
+                      (b+tree 100)
+                      kvs))
+      kv1 (first kvs)
+      k1 (first kv1)]
+  #_(Thread/sleep 120000)
+  [kv1 (count @ts) (time (lookup t k1))])
+
+
+
+#_(defrecord B+TreeNode [b size children leaf?]

   TreeModify

-  (add [this k v]
+  (insert [this k v]
     (letfn [(split [children size]
               (println "SPLIT1" (keys children) (type children))
               (let [partition-size (-> size (/ 2) Math/ceil int)
@@ -329,12 +391,12 @@

   TreeSearch

-  (search [this k]
+  (lookup [this k]
     (when-let [child (get children k)]
       (if (satisfies? TreeSearch child)
-        (search child k)
+        (lookup child k)
         child))))

-(defn b+tree [b]
+#_(defn b+tree [b]
   (->B+TreeNode b 0 (sorted-map) true))


Add api-docs for lambdacd.presentation.pipeline-state

--- src/clj/lambdacd/presentation/pipeline_state.clj
+++ src/clj/lambdacd/presentation/pipeline_state.clj
@@ -1,4 +1,8 @@
 (ns lambdacd.presentation.pipeline-state
+  "This namespace contains functions useful to convert the internal state of a pipeline into something more easy to use
+  for further processing, e.g. to present it to a user.
+
+  Functions taking a map step-id to step-result are usually called with the result of `lambdacd.state.core/get-step-results`"
   (:require [clj-time.core :as t]
             [clojure.tools.logging :as log]
             [clj-timeframes.core :as tf]
@@ -20,7 +24,14 @@
 (defn- step-result [[_ step-result]]
   step-result)

-(defn overall-build-status [step-ids-and-results]
+(defn overall-build-status
+  "Takes a map of step-ids to step results and returns the status of the pipeline as a whole:
+  ```clojure
+  > (overall-build-status {'(0) {:status :success :most-recent-update-at stop-time :first-updated-at start-time}
+                           '(1) {:status :running :most-recent-update-at stop-time :first-updated-at start-time}})
+  :running
+  ```"
+  [step-ids-and-results]
   (let [accumulated-status (->> step-ids-and-results
                                 (filter root-step?)
                                 (sort-by root-step-id)
@@ -45,15 +56,21 @@
        (sort comp)
        (first)))

-(defn earliest-first-update [step-ids-and-results]
+(defn earliest-first-update
+  "Takes a map of step-ids to step results and finds the earliest timestamp for `:first-updated-at`, usually the start time of a pipeline"
+  [step-ids-and-results]
   (->> (vals step-ids-and-results)
        (filter not-retriggered?)
        (first-with-key-ordered-by asc :first-updated-at)))

-(defn latest-most-recent-update [step-ids-and-results]
+(defn latest-most-recent-update
+  "Takes a map of step-ids to step results and finds the latest timestamp for `:most-recent-update-at`, usually the end or most recent update of a pipeline"
+  [step-ids-and-results]
   (first-with-key-ordered-by desc :most-recent-update-at (vals step-ids-and-results)))

-(defn build-that-was-retriggered [step-ids-and-results]
+(defn build-that-was-retriggered
+  "Takes a map of step-ids to step results and returns `nil` (for normal builds) or the build number of the build that was retriggered."
+  [step-ids-and-results]
   (get-in step-ids-and-results [[1] :retrigger-mock-for-build-number]))

 (defn- build-interval [step]
@@ -66,7 +83,9 @@
 (defn- interval-duration [interval]
   (t/in-seconds interval))

-(defn build-duration [step-ids-and-results]
+(defn build-duration
+  "Takes a map of step-ids to step results and returns the duration of a build in seconds (excluding time the build spent waiting)"
+  [step-ids-and-results]
   (->> step-ids-and-results
        (vals)
        (filter not-waiting?)
@@ -95,14 +114,35 @@
     (history-entry build-number (state/get-step-results ctx build-number) (state/get-build-metadata ctx build-number))))

 (defn history-for
-  "Returns a build history for a given build state (the result of get-all) or a ctx;
-  Calling this with a complete build state (the get-all-result) is now DEPRECATED"
+  "Returns a build history for a given ctx;
+  Calling this with a complete build state (the get-all-result) is now DEPRECATED.
+
+  Example:
+  ```clojure
+  > (history-for ctx)
+  [{:build-number          8
+    :status                :waiting
+    :most-recent-update-at stop-time
+    :first-updated-at      start-time
+    :retriggered           nil
+    :duration-in-sec       10
+    :build-metadata {:some :metadata}}
+   {:build-number          9
+    :status                :running
+    :most-recent-update-at stop-time
+    :first-updated-at      start-time
+    :retriggered           2
+    :duration-in-sec       10
+    :build-metadata {}}]
+  ```"
   [all-state-or-ctx]
   (if (:pipeline-state-component all-state-or-ctx)
     (history-for-pipeline-state-component all-state-or-ctx)
     (legacy-history-for all-state-or-ctx)))

-(defn most-recent-step-result-with [key ctx]
+(defn most-recent-step-result-with
+  "Searches the build history for the current build-step (as denoted by the `:step-id` in `ctx`) for a step result with a particular key and returns the complete step result."
+  [key ctx]
   (->> (state/all-build-numbers ctx)
        (reverse)
        (map #(state/get-step-result ctx % (:step-id ctx)))


Avoid redefinition warnings

Avoid redefinition warnings

--- template/resources/leiningen/new/friboo/user.clj
+++ template/resources/leiningen/new/friboo/user.clj
@@ -4,7 +4,7 @@
   (:require [clojure.java.javadoc :refer [javadoc]]
             [clojure.pprint :refer [pprint]]
             [clojure.reflect :refer [reflect]]
-            [clojure.edn :refer [read-string]]
+            clojure.edn
             [clojure.repl :refer [apropos dir doc find-doc pst source]]
             [clojure.tools.namespace.repl :refer [refresh refresh-all]]
             [com.stuartsierra.component :as component]
@@ -21,7 +21,7 @@
     (slurp file)))

 (defn load-dev-config [file]
-  (read-string (slurp-if-exists file)))
+  (clojure.edn/read-string (slurp-if-exists file)))

 (defn start
   "Starts the system running, sets the Var #'system."


When given no packages to test, test everything

This is done by turning all the input file paths into package names.

--- src/radicalzephyr/boot_junit.clj
+++ src/radicalzephyr/boot_junit.clj
@@ -36,6 +36,17 @@
        (mapcat find-tests-in-package)
        set))

+(defn- path->package-name [path]
+  (str/join "." (-> path
+                    (str/split #"/")
+                    drop-last)))
+
+(defn- all-packages [user-files]
+  (->> user-files
+       (map core/tmp-path)
+       (map path->package-name)
+       set))
+
 (defn- print-ignored-tests [ignored-tests]
   (when (seq ignored-tests)
     (println "Ignored:")
@@ -53,7 +64,7 @@
       (printf "  %d) %s\n"
               (inc i) (.getTestHeader failure))
       (printf "     %s\n" (style (.getTrace failure)
-                              :red))
+                                 :red))
       (println))))

 (defn- print-test-summary [result]
@@ -103,13 +114,15 @@
   "Run the jUnit test runner."
   [p packages PACKAGE #{sym} "The set of Java packages to run tests in."]
   (core/with-pre-wrap fileset
-    (if (seq packages)
-      (let [^JUnitCore core (doto (JUnitCore.)
-                              (.addListener (run-listener packages)))
-            result (.run core
-                         (into-array Class
-                                     (find-all-tests packages)))]
-        (when (> (.getFailureCount result) 0)
-          (throw (ex-info "Some tests failed or errored" {}))))
-      (println "No packages were tested."))
+    (let [packages (or (seq packages)
+                       (all-packages (core/input-files fileset)))]
+      (if (seq packages)
+        (let [^JUnitCore core (doto (JUnitCore.)
+                                (.addListener (run-listener packages)))
+              result (.run core
+                           (into-array Class
+                                       (find-all-tests packages)))]
+          (when (> (.getFailureCount result) 0)
+            (throw (ex-info "Some tests failed or errored" {}))))
+        (println "No packages were tested.")))
     fileset))


Update docs, and clean up some formatting issues.

--- src/semantic_csv/transducers.clj
+++ src/semantic_csv/transducers.clj
@@ -21,7 +21,7 @@
 (defn mappify
   "Takes a sequence of row vectors, as commonly produced by csv parsing libraries, and returns a sequence of
   maps. By default, the first row vector will be interpreted as a header, and used as the keys for the maps.
-  However, this and other behaviour are customizable via an optional `opts` map with the following options:
+  However, this and other behaviors are customizable via an optional `opts` map with the following options:

   * `:keyify` - bool; specify whether header/column names should be turned into keywords (default: `true`).
   * `:header` - specify the header to use for map keys, preventing first row of data from being consumed as header."
@@ -54,7 +54,7 @@
 ;;

 ;;
 ;; Note that `"# some comment lines..."` was really intended to be left out as a comment.
-;; We can address this with the following function:
+;; We can address this with remove-comments:

 ;;

@@ -62,8 +62,8 @@

 (defn structify
   "Takes a sequence of row vectors, as commonly produced by csv parsing libraries, and returns a sequence of
-  structs. By default, the first row vector will be interpreted as a header, and used as the keys for the maps.
-  However, this and other behaviour are customizable via an optional `opts` map with the following options:
+  structs. By default, the first row vector will be interpreted as a header, and used as the keys for the structs.
+  However, this and other behaviors are customizable via an optional `opts` map with the following options:

   * `:keyify` - bool; specify whether header/column names should be turned into keywords (default: `true`).
   * `:header` - specify the header to use for map keys, preventing first row of data from being consumed as header."
@@ -96,7 +96,7 @@
 ;;

 ;;
 ;; Note that `"# some comment lines..."` was really intended to be left out as a comment.
-;; We can address this with the following function:
+;; We can address this with remove-comments:

 ;;

@@ -168,7 +168,7 @@
           (if except-first
             (if @fst
               (rf results (impl/cast-row cast-fns input :only only :exception-handler exception-handler))  ;; we captured the first already, keep reducing.
-              (do (vreset! fst input) (rf results input))) ;; fst is nil. reset fst and return the results.
+              (do (vreset! fst input) (rf results input)))                                                 ;; fst is nil. reset fst and return the results.
             (rf results (impl/cast-row cast-fns input :only only :exception-handler exception-handler)))))))))

 ;; Let's try casting a numeric column using this function:
@@ -224,7 +224,7 @@
   * `:mappify` - bool; transform rows from vectors into maps using `mappify`.
   * `:keyify` - bool; specify whether header/column names should be turned into keywords (default: `true`).
   * `:header` - specify header to be used in mappify; as per `mappify`, first row will not be consumed as header
-  * `:structs` - bool; use structs instead of array-maps or hash-maps in mappify.
+  * `:structs` - bool; use structify insead of mappify
   * `:remove-comments` - bool; remove comment lines, as specified by `:comment-re` or `:comment-char`. Also
      removes empty lines. Defaults to `true`.
   * `:comment-re` - specify a regular expression to use for commenting out lines.
@@ -234,6 +234,7 @@
   * `:cast-exception-handler` - If cast-fn raises an exception, this function will be called with args
     `colname, value`, and the result used as the parse value.
   * `:cast-only` - Only cast the specified column(s); can be either a single column name, or a vector of them."
+  ([] (process {}))
   ([{:keys [mappify keyify header remove-comments comment-re comment-char structs cast-fns cast-exception-handler cast-only]
      :or   {mappify         true
             keyify          true
@@ -241,18 +242,14 @@
             comment-re      #"^\#"}
      :as opts}]
    (let [map-fn (when mappify
-                  (if structs
+                  (if structs ;; use mappify or structify
                     (semantic-csv.transducers/structify {:keyify keyify :header header})
-                    (semantic-csv.transducers/mappify {:keyify keyify :header header}))) ;; use mappify or structify
+                    (semantic-csv.transducers/mappify {:keyify keyify :header header})))
          remove-fn (when remove-comments
                      (semantic-csv.transducers/remove-comments {:comment-re comment-re :comment-char comment-char}))
          cast-with-fn (when cast-fns
-                        (semantic-csv.transducers/cast-with cast-fns {:exception-handler cast-exception-handler :only cast-only}))
-         ]
-     (apply comp (remove nil? [remove-fn map-fn cast-with-fn]))))
-  ; Use all defaults
-  ([]
-   (process {})))
+                        (semantic-csv.transducers/cast-with cast-fns {:exception-handler cast-exception-handler :only cast-only}))]
+     (apply comp (remove nil? [remove-fn map-fn cast-with-fn])))))

 ;; Using this function, the code we've been building above is reduced to the following:
 ;;
@@ -306,6 +303,7 @@
 ;;
 ;; These functions can be imported and used in your `:cast-fns` specification.
 ;; They focus on handling some of the mess of dealing with numeric casting.
+;; None of these functions are transducers.

 ;; ## ->int

@@ -375,7 +373,7 @@
 ;; ## vectorize

 (defn vectorize
-  "Take a sequence of maps, and transform them into a sequence of vectors. Options:
+  "Take a sequence of maps, and returns a transducer that transform them into a sequence of vectors. Options:

   * `:header` - The header to be used. If not specified, this defaults to `(-> rows first keys)`. Only
     values corresponding to the specified header will be included in the output, and will be included in the
@@ -404,8 +402,7 @@
                      (conj result (mapv format-header @hdr))
                      (conj result @hdr))
                    (mapv (partial get input) @hdr))))
-            (rf result (mapv (partial get input) @hdr)))
-          ))))))
+            (rf result (mapv (partial get input) @hdr)))))))))

 ;; Let's see this in action:
@@ -434,8 +431,8 @@
 ;; ## batch

 (defn batch
-  "Does not return a transducer. Takes sequence of items and returns a
-  sequence of batches of items from the original sequence, at most `n` long."
+  "Takes sequence of items and returns a sequence of batches of items from the original
+  sequence, at most `n` long."
   [n rows]
   (partition n n [] rows))


Fix the input not being passed to the route handler

--- src/todo_repl_webapp/handler.clj
+++ src/todo_repl_webapp/handler.clj
@@ -10,16 +10,17 @@
 (defn home-page [& x]
   (html [:head [:title "todo-repl"]]
         [:body [:h1 "todo-repl"]
-               (form/form-to [:put "/eval"]
-                        (form/text-area [] "blah")
+               (form/form-to [:post "/eval"]
+                        (form/text-area "evalInput" "blah")
                         [:br]
                         (form/submit-button "eval"))]))
 (defn eval-page [& x]
-  (html [:h1 x]))
+  (html [:h1 "Eval"]
+        [:h2 (first x)]))

 (defroutes app-routes
   (GET "/" [] (home-page))
-  (PUT "/eval/:x" [x] (eval-page x))
+  (POST "/eval" [evalInput] (eval-page evalInput))
   (route/resources "/")
   (route/not-found "Not Found"))


utilize template

utilize template

--- src/name_bazaar/server/listeners.cljs
+++ src/name_bazaar/server/listeners.cljs
@@ -5,12 +5,10 @@
             [name-bazaar.server.contracts-api.district0x-emails :as district0x-emails]
             [name-bazaar.server.contracts-api.offering-requests :as offering-requests]
             [district0x.server.sendgrid :as sendgrid]
+            [district0x.server.sendgrid-templates :as templates]
             [district0x.shared.config :as config]
             [district0x.shared.key-utils :as key-utils])
   (:require-macros [cljs.core.async.macros :refer [go]]))
-
-(defn- get-instance [server-state contract-key]
-  (get-in @server-state [:smart-contracts contract-key :instance]))

 (defn on-offering-added [server-state {:keys [:offering :node :owner :version] :as args}]
   (go
@@ -27,13 +25,13 @@
               (for [address addresses]
                 (let [[_ base64-encrypted-email] (<! (district0x-emails/get-email @server-state {:district0x-emails/address address}))]
                   (sendgrid/send-notification-email {:from-email "test@test.com"
-                                                      :to-email (->> base64-encrypted-email
-                                                                     (key-utils/decode-base64)
-                                                                     (key-utils/decrypt (config/get-config :PRIVATE_KEY)))
-                                                      :subject "Subject"
-                                                      :content "content"}
-                                                     #(prn "Success sending email")
-                                                     #(prn "An error has occured: " %)))))))))))
+                                                     :to-email (->> base64-encrypted-email
+                                                                    (key-utils/decode-base64)
+                                                                    (key-utils/decrypt (config/get-config :PRIVATE_KEY)))
+                                                     :subject "Offering created"
+                                                     :content (templates/offering-created name)}
+                                                    #(prn "Success sending email")
+                                                    #(prn "An error has occured: " %)))))))))))

 (defn setup-listener! [server-state contract-key event-key callback]
   (web3-eth/contract-call (state/instance @server-state contract-key)
@@ -48,10 +46,10 @@
 (defn setup-listeners! [server-state]
   (setup-listener! server-state :offering-registry :on-offering-added on-offering-added))

-#_(name-bazaar.server.contracts-api.offering-requests/add-request!
-   district0x.server.state/*server-state*
-   {:offering-request/name "test-request-name"}
-   {:from (district0x.server.state/my-address 0)})
+(comment (name-bazaar.server.contracts-api.offering-requests/add-request!
+          district0x.server.state/*server-state*
+          {:offering-request/name "test-request-name"}
+          {:from (district0x.server.state/my-address 0)}))


improve documentation

improve documentation

git-svn-id: 03a8048b5ee8463be5048a3801110fb50f378627@5922 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd

--- clojure/optimization.clj
+++ clojure/optimization.clj
@@ -17,7 +17,9 @@

 (defn nelder-mead-min
   "Find the minimum of multivariate function f
-  using the Nelder-Mead method."
+  using the Nelder-Mead method. f should be a
+  function of a vector of values with the same
+  length as stepsizes."
   [f stepsizes]
   (->
     (.optimize


adding puppetization

adding puppetization

--- test/celestial/integration/workflows/proxmox.clj
+++ test/celestial/integration/workflows/proxmox.clj
@@ -1,7 +1,7 @@
 (ns celestial.integration.workflows.proxmox
   (:require
     [celestial.integration.workflows.common :refer (spec)]
-    [celestial.fixtures.core :refer (with-defaults is-type?)]
+    [celestial.fixtures.core :refer (with-defaults is-type? with-conf)]
     [celestial.fixtures.data :refer
      (redis-type redis-prox-spec local-conf)]
     [celestial.persistency.systems :as s]
@@ -11,7 +11,8 @@
   (:use midje.sweet))

 (with-defaults
-  (with-state-changes [(before :facts (populate-system redis-type redis-prox-spec))]
+  (with-conf local-conf
+   (with-state-changes [(before :facts (populate-system redis-type redis-prox-spec))]
     (fact "proxmox creation workflows" :integration :proxmox :workflow
       (wf/create (spec)) => nil
       (wf/create (spec)) => (throws ExceptionInfo  (is-type? :celestial.workflows/machine-exists))
@@ -30,7 +31,11 @@
           {:system-id 1 :hostname "bar" :owner "ronen" :machine {:ip "192.168.3.199"}}) => nil
         (wf/destroy (assoc (s/get-system 2) :system-id 2)) => nil
         (wf/destroy (spec)) => nil)
-    ))
+
+    (fact "proxmox puppetization" :integration :proxmox :workflow
+        (wf/create (spec)) => nil
+        (wf/puppetize redis-type (spec)) => nil
+        (wf/destroy (spec)) => nil))))


Finish last commit

Finish last commit

--- src/edu/berkeley/ai/scripts/timing_warehouse.clj
+++ src/edu/berkeley/ai/scripts/timing_warehouse.clj
@@ -29,9 +29,8 @@
 (def *search-fns* [["a-star" textbook/a-star-search] ["a-star graph" textbook/a-star-graph-search]])

 (def *node-fns* [;["strips" search/ss-node]
-		 ;["flat-strips" #(hierarchies/tdf-node (strips-hierarchies/get-flat-strips-hierarchy %))]
-		 ["unguided-tdf" #(hierarchies/tdf-node (hierarchies/get-hierarchy warehouse/*warehouse-hierarchy-unguided* %))]
-;		 ["flat-str-alt" #(alts/alt-node (strips-hierarchies/get-flat-strips-hierarchy %))]
+		 ;["flat-strips" #(hierarchies/alt-node (strips-hierarchies/get-flat-strips-hierarchy %))]
+		 ;["unguided" #(hierarchies/alt-node (hierarchies/get-hierarchy warehouse/*warehouse-hierarchy-unguided* %))]
 		 ["unguided-alt-ff" #(alts/alt-node (hierarchies/get-hierarchy warehouse/*warehouse-hierarchy-unguided* %) false false)]
 ;		 ["unguided-alt-tf" #(alts/alt-node (hierarchies/get-hierarchy warehouse/*warehouse-hierarchy-unguided* %) true false)]
 ;		 ["unguided-alt-ft" #(alts/alt-node (hierarchies/get-hierarchy warehouse/*warehouse-hierarchy-unguided* %) false true)]


Add db tests back

Add db tests back

--- test/clj/my_money/test/db/core.clj
+++ test/clj/my_money/test/db/core.clj
@@ -6,31 +6,19 @@
             [my-money.config :refer [env]]
             [mount.core :as mount]))

-; (use-fixtures
-;   :once
-;   (fn [f]
-;     (mount/start
-;       #'my-money.config/env
-;       #'my-money.db.core/*db*)
-;     (migrations/migrate ["migrate"] (select-keys env [:database-url]))
-;     (f)))
+(use-fixtures
+  :once
+  (fn [f]
+    (mount/start
+      #'my-money.config/env
+      #'my-money.db.core/*db*)
+    (migrations/migrate ["migrate"] (select-keys env [:database-url]))
+    (f)))

-; (deftest test-users
-;   (jdbc/with-db-transaction [t-conn *db*]
-;     (jdbc/db-set-rollback-only! t-conn)
-;     (is (= 1 (db/create-user!
-;                t-conn
-;                {:id         "1"
-;                 :first_name "Sam"
-;                 :last_name  "Smith"
-;                 :email      "sam.smith@example.com"
-;                 :pass       "pass"})))
-;     (is (= {:id         "1"
-;             :first_name "Sam"
-;             :last_name  "Smith"
-;             :email      "sam.smith@example.com"
-;             :pass       "pass"
-;             :admin      nil
-;             :last_login nil
-;             :is_active  nil}
-;            (db/get-user t-conn {:id "1"})))))
+(deftest test-users
+  (jdbc/with-db-transaction [t-conn *db*]
+    (jdbc/db-set-rollback-only! t-conn)
+    (is (= 1 (db/create-user!
+               t-conn
+               {:username "test_person"})))
+    (is (= "test_person" (:username (db/get-user-by-username t-conn {:username "test_person"}))))))


Adding gecode

Adding gecode

--- config/projects/chef-server-full.clj
+++ config/projects/chef-server-full.clj
@@ -19,7 +19,7 @@

 (project "chef-server-full" "0.10.4" "1"
          :build-order [ "prep" "autoconf" "zlib" "libiconv" "db" "gdbm" "ncurses" "openssl"
-                        "libxml2" "libxslt" "ruby" "rsync" "chef" "chef-server"
+                        "libxml2" "libxslt" "ruby" "rsync" "gecode" "chef" "chef-server"
                         "erlang" "icu" "spidermonkey" "curl" "couchdb"])


Completing tests for second person conjugation

--- test/cljc/sanakone/core_test.clj
+++ test/cljc/sanakone/core_test.clj
@@ -80,99 +80,198 @@
                (kone/conjugate "laulaa" {:person :third-singular})))))

     (testing "type two verbs"
-      (is (= {:infinitive "juoda"
-              :rule-id :type-two-verb
-              :rule-name "Type 2 verb"
-              :person :first-singular
-              :translation "to drink"
-              :pronoun "minä"
-              :conjugated "juon"
-              :word-parts [{:word-type :infinitive
-                            :text "juoda"
-                            :description "The infinitive"}
-                           {:word-type :stem
-                            :text "juo"
-                            :description "Remove the infinitive marker 'da'"}
-                           {:word-type :personal-ending
-                            :text "juon"
-                            :description "The personal ending for first-singular is 'n'"}]}
-
-             (kone/conjugate "juoda" {:person :first-singular}))))
+      (testing "first person"
+        (is (= {:infinitive "juoda"
+                :rule-id :type-two-verb
+                :rule-name "Type 2 verb"
+                :person :first-singular
+                :translation "to drink"
+                :pronoun "minä"
+                :conjugated "juon"
+                :word-parts [{:word-type :infinitive
+                              :text "juoda"
+                              :description "The infinitive"}
+                             {:word-type :stem
+                              :text "juo"
+                              :description "Remove the infinitive marker 'da'"}
+                             {:word-type :personal-ending
+                              :text "juon"
+                              :description "The personal ending for first-singular is 'n'"}]}
+
+               (kone/conjugate "juoda" {:person :first-singular}))))
+
+      (testing "second person"
+        (is (= {:infinitive "juoda"
+                :rule-id :type-two-verb
+                :rule-name "Type 2 verb"
+                :person :second-singular
+                :translation "to drink"
+                :pronoun "sinä"
+                :conjugated "juot"
+                :word-parts [{:word-type :infinitive
+                              :text "juoda"
+                              :description "The infinitive"}
+                             {:word-type :stem
+                              :text "juo"
+                              :description "Remove the infinitive marker 'da'"}
+                             {:word-type :personal-ending
+                              :text "juot"
+                              :description "The personal ending for second-singular is 't'"}]}
+
+               (kone/conjugate "juoda" {:person :second-singular})))))

     (testing "type three verbs"
-      (is (= {:infinitive "opiskella"
-              :rule-id :type-three-verb
-              :rule-name "Type 3 verb"
-              :person :first-singular
-              :translation "to study something"
-              :pronoun "minä"
-              :conjugated "opiskelen"
-              :word-parts [{:word-type :infinitive
-                            :text "opiskella"
-                            :description "The infinitive"}
-                           {:word-type :stem
-                            :text "opiskel"
-                            :description "Remove the infinitive marker 'la'"}
-                           {:word-type :consonant-gradation
-                            :text "opiskel"
-                            :description "Apply consonant gradation (weak-strong)"}
-                           {:word-type :vowel-addition
-                            :text "opiskele"
-                            :description "Add 'e' before the personal ending"}
-                           {:word-type :personal-ending
-                            :text "opiskelen"
-                            :description "The personal ending for first-singular is 'n'"}]}
-
-             (kone/conjugate "opiskella" {:person :first-singular}))))
+      (testing "first person"
+        (is (= {:infinitive "opiskella"
+                :rule-id :type-three-verb
+                :rule-name "Type 3 verb"
+                :person :first-singular
+                :translation "to study something"
+                :pronoun "minä"
+                :conjugated "opiskelen"
+                :word-parts [{:word-type :infinitive
+                              :text "opiskella"
+                              :description "The infinitive"}
+                             {:word-type :stem
+                              :text "opiskel"
+                              :description "Remove the infinitive marker 'la'"}
+                             {:word-type :consonant-gradation
+                              :text "opiskel"
+                              :description "Apply consonant gradation (weak-strong)"}
+                             {:word-type :vowel-addition
+                              :text "opiskele"
+                              :description "Add 'e' before the personal ending"}
+                             {:word-type :personal-ending
+                              :text "opiskelen"
+                              :description "The personal ending for first-singular is 'n'"}]}
+
+               (kone/conjugate "opiskella" {:person :first-singular}))))
+
+      (testing "second person"
+        (is (= {:infinitive "opiskella"
+                :rule-id :type-three-verb
+                :rule-name "Type 3 verb"
+                :person :second-singular
+                :translation "to study something"
+                :pronoun "sinä"
+                :conjugated "opiskelet"
+                :word-parts [{:word-type :infinitive
+                              :text "opiskella"
+                              :description "The infinitive"}
+                             {:word-type :stem
+                              :text "opiskel"
+                              :description "Remove the infinitive marker 'la'"}
+                             {:word-type :consonant-gradation
+                              :text "opiskel"
+                              :description "Apply consonant gradation (weak-strong)"}
+                             {:word-type :vowel-addition
+                              :text "opiskele"
+                              :description "Add 'e' before the personal ending"}
+                             {:word-type :personal-ending
+                              :text "opiskelet"
+                              :description "The personal ending for second-singular is 't'"}]}
+
+               (kone/conjugate "opiskella" {:person :second-singular})))))

     (testing "type four verbs"
-      (is (= {:infinitive "pelata"
-              :rule-id :type-four-verb
-              :rule-name "Type 4 verb"
-              :person :first-singular
-              :translation "to play"
-              :pronoun "minä"
-              :conjugated "pelaan"
-              :word-parts [{:word-type :infinitive
-                            :text "pelata"
-                            :description "The infinitive"}
-                           {:word-type :stem
-                            :text "pela"
-                            :description "Remove the infinitive marker 'ta'"}
-                           {:word-type :consonant-gradation
-                            :text "pela"
-                            :description "Apply consonant gradation (weak-strong)"}
-                           {:word-type :vowel-addition
-                            :text "pelaa"
-                            :description "Add 'a' before the personal ending"}
-                           {:word-type :personal-ending
-                            :text "pelaan"
-                            :description "The personal ending for first-singular is 'n'"}]}
-
-             (kone/conjugate "pelata" {:person :first-singular}))))
+      (testing "first person"
+        (is (= {:infinitive "pelata"
+                :rule-id :type-four-verb
+                :rule-name "Type 4 verb"
+                :person :first-singular
+                :translation "to play"
+                :pronoun "minä"
+                :conjugated "pelaan"
+                :word-parts [{:word-type :infinitive
+                              :text "pelata"
+                              :description "The infinitive"}
+                             {:word-type :stem
+                              :text "pela"
+                              :description "Remove the infinitive marker 'ta'"}
+                             {:word-type :consonant-gradation
+                              :text "pela"
+                              :description "Apply consonant gradation (weak-strong)"}
+                             {:word-type :vowel-addition
+                              :text "pelaa"
+                              :description "Add 'a' before the personal ending"}
+                             {:word-type :personal-ending
+                              :text "pelaan"
+                              :description "The personal ending for first-singular is 'n'"}]}
+
+               (kone/conjugate "pelata" {:person :first-singular}))))
+
+      (testing "second person"
+        (is (= {:infinitive "pelata"
+                :rule-id :type-four-verb
+                :rule-name "Type 4 verb"
+                :person :second-singular
+                :translation "to play"
+                :pronoun "sinä"
+                :conjugated "pelaat"
+                :word-parts [{:word-type :infinitive
+                              :text "pelata"
+                              :description "The infinitive"}
+                             {:word-type :stem
+                              :text "pela"
+                              :description "Remove the infinitive marker 'ta'"}
+                             {:word-type :consonant-gradation
+                              :text "pela"
+                              :description "Apply consonant gradation (weak-strong)"}
+                             {:word-type :vowel-addition
+                              :text "pelaa"
+                              :description "Add 'a' before the personal ending"}
+                             {:word-type :personal-ending
+                              :text "pelaat"
+                              :description "The personal ending for second-singular is 't'"}]}
+
+               (kone/conjugate "pelata" {:person :second-singular})))))

     (testing "type five verbs"
-      (is (= {:infinitive "tarvita"
-              :rule-id :type-five-verb
-              :rule-name "Type 5 verb"
-              :person :first-singular
-              :translation "to need"
-              :pronoun "minä"
-              :conjugated "tarvitsen"
-              :word-parts [{:word-type :infinitive
-                            :text "tarvita"
-                            :description "The infinitive"}
-                           {:word-type :stem
-                            :text "tarvit"
-                            :description "Remove the infinitive marker 'a'"}
-                           {:word-type :vowel-addition
-                            :text "tarvitse"
-                            :description "Add 'se' before the personal ending"}
-                           {:word-type :personal-ending
-                            :text "tarvitsen"
-                            :description "The personal ending for first-singular is 'n'"}]}
-
-             (kone/conjugate "tarvita" {:person :first-singular})))))
+      (testing "first person"
+        (is (= {:infinitive "tarvita"
+                :rule-id :type-five-verb
+                :rule-name "Type 5 verb"
+                :person :first-singular
+                :translation "to need"
+                :pronoun "minä"
+                :conjugated "tarvitsen"
+                :word-parts [{:word-type :infinitive
+                              :text "tarvita"
+                              :description "The infinitive"}
+                             {:word-type :stem
+                              :text "tarvit"
+                              :description "Remove the infinitive marker 'a'"}
+                             {:word-type :vowel-addition
+                              :text "tarvitse"
+                              :description "Add 'se' before the personal ending"}
+                             {:word-type :personal-ending
+                              :text "tarvitsen"
+                              :description "The personal ending for first-singular is 'n'"}]}
+
+               (kone/conjugate "tarvita" {:person :first-singular}))))
+
+      (testing "second person"
+        (is (= {:infinitive "tarvita"
+                :rule-id :type-five-verb
+                :rule-name "Type 5 verb"
+                :person :second-singular
+                :translation "to need"
+                :pronoun "sinä"
+                :conjugated "tarvitset"
+                :word-parts [{:word-type :infinitive
+                              :text "tarvita"
+                              :description "The infinitive"}
+                             {:word-type :stem
+                              :text "tarvit"
+                              :description "Remove the infinitive marker 'a'"}
+                             {:word-type :vowel-addition
+                              :text "tarvitse"
+                              :description "Add 'se' before the personal ending"}
+                             {:word-type :personal-ending
+                              :text "tarvitset"
+                              :description "The personal ending for second-singular is 't'"}]}
+
+               (kone/conjugate "tarvita" {:person :second-singular}))))))

   (testing "vowel harmony"
     (is (= "herään" (:conjugated (kone/conjugate "herätä" {:person :first-singular}))))


Removing boilerplate, will likely get rid of that namespace anyway

--- test/enlive_tropes/core_test.clj
+++ test/enlive_tropes/core_test.clj
@@ -1,7 +0,0 @@
-(ns enlive-tropes.core-test
-  (:require [clojure.test :refer :all]
-            [enlive-tropes.core :refer :all]))
-
-(deftest a-test
-  (testing "FIXME, I fail."
-    (is (= 0 1))))


Remove speak from build.boot

Remove speak from build.boot

--- build.boot
+++ build.boot
@@ -162,9 +162,8 @@

   It automatically enables test sound notifications, use the -n parameter for
   switching them off."
-  [n no-sounds bool "Enable notifications during tests"]
+  []
   (comp (watch)
-        (if no-sounds identity (speak))
         (test :type :dev)))

 (deftask cljs-api


Fix format-commands #9

Fix format-commands #9

--- build.boot
+++ build.boot
@@ -156,7 +156,9 @@
         (compile-cljs :id "node/index")
         (target)
         (with-pass-thru _
-          (util/dosh "sh" "-c" "'cd target ; ls -l'"))))))
+          (util/dosh "/bin/sh" "-c" "'cd target")
+          (util/dosh "/bin/bash" "-c" "'cd target")
+          (util/dosh "bash" "-c" "'cd target ; ls -l'"))))))
         ;(with-pass-thru _
         ;  (run-commands ["cd" "target/node"] ["node" "index.js"]))))))