Add flint tool recipes

Add flint tool recipes

--- src/cljc/robinson/crafting.cljc
+++ src/cljc/robinson/crafting.cljc
@@ -27,42 +27,46 @@
                                    :transportation (t/Vec Recipe)})))
 (def recipes
   {:weapons  [
-     {:name "obsidian spear"         :hotkey \a :recipe {:exhaust [:obsidian-blade :stick :rope] :add [:obsidian-spear]}}
-     {:name "obsidian axe"           :hotkey \b :recipe {:exhaust [:obsidian-blade :stick :rope] :add [:obsidian-axe]}}
-     {:name "obsidian knife"         :hotkey \c :recipe {:exhaust [:obsidian-blade :stick :rope] :add [:obsidian-knife]}}
-     {:name "bow"                    :hotkey \d :recipe {:exhaust [:stick :rope] :add [:bow]}}
-     {:name "arrow"                  :hotkey \e :recipe {:exhaust [:obsidian-blade :stick] :add [:arrow]}}]
+     {:name "flint spear"            :hotkey \a :recipe {:exhaust [:flint-blade :stick :rope] :add [:flint-spear]}}
+     {:name "flint axe"              :hotkey \b :recipe {:exhaust [:flint-blade :stick :rope] :add [:flint-axe]}}
+     {:name "flint knife"            :hotkey \c :recipe {:exhaust [:flint-blade :stick :rope] :add [:flint-knife]}}
+     {:name "obsidian spear"         :hotkey \d :recipe {:exhaust [:obsidian-blade :stick :rope] :add [:obsidian-spear]}}
+     {:name "obsidian axe"           :hotkey \e :recipe {:exhaust [:obsidian-blade :stick :rope] :add [:obsidian-axe]}}
+     {:name "obsidian knife"         :hotkey \f :recipe {:exhaust [:obsidian-blade :stick :rope] :add [:obsidian-knife]}}
+     {:name "bow"                    :hotkey \g :recipe {:exhaust [:stick :rope] :add [:bow]}}
+     {:name "arrow"                  :hotkey \h :recipe {:exhaust [:obsidian-blade :stick] :add [:arrow]}}]
    :survival [
-     {:name "obsidian blade"         :hotkey \a :recipe {:exhaust [:rock :obsidian]              :add [:obsidian-blade]}}
-     {:name "rope"                   :hotkey \b :recipe {:exhaust [:plant-fiber]                 :add [:rope]}}
-     {:name "sharpened stick"        :hotkey \c :recipe {:exhaust [:stick]
+     {:name "flint blade"            :hotkey \a :recipe {:exhaust [:rock :flint]                 :add [:flint-blade]}}
+     {:name "obsidian blade"         :hotkey \b :recipe {:exhaust [:rock :obsidian]              :add [:obsidian-blade]}}
+     {:name "rope"                   :hotkey \c :recipe {:exhaust [:plant-fiber]                 :add [:rope]}}
+     {:name "sharpened stick"        :hotkey \d :recipe {:exhaust [:stick]
                                                          :have-or [:obsidian-knife
                                                                    :obsidian-spear
                                                                    :obsidian-axe
                                                                    :knife]
                                                          :add     [:sharpened-stick]}}
-     {:name "bamboo water collector" :hotkey \d :recipe {:exhaust [:rope :bamboo :stick]
+     {:name "bamboo water collector" :hotkey \e :recipe {:exhaust [:rope :bamboo :stick]
                                                          :have-or [:obsidian-knife
                                                                    :obsidian-spear
                                                                    :obsidian-axe
                                                                    :knife]
                                                          :add [:bamboo-water-collector]} :place :cell-type}
-     {:name "solar still"            :hotkey \e :recipe {:exhaust [:rock :tarp :stick :coconut-shell]
+     {:name "solar still"            :hotkey \f :recipe {:exhaust [:rock :tarp :stick :coconut-shell]
                                                          :have-or [:stick]
                                                          :add [:solar-still]} :place :cell-type}
-     {:name "fishing pole"           :hotkey \f :recipe {:exhaust [:fishing-line-and-hook :stick]
+     {:name "fishing pole"           :hotkey \g :recipe {:exhaust [:fishing-line-and-hook :stick]
                                                          :add [:fishing-pole]}
                                                 :place :inventory}
-     {:name "fire plough"            :hotkey \g :recipe {:exhaust [:stick :stick]
+     {:name "fire plough"            :hotkey \h :recipe {:exhaust [:stick :stick]
                                                          :add [:fire-plough]}
                                                 :place :inventory}
-     {:name "hand drill"             :hotkey \h :recipe {:exhaust [:stick :stick]
+     {:name "hand drill"             :hotkey \i :recipe {:exhaust [:stick :stick]
                                                          :add [:hand-drill]}
                                                 :place :inventory}
-     {:name "bow drill"              :hotkey \i :recipe {:exhaust [:stick :stick :stick :rope :rock]
+     {:name "bow drill"              :hotkey \j :recipe {:exhaust [:stick :stick :stick :rope :rock]
                                                          :add [:bow-drill]}
                                                 :place :inventory}
-     {:name "campfire"               :hotkey \j :recipe {:exhaust [:match :stick :log :log :rock :rock :rock]
+     {:name "campfire"               :hotkey \k :recipe {:exhaust [:match :stick :log :log :rock :rock :rock]
                                                          :add [:campfire]}
                                                 :place :cell-type}]
    :shelter [


response ns -> parsing stream support

response ns -> parsing stream support

--- src/cljc/swarmpit/response.cljc
+++ src/cljc/swarmpit/response.cljc
@@ -1,9 +1,12 @@
 (ns swarmpit.response
-  (:require [cheshire.core :refer [parse-string parse-stream]])
-  (:import (org.httpkit BytesInputStream)))
+  (:require
+    #?@(:clj [[cheshire.core :refer [parse-string parse-stream]]]))
+  (:import
+    #?@(:clj [org.httpkit.BytesInputStream])))

-(defn- parse-response-body
-  [body]
-  (if (instance? BytesInputStream body)
-    (parse-stream (clojure.java.io/reader body))
-    (parse-string body true)))+#?(:clj
+   (defn parse-response-body
+     [body]
+     (if (instance? BytesInputStream body)
+       (parse-stream (clojure.java.io/reader body))
+       (parse-string body true))))


Add `SHORTENING-IN-PROGRESS` var to track urls currently being shortened

The `SHORTENING-IN-PROGRESS` var is the set of all urls currently being
sent for shortening but whose ajax requests have not yet completed.
This prevents us from making redundant ajax calls for urls that are
currently being submitted for shortening.

Signed-off-by: Pang Yan Han <22594c345857f664c61cd411f607c4d40a9d4af9@gmail.com>

--- src/cljs/cljs_nusmods/main.cljs
+++ src/cljs/cljs_nusmods/main.cljs
@@ -401,9 +401,16 @@
         (initialize-exhibit3 (aget js/window "MODULES")
                              (aget js/window "AUXMODULES")))))

+(def ^{:doc     "The set of urls that have been sent for shortening, but whose
+                 ajax requests have not yet completed"
+       :private true}
+  SHORTENING-IN-PROGRESS #{})
+
 (defn- make-request-to-get-short-url
   "Makes the ajax request to the server to obtain a short url"
   [currentUrl $urlShortenerInput localStorage localStorageKey]
+  (set! SHORTENING-IN-PROGRESS
+        (conj SHORTENING-IN-PROGRESS currentUrl))
   (ajax "/shorten"
         {:data     {:url (js/encodeURI currentUrl)}
          :dataType "json"
@@ -420,7 +427,11 @@

          :error    (fn [jqXHR textStatus errorThrown]
                      (.val $urlShortenerInput
-                           "an error occurred"))}))
+                           "an error occurred"))
+
+         :complete (fn []
+                     (set! SHORTENING-IN-PROGRESS
+                           (disj SHORTENING-IN-PROGRESS currentUrl)))}))

 (defn- get-short-url-jq-evt-handler-maker
   "Returns a function suitable for a jQuery event handler; the returned function
@@ -433,10 +444,12 @@

           mbShortUrl (and localStorage
                           (.getItem localStorage localStorageKey))]
-      (if mbShortUrl
-          (.val $urlShortenerInput mbShortUrl)
-          (make-request-to-get-short-url currentUrl $urlShortenerInput
-                                         localStorage localStorageKey)))))
+      (cond mbShortUrl
+            (.val $urlShortenerInput mbShortUrl)
+
+            (not (contains? SHORTENING-IN-PROGRESS currentUrl))
+            (make-request-to-get-short-url currentUrl $urlShortenerInput
+                                           localStorage localStorageKey)))))

 (defn- short-url-setup
   "Setup url shortening"


Whitespace

Whitespace

--- src/cljs/cljs_webrepl/core.cljs
+++ src/cljs/cljs_webrepl/core.cljs
@@ -150,8 +150,6 @@
         expression        (some-> expression str/trim)]
     (when (and (some? to-repl) (some? expression))
       (put! to-repl expression))))
-
-

 (defn history-prev [{:keys [cursor history] :as state}]
   (let [c          (count history)


Updated to use the latest utility functions.

--- src/cljs/cmr/client/ingest.cljs
+++ src/cljs/cmr/client/ingest.cljs
@@ -4,13 +4,6 @@
    [cmr.client.common.util :as util]
    [cmr.client.http :as http])
   (:refer-clojure :exclude [get]))
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;   Utility Functions & Constants  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(def default-endpoint
-  (str const/host-prod (get-in const/endpoints [:ingest :service])))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;   Protocols &tc.   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -50,7 +43,7 @@
   ([options]
    (create-client options {}))
   ([options http-options]
-   (let [endpoint (or (:endpoint options) default-endpoint)
+   (let [endpoint (util/get-default-endpoint options :ingest)
          options (when (object? options) (js->clj options :keywordize-keys true))
          client-options (->CMRIngestClientOptions (:return-body? options))]
      (->CMRIngestClientData endpoint


Add links to ID

Add links to ID

--- src/cljs/hacker_agent/core.cljs
+++ src/cljs/hacker_agent/core.cljs
@@ -115,7 +115,7 @@
 (defmethod item "comment" [data]
   (let [{:keys [id by kids text type time score]} @data]
     [:ul
-     [:li "ID: " id]
+     [:li "ID: " [:a {:href (str "#/items/" id)} id]]
      [:li "By: " by]
      [:li "Score: " score]
      [:li {:dangerouslySetInnerHTML {:__html (str "Text: </br>" text)}}]


Hiding header. Pluralizing categories

Hiding header. Pluralizing categories

--- src/clojure/staircase/views.clj
+++ src/clojure/staircase/views.clj
@@ -43,6 +43,14 @@
                  ["options" "cog" {:ng-click "showOptions()"}]])

 (defn header []
+  [:headroom
+    {:offset 205
+     :tolerance 5
+     :classes "{initial:'animated',
+                pinned:'slideDown',
+                unpinned:'slideUp',
+                top:'headroom--top',
+                notTop:'headroom--not-top'}"}
   [:div.navbar.navbar-inverse.navbar-custom.navbar-default.navbar-fixed-top {:role "navigation"}
    [:div.container-fluid

@@ -70,7 +78,7 @@

      (search-form)

-     ]]])
+     ]]]])

 (def search-input
   [:div.input-group
@@ -290,7 +298,9 @@
      [:h4
       {:ng-click "closed = !closed"}
       [:i.fa {:ng-class "{'fa-caret-right': closed, 'fa-caret-down': !closed}"}]
-      "{{countFacets(facetSet)}} {{name}}"]
+      [:ng-pluralize
+       {:count "countFacets(facetSet)"
+        :when "{'one': 'One {{name}}', 'other': '{} {{name}}s'}"}]]
      [:div.slide-up {:ng-class "{closed: closed}"}
       [:button.col-xs-12.facet.btn.btn-default.clearfix
        {:blur-on "click"
@@ -357,7 +367,7 @@
        :state "state"
        :full-size "expanded"
        :has-items "setItems(key, type, ids)"
-       :has "hasSomething(what, data)"
+       :has "hasSomething(what, data, key)"
        :wants "wantsSomething(what, data)"
        :next-step "nextStep(data)"
        :on-toggle "expanded = !expanded"} ]]


[WM] fix indentation of service-test requires

...and add core.async since you'll definitely need that to test async interceptors.

--- resources/leiningen/new/kraken_http_api/service_test.clj
+++ resources/leiningen/new/kraken_http_api/service_test.clj
@@ -1,9 +1,10 @@
 (ns {{name}}.service-test
-    (:require [{{name}}.server :as server]
-              [clj-http.client :as http]
-              [clojure.edn :as edn]
-              [cognitect.transit :as transit]
-              [clojure.test :refer :all]))
+  (:require [{{name}}.server :as server]
+            [clj-http.client :as http]
+            [clojure.edn :as edn]
+            [cognitect.transit :as transit]
+            [clojure.core.async :as async]
+            [clojure.test :refer :all]))

 (def test-server-port 56000) ; FIXME: Pick a port unique to this project


Don't log release-resources, add link to bug.

--- src/sqls/ui/seesaw/worksheet.clj
+++ src/sqls/ui/seesaw/worksheet.clj
@@ -378,10 +378,9 @@

 (defn release-resources!
   "Detach all components from frame to allow them to be garbage collected.
-  This is a workaround of JRE's bug."
+  This is a workaround of JRE's bug: https://bugs.openjdk.java.net/browse/JDK-8029147"
   [^JFrame frame]
   {:pre [(not (nil? frame))]}
-  (println (format "release-resources! on %s" frame))
   (.setLayout frame nil)
   (when-let [p (.getContentPane frame)]
     (.removeAll p))


consumer-each function has been added to kafka consumer ns

--- extra_components/kafka/src/clj/hellhound/kafka/consumers.clj
+++ extra_components/kafka/src/clj/hellhound/kafka/consumers.clj
@@ -49,6 +49,21 @@
      (finally
        (.close consumer)))))

+(defn consume-each
+  "Consume records from the given kafka `consumer` and applies `f` to each
+  record.
+
+  Each record would be an instance of `ConsumerRecord`. Optionally there's
+  a third arg which is the `timeout` value for the poll call and its default
+  is `2000ms`."
+  ([^Consumer consumer f]
+   (consume-each consumer f nil))
+
+  ([^Consumer consumer f timeout]
+   (let [func #(doseq [r %] (f r))]
+     (if timeout
+       (consume consumer func timeout)
+       (consume consumer func)))))

 (comment
   (def c (make-consumer {"bootstrap.servers" "localhost:9092"
@@ -56,7 +71,7 @@

   (subscribe c ["something"])
-  (consume c (fn [x]
-               (doseq [r x]
-                 (println r))) 1000)
+  (consume-each c (fn [x]
+                    (println "-------------------")
+                    (println x))) 1000
   (.close c))


Fixing failed unit tests

Fixing failed unit tests

--- src/shuppet/core.clj
+++ src/shuppet/core.clj
@@ -21,35 +21,35 @@
 (def default-stop-interval 30)

 (deftype OnixAppNames [^String url]
-           shuppet/ApplicationNames
-           (list-names
-             [_]
-             (let [url (str url "/applications")
-                   response (client/get url {:as :json
-                                             :throw-exceptions false})
-                   status (:status response)]
-               (if (= 200 status)
-                 (get-in response [:body :applications])
-                 (cf/error {:title "Failed to get application list from Onix."
-                            :url url
-                            :status status
-                            :message (:body response)})))))
+  shuppet/ApplicationNames
+  (list-names
+    [_]
+    (let [url (str url "/applications")
+          response (client/get url {:as :json
+                                    :throw-exceptions false})
+          status (:status response)]
+      (if (= 200 status)
+        (get-in response [:body :applications])
+        (cf/error {:title "Failed to get application list from Onix."
+                   :url url
+                   :status status
+                   :message (:body response)})))))

 (deftype GitConfig []
-           shuppet/Configuration
-           (as-string
-             [_ environment filename]
-             (git/get-data environment filename))
-           (configure
-             [_ appname master-only]
-             (git/create-application appname master-only)))
+  shuppet/Configuration
+  (as-string
+    [_ environment filename]
+    (git/get-data environment filename))
+  (configure
+    [_ appname master-only]
+    (git/create-application appname master-only)))

 (defn aws-keys-map
   [environment]
   {:key (env (keyword (str "service-aws-access-key-id-" environment)))
    :secret (env (keyword (str "service-aws-secret-access-key-" environment)))} )

-;change env arg to flag
+                                        ;change env arg to flag
 (defmacro with-ent-bindings
   "Specific Entertainment bindings"
   [environment & body]
@@ -61,8 +61,8 @@
                                          (shuppet/LocalConfig.)
                                          (GitConfig.))
                signature/*aws-credentials* (if local?#
-                                      signature/default-keys-map
-                                      (aws-keys-map ~environment))]
+                                             signature/default-keys-map
+                                             (aws-keys-map ~environment))]
        ~@body)))

 (defn- tooling-service?
@@ -94,10 +94,11 @@

 (defn- is-stopped?
   [env name]
-  (if-let [services @no-schedule-services]
-    (if (after? (local-now) (get-app-schedule env name))
+  (let [services @no-schedule-services]
+    (when-not (empty? services)
+      (if (after? (local-now) (get-app-schedule env name))
         (not (empty? (reset! no-schedule-services (dissoc services (keyword (str env "-" name))))))
-        true)))
+        true))))

 (defn- can-apply-config?
   [env name]
@@ -168,30 +169,30 @@
   (let [names (app-names environment)]
     (doall
      (map (fn [app-name]
-             (try+
-              {:app app-name
-               :report (*apply-config environment app-name)}
-              (catch [:type :shuppet.git/git] {:keys [message]}
-                (warn message)
-                {:app app-name
-                 :error message})
-              (catch  [:type :shuppet.core-shuppet/invalid-config] {:keys [message]}
-                (cf/error {:environment environment
-                           :title "error while loading config"
-                           :app-name app-name
-                           :message message })
-                (error (str app-name " config in " environment " cannot be loaded: " message))
-                {:app app-name
-                 :error message})
-              (catch Exception e
-                (error (str app-name " in " environment " failed: " (.getMessage e) " stacktrace: " (util/str-stacktrace e)))
-                {:app app-name
-                 :error (.getMessage e)})
-              (catch Object e
-                (error (str app-name " in " environment " failed: " e))
-                {:app app-name
-                 :error e})))
-           names))))
+            (try+
+             {:app app-name
+              :report (*apply-config environment app-name)}
+             (catch [:type :shuppet.git/git] {:keys [message]}
+               (warn message)
+               {:app app-name
+                :error message})
+             (catch  [:type :shuppet.core-shuppet/invalid-config] {:keys [message]}
+               (cf/error {:environment environment
+                          :title "error while loading config"
+                          :app-name app-name
+                          :message message })
+               (error (str app-name " config in " environment " cannot be loaded: " message))
+               {:app app-name
+                :error message})
+             (catch Exception e
+               (error (str app-name " in " environment " failed: " (.getMessage e) " stacktrace: " (util/str-stacktrace e)))
+               {:app app-name
+                :error (.getMessage e)})
+             (catch Object e
+               (error (str app-name " in " environment " failed: " e))
+               {:app app-name
+                :error e})))
+          names))))

 (defn update-configs
   [environment]


Added memoization of newest stations query

--- src/org/gensym/viddy/storage.clj
+++ src/org/gensym/viddy/storage.clj
@@ -96,7 +96,7 @@
 (defn make-divvy-data [db-spec]
   (let [one-minute (* 60 1000)
         current-stations (memo/ttl current-stations :ttl/threshold one-minute)
-
+        newest-stations (memo/ttl newest-stations :ttl/threshold one-minute)
         station-info (memo/ttl station-info :ttl/threshold one-minute)
         station-updates (memo/ttl station-updates :ttl/threshold one-minute)]
     (reify data/DivvyData


made distillery.tasks/print-progress public for public usage of distillery.tasks/long-task

--- src/distillery/tasks.clj
+++ src/distillery/tasks.clj
@@ -16,7 +16,7 @@
   (:require [mastersign.wordcloud :as mwc])
   (:require [mastersign.drawing :as mdr]))

-(defn- print-progress
+(defn print-progress
   [& msg]
   (println (str "# " (apply str msg))))


Fixed #5 with valid test data structure.

--- test/clj_beautify/core_test.clj
+++ test/clj_beautify/core_test.clj
@@ -14,5 +14,5 @@

 ;; this is a edn data structure
 (def foo
- (:foo "bar" :baz "bar" :feebs "babababab" :howmanymore "THIS MIGHT" :onemore "howdy"))
+ {:foo "bar" :baz "bar" :feebs "babababab" :howmanymore "THIS MIGHT" :onemore "howdy"})


Rename variable

Rename variable

--- test/onyx/plugin/output_test.clj
+++ test/onyx/plugin/output_test.clj
@@ -96,7 +96,7 @@

             _ (onyx.api/await-job-completion peer-config (:job-id job))
             job-id (:job-id job)
-            ledger-ids (read-ledgers-data (:log (:env env)) id job-id :write-messages)]
+            output (read-ledgers-data (:log (:env env)) id job-id :write-messages)]
         (is (= input-values
                (sort-by :a
                         (mapcat (fn [ledger-id]
@@ -116,4 +116,4 @@
                                         (if (.hasMoreElements entries)
                                           (recur new-entries (.nextElement entries))
                                           new-entries)))))
-                                ledger-ids))))))))
+                                output))))))))


CMR-4307: Addressed more PR comment.

CMR-4307: Addressed more PR comment.

--- search-app/src/cmr/search/data/metadata_retrieval/metadata_cache.clj
+++ search-app/src/cmr/search/data/metadata_retrieval/metadata_cache.clj
@@ -163,8 +163,7 @@
   (let [cache (deref (:cache-atom (c/context->cache context cache-key)))
         maps (for [concept-id (sort (keys cache))]
                (get cache concept-id))]
-     (when (seq maps)
-       maps)))
+    (seq maps)))

 (defconfig refresh-collection-metadata-cache-interval
   "The number of seconds between refreshes of the collection metadata cache"


ssh key and enablement

ssh key and enablement

--- src/freenas/provider.clj
+++ src/freenas/provider.clj
@@ -12,6 +12,7 @@
 (ns freenas.provider
   "Freenas jails provider"
   (:require
+    [supernal.core :refer (ns- lifecycle run execute env)]
     [taoensso.timbre :as timbre]
     [clojure.core.strint :refer (<<)]
     [celestial.provider :refer (wait-for-ssh mappings wait-for)]
@@ -19,10 +20,10 @@
     [freenas.validations :refer [validate-provider jail-mappings]]
     [slingshot.slingshot :refer  [throw+]]
     [celestial.persistency.systems :as s]
-    [celestial.common :refer (import-logging)]
     [org.httpkit.client :as client]
     [celestial.core :refer (Vm)]
-    [celestial.model :refer (hypervisor translate vconstruct)])
+    [celestial.common :refer (get*)]
+    [celestial.model :refer (hypervisor* hypervisor translate vconstruct)])
  )

 (timbre/refer-timbre)
@@ -42,10 +43,30 @@
   (let [js (call client/get "jails/jails/") ]
     (first (filter #(= (:jail_host %) host) js))))

+(def jexec "/usr/sbin/jexec" )
+
+(def sed "/usr/bin/sed")
+
+(ns- jail
+  (task enable-root-ssh
+     (let [{:keys [host]} args]
+       (run (<< "~{jexec} ~{host} ~{sed} -i.bak 's/^sshd_enable=.*/sshd_enable=\"YES\"/' /etc/rc.conf"))
+       (run (<< "~{jexec} ~{host} ~{sed} -i.bak 's/^#PermitRootLogin no/PermitRootLogin yes/' /etc/ssh/sshd_config"))
+       (run (<< "~{jexec} ~{host} /etc/rc.d/sshd start"))))
+
+  (task add-ssh-key
+    (let [{:keys [host]} args pub (clojure.string/trim-newline (slurp (get* :ssh :public-key-path)))]
+      (run (<< "~{jexec} ~{host} mkdir /root/.ssh"))
+      (run (<< "~{jexec} ~{host} sh -c  'pub=\"~{pub}\"; echo \"$pub\" | cat > /root/.ssh/authorized_keys'"))
+      (run (<< "~{jexec} ~{host} chmod 700 /root/.ssh && chmod 600 /root/.ssh/authorized_keys")))))
+
+(lifecycle prepare-jail {:doc "preparing jail with ssh and celestial key"}
+   {jail/add-ssh-key #{}
+    jail/enable-root-ssh #{jail/add-ssh-key}})
+
 (defn enable-ssh [host]
-  ;; jexec 19 sed -i.bak 's/^sshd_enable=.*/sshd_enable="YES"/' /etc/rc.conf
-  ;; jexec  19 /etc/rc.d/sshd start
-  )
+  (let [roles {:roles {:jails #{(hypervisor* :freenas)}}}]
+     (execute prepare-jail {:host host} :jails :env roles)))

 (defrecord Jail [spec]
   Vm


Adding cljs.util

Adding cljs.util

--- src/cljs/go.clj
+++ src/cljs/go.clj
@@ -197,6 +197,7 @@
      (env/ensure
       (doseq [ns '[cljs.analyzer ;; requires clojure.tools.reader, we need either to extend cljs.reader or compile this.
                    cljs.env ;; will mostly be replaced, drags in js-deps.
+                   cljs.util ;; partly overridden in our compiler
                    cljs.tagged-literals ;; drags in clojure.instant, so we'll probably skip these for a bit.
                    cljs.go.compiler ;; same deps as analyzer.
                    cljs.go.core  ;; drags in lots of macros from clojure.core


transpose working solution

transpose working solution

--- src/tic_tac_toe/tic_tac_toe.clj
+++ src/tic_tac_toe/tic_tac_toe.clj
@@ -94,6 +94,10 @@
   ([] (horizontal-line? *array*))
   ([array] (some #(every? player-char? %) array)))

+(defn transpose [array]
+  ;; http://stackoverflow.com/questions/8314789/rotate-a-list-of-list-matrix-in-clojure
+  (apply map list array))
+
 (defn vertical-line?
   ([] (vertical-line? *array*))
   ([array] (some #(every? player-char? %) array)))


Remove path->name

Remove path->name

--- src/graphql_clj/spec.clj
+++ src/graphql_clj/spec.clj
@@ -53,12 +53,8 @@
      (register-idempotent schema-hash (append-pathlast path "!") pred)
      (register-idempotent schema-hash path #(or (nil? %) (pred %))))))

-(doseq [[n pred] default-specs]
+(doseq [[n pred] default-specs] ;; Register specs for global base / default / scalar types
   (register-idempotent (keyword base-ns n) pred))
-
-(defn path->name
-  ([path] (when (> (count path) 0) (str/join delimiter path))) ;; Empty path vector = empty string = malformed keyword
-  ([node-type path] (path->name (cons node-type path))))

 (defn- field->spec [schema-hash {:keys [v/path]}]
   (named-spec schema-hash path))
@@ -107,14 +103,12 @@
   (register-idempotent schema-hash [type-name] (to-keys schema-hash fields)))

 (defmethod spec-for :list [schema-hash {:keys [inner-type v/path] :as n}] ;; TODO ignores required
-  #nu/tapd n
   (register-idempotent schema-hash path (list 'clojure.spec/coll-of (named-spec schema-hash [(:type-name inner-type)]))))

 (defn- register-type-field [schema-hash path type-name]
-  (let [full-type-name (path->name path)]                   ;; TODO do we want to be calling path->name here?
-    (if (= full-type-name type-name)
-      (named-spec schema-hash [type-name])
-      (register-idempotent schema-hash path (named-spec schema-hash [type-name])))))
+  (if (and (= (count path) 1) (= type-name (first path)))
+    (named-spec schema-hash [type-name])
+    (register-idempotent schema-hash path (named-spec schema-hash [type-name]))))

 (defmethod spec-for :type-field [schema-hash {:keys [v/path type-name]}]
   (register-type-field schema-hash path type-name))


RR: use min max for scale

RR: use min max for scale

--- src/hatti/map/utils.cljs
+++ src/hatti/map/utils.cljs
@@ -506,24 +506,6 @@
                                   :line-cap "round"}}
     :else {:layer-type "circle" :style :point}))

-(defn to-fixed
-  [n number-of-decimal-places]
-  (when n
-    (-> n
-        (.toFixed number-of-decimal-places)
-        js/parseFloat)))
-
-(defn percent
-  [n total & {:keys [number-of-decimal-places]}]
-  (let [percentage (when (and (pos? n) (>= total n))
-                     (-> n
-                         (/ total)
-                         (* 100)
-                         float))]
-    (if number-of-decimal-places
-      (to-fixed percentage number-of-decimal-places)
-      percentage)))
-
 (defn generate-hexgrid
   "Generates hexbins with point count aggregation given rendered
   layer-id or geojson"
@@ -550,34 +532,34 @@
                                  (for [{{:keys [points]} :properties :as
                                         feature}
                                        (:features hexbins)
-                                       :let [point_count
-                                             (percent (count points) total)]]
-                                   (when point_count
+                                       :let [point-count (count points)]]
+                                   (when (pos? point-count)
                                      (assoc feature :properties
-                                            {:point_count point_count}))))]
-    ;; return hexbins with updated point_count
+                                            {:point-count point-count}))))
+        point-counts (for [f features-w-count]
+                       (-> f :properties :point-count))]
+    ;; return hexbins with updated point-count
     (assoc hexbins :features features-w-count
-           :properties {:total
-                        total})))
+           :properties {:min-count (apply min point-counts)
+                        :max-count (apply max point-counts)})))

 (defn show-hexbins
   "Renders hexbin layer on map."
   [map id_string geojson]
   (let [id "hexgrid"
         hexgrid (generate-hexgrid map id_string geojson)
-        _ (.log js/console (clj->js hexgrid))
-        total (-> hexgrid :properties :total)]
+        {:keys [min-count max-count]} (:properties hexgrid)]
     (add-mapboxgl-source map id {:geojson hexgrid})
     (add-mapboxgl-layer map id
                         "fill"
                         :paint {:fill-outline-color
-                                {:property "point_count"
+                                {:property "point-count"
                                  :stops [[0 "transparent"]
-                                         [100 "#ccc"]]}
-                                :fill-color {:property "point_count"
+                                         [max-count "#ccc"]]}
+                                :fill-color {:property "point-count"
                                              :stops [[0 "transparent"]
-                                                     [1 "#eff3ff"]
-                                                     [100  "#08519c"]]}
+                                                     [min-count "#eff3ff"]
+                                                     [max-count  "#08519c"]]}
                                 :fill-opacity 0.7})))

 (defn remove-hexbins


GAWB-1975: disable method repo permission/redact buttons if not owner (#800)

hide method repo permission/redact buttons if not owner

--- src/cljs/main/broadfcui/page/method_repo/method_config_importer.cljs
+++ src/cljs/main/broadfcui/page/method_repo/method_config_importer.cljs
@@ -47,7 +47,10 @@
                        (swap! state assoc :error (get-parsed-response false))))})))})

 (defn- create-import-form [state props this locals entity config? fields]
-  (let [{:keys [workspace-id]} props]
+  (let [{:keys [workspace-id]} props
+         currentEmail (-> @utils/auth2-atom (.-currentUser) (.get) (.getBasicProfile) (.getEmail))
+         owners (set (:managers entity))
+         owner? (contains? owners currentEmail)]
     [:div {:style {:display "flex"}}
      (when (:blocking-text @state)
        [comps/Blocker {:banner (:blocking-text @state)}])
@@ -62,22 +65,24 @@
                                           :on-created (fn [_ id]
                                                         (nav/go-to-path :method id)
                                                         (scroll-to-top))}])}])
-        [comps/SidebarButton
-         {:style :light :color :button-primary
-          :text "Permissions..." :icon :settings :margin :bottom
-          :onClick #(modal/push-modal
-                     [mca/AgoraPermsEditor
-                      {:save-endpoint (endpoints/persist-agora-method-acl entity)
-                       :load-endpoint (let [{:keys [name namespace snapshotId]} entity]
-                                        (endpoints/get-agora-method-acl namespace name snapshotId config?))
-                       :entityType (:entityType entity)
-                       :entityName (mca/get-ordered-name entity)
-                       :title (str (:entityType entity) " " (mca/get-ordered-name entity))}])}]
-        [comps/SidebarButton
-         {:style :light :color :exception-state
-          :text "Redact" :icon :delete :margin :bottom
-          :onClick #(modal/push-modal [Redactor {:entity entity :config? config?
-                                                 :on-delete (:on-delete props)}])}]])
+        (when owner?
+          [:div {}
+            [comps/SidebarButton
+             {:style :light :color :button-primary
+              :text "Permissions..." :icon :settings :margin :bottom
+              :onClick #(modal/push-modal
+                         [mca/AgoraPermsEditor
+                          {:save-endpoint (endpoints/persist-agora-method-acl entity)
+                           :load-endpoint (let [{:keys [name namespace snapshotId]} entity]
+                                            (endpoints/get-agora-method-acl namespace name snapshotId config?))
+                           :entityType (:entityType entity)
+                           :entityName (mca/get-ordered-name entity)
+                           :title (str (:entityType entity) " " (mca/get-ordered-name entity))}])}]
+            [comps/SidebarButton
+             {:style :light :color :exception-state
+              :text "Redact" :icon :delete :margin :bottom
+              :onClick #(modal/push-modal [Redactor {:entity entity :config? config?
+                                                 :on-delete (:on-delete props)}])}]])])
      [:div {:style {:flex "1 1 auto"}}
       [comps/EntityDetails {:entity entity}]
       [:div {:style {:border style/standard-line


reuse board-width

reuse board-width

--- src/tetrij/core.cljs
+++ src/tetrij/core.cljs
@@ -20,6 +20,9 @@
   ([width height] (vec (repeat height (empty-row width))))
   ([] (empty-board 11 22)))

+(defn board-width [board]
+  (-> board first count))
+
 (defn random-tile-type []
   (-> tiles keys rand-nth))

@@ -38,12 +41,11 @@
             (absolute-coords tile position)))

 (defn within-bounds? [board tile position]
-  (let [board-width (count (board 1))
-        board-height (count board)
+  (let [board-height (count board)
         tile-coords (absolute-coords tile position)
         x-coords (map #(nth % 0) tile-coords)
         y-coords (map #(nth % 1) tile-coords)
-        ok-x? (every? #(and ((not neg?) %) (< % board-width)) x-coords)
+        ok-x? (every? #(and ((not neg?) %) (< % (board-width board))) x-coords)
         ok-y? (every? #(< % board-height) y-coords)]
     (and ok-x? ok-y?)))

@@ -90,9 +92,6 @@

 (defn full-row? [row]
   (every? some? row))
-
-(defn board-width [board]
-  (count (board 0)))

 (defn cleared-board [board]
   (mapv #(if (full-row? %) (empty-row (board-width board)) %) board))


opus2c update

opus2c update


Fix documentation by removing range-specified? from API.

--- src/zprint/core.cljc
+++ src/zprint/core.cljc
@@ -676,7 +676,7 @@
                 (clojure.string/replace "\\r" "\r"))))
     element))

-(defn range-specified?
+(defn ^:no-doc range-specified?
   "Return true if the start or end of a range is specified, or if
   :output :range? is true."
   [options]


too much logging

too much logging

--- src/pc/admin/migrate_storage.clj
+++ src/pc/admin/migrate_storage.clj
@@ -117,15 +117,14 @@
 (defn start-transaction-queue-consumer []
   (reset! queue-consumer-interrupt false)
   (future (while (not @queue-consumer-interrupt)
-            (log/info "starting transaction loop")
+            ;(log/info "starting transaction loop")
             (loop [t (fetch-transaction)]
               (when (seq t)
-                (log/infof "transacting %s" t)
                 (swap! popped-transactions conj t)
-                @(d/transact (pcd/conn) t)
+                (log/infof "transacted %s" @(d/transact (pcd/conn) t))
                 (when-not @queue-consumer-interrupt
                   (recur (fetch-transaction)))))
-            (log/info "no more transactions, sleeping for 100 ms")
+            ;(log/info "no more transactions, sleeping for 100 ms")
             (Thread/sleep 100))))

 ;; sequence of events:


Four tests to check exporting data to the plain text format

--- test/hurvinek/exporter_test.clj
+++ test/hurvinek/exporter_test.clj
@@ -45,3 +45,27 @@
         (is (callable? 'hurvinek.exporter/data->csv))))

+(deftest test-products->text-existence
+    "Check that the hurvinek.exporter/products->text definition exists."
+    (testing "if the hurvinek.exporter/products->text definition exists."
+        (is (callable? 'hurvinek.exporter/products->text))))
+
+
+(deftest test-chapters->text-existence
+    "Check that the hurvinek.exporter/chapters->text definition exists."
+    (testing "if the hurvinek.exporter/chapters->text definition exists."
+        (is (callable? 'hurvinek.exporter/chapters->text))))
+
+
+(deftest test-groups->text-existence
+    "Check that the hurvinek.exporter/groups->text definition exists."
+    (testing "if the hurvinek.exporter/groups->text definition exists."
+        (is (callable? 'hurvinek.exporter/groups->text))))
+
+
+(deftest test-components->text-existence
+    "Check that the hurvinek.exporter/components->text definition exists."
+    (testing "if the hurvinek.exporter/components->text definition exists."
+        (is (callable? 'hurvinek.exporter/components->text))))
+
+


test add-to-set

test add-to-set

--- test/karras/test_collection.clj
+++ test/karras/test_collection.clj
@@ -135,7 +135,14 @@
                              (modify (set-fields {:driver true}))
                              :sort [(asc :last-name) (asc :first-name)]
                              :return-new false)
-            => Jane)))
+      => Jane))
+  (testing "add-to-set"
+    (let [do-update #(find-and-modify people
+                                      (where (eq :age 16))
+                                      (modify (add-to-set :sample-set 1)))]
+      (fact
+        (do-update) => (contains {:sample-set [1]})
+        (do-update) => (contains {:sample-set [1]})))))

 (deftest find-and-remove-tests
   (testing "return removed  document"


Include message with the logged error (#13)

--- src/spiral/adapters/immutant.clj
+++ src/spiral/adapters/immutant.clj
@@ -38,4 +38,4 @@
                             (-> (response (str "Encountered error! See log."))
                               (status 500))
                             :close? true)
-                          (log/error e)))))))))
+                          (log/error e "Encountered unhandled error from spiral error channel")))))))))


Add a few tasks to initialize tasks

Add a few tasks to initialize tasks

--- src/todo_repl_webapp/handler.clj
+++ src/todo_repl_webapp/handler.clj
@@ -7,13 +7,22 @@
             [todo-repl.core :as todo]
             [todo-repl-webapp.views :as views]))

-
 (def *tasks-ref* (ref []))
 (defn tasks [] (deref *tasks-ref*))
 (defn add-new-task [x]
   (dosync (alter *tasks-ref* #(cons
                                 (todo/new-task-better x)
                                 %1))))
+
+;; Initialize some tasks
+(add-new-task {:name "Go get some milk"
+               :context "shopping"
+               :due "tomorrow"})
+(add-new-task {:name "Go get new shoes"
+               :context "shopping"
+               :due "friday"})
+(add-new-task {:name "Clean the kitchen sink"
+               :context "cleaning"})

 (defroutes app-routes
   (GET "/" [] (do (println "get /")
@@ -22,11 +31,11 @@
     (do
       (println "/eval " evalInput)
       (if (nil? evalInput)
-        (views/eval "nil")
+        (views/display "nil")
           (binding [*ns* (find-ns 'todo-repl-webapp.handler)]
             (let [result (load-string evalInput)]
               (println "evals to: " result)
-              (views/eval (str result)))))))
+              (views/display result))))))
   (route/resources "/")
   (route/not-found "Not Found"))


update footer link

update footer link

--- frontend/components/footer.cljs
+++ frontend/components/footer.cljs
@@ -10,7 +10,7 @@
     [:li [:a {:href "/jobs"} "Jobs"]]
     [:li [:a {:href "http://blog.circleci.com"} "Blog"]]
     [:li [:a {:href "/privacy"} "Privacy"]]
-    [:li [:a {:href "/privacy#security"} "Security"]]
+    [:li [:a {:href "/security"} "Security"]]
     [:li [:a {:href "/enterprise"} "Enterprise"]]
     [:li [:a {:href "/about#contact"} "Contact"]]
     [:li


debug channel

debug channel

--- cljx/plongeur-cljs/src/plongeur/model.cljs
+++ cljx/plongeur-cljs/src/plongeur/model.cljs
@@ -36,10 +36,11 @@
 ;; model machinery

 (def intent-handlers
-  {:network-calculated (fn [_ state] state)
-   :nodes-selected     (fn [_ state] state)
+  {;:network-calculated (fn [_ state] state)
+   ;:nodes-selected     (fn [_ state] state)
    :add-graph          add-graph
-   :drop-graph         drop-graph})
+   :drop-graph         drop-graph
+   :debug              (fn [_ state] (prn state) state)})

 (def default-state
   "Returns a new initial application state."


Parsing job results

Parsing job results

--- src/emender_jenkins/results.clj
+++ src/emender_jenkins/results.clj
@@ -68,21 +68,39 @@
         :disabled
         (if jenkins-job-status ; job is buildable, so let's check the icon
             (cond (= jenkins-job-status "blue")     :ok
+                  (= jenkins-job-status "yellow")   :unstable
                   (= jenkins-job-status "disabled") :disabled ; should it happen?
                   :else                             :failure)
             :does-not-exists)))
+
+(defn parse-int
+    [string]
+    (java.lang.Integer/parseInt string))
+
+(defn parse-test-results
+    [message]
+    (if message
+        (let [parsed (re-matches #"Total: ([0-9]+)  Passed: ([0-9]+)  Failed: ([0-9]+)" message)]
+            (if (= (count parsed) 4)
+                {:total  (parse-int (get parsed 1))
+                 :passed (parse-int (get parsed 2))
+                 :failed (parse-int (get parsed 3))}))))

 (defn read-update-job-info
     [job-list]
     (for [job job-list]
         (let [job-name (get job "name")
               job-color  (get job "color")
-              buildable? (get job "buildable")]
+              buildable? (get job "buildable")
+              message    (-> (get job "lastSuccessfulBuild")
+                             (get "description"))]
             {:job-name  job-name
              :product   (job-name->product-name job-name)
              :version   (job-name->version job-name)
              :book-name (job-name->book-name job-name)
              :job-status (compute-job-status job-color buildable?)
+             :message    message
+             :results    (parse-test-results message)
             })))

 (defn reload-all-results


config path; line lengths

config path; line lengths

--- Clojure-Websockets/TwitterClient/src/clj/birdwatch_tc/main.clj
+++ Clojure-Websockets/TwitterClient/src/clj/birdwatch_tc/main.clj
@@ -15,31 +15,35 @@
 (pretty/install-pretty-logging)
 (pretty/install-uncaught-exception-handler)

-(def conf (edn/read-string (slurp "twitterconf.edn")))
+(def conf-filepath (get (System/getenv) "CONF_PATH" "twitterconf.edn"))
+(def conf (edn/read-string (slurp conf-filepath)))

 (defn restart!
-  "Starts (or restarts) a system built out of the specified subsystems. The switchboard will
-  then fire up subsystems according to the blueprint maps, which are in passed in the second
-  position of the :cmd/init-comp vectors. These subsystems are then wired to provide the
-  communication paths required by the application.
-  The system can be restarted on the REPL. For example, say we modify the
-  birdwatch.percolator.percolator namespace. Then, we can reload it:
+  "Starts (or restarts) a system built out of the specified subsystems. The
+   switchboard will then fire up subsystems according to the blueprint maps,
+   which are in passed in the second position of the :cmd/init-comp vectors.
+   These subsystems are then wired to provide the communication paths required
+   by the application.
+   The system can be restarted on the REPL. For example, say we modify the
+   birdwatch.percolator.percolator namespace. Then, we can reload it:

       (require '[birdwatch-tc.percolator.percolator :as perc] :reload)

-  Then, calling this function again will restart the system while maintaining the state of
-  the individual subsystems."
+   Then, calling this function again will restart the system while maintaining
+   the state of the individual subsystems."
   []
   (let [switchboard (sb/component :tc/switchboard)]
     (sb/send-mult-cmd
       switchboard
-      [[:cmd/init-comp #{(tc/cmp-map :tc/client-cmp conf)
-                         (sched/cmp-map :tc/scheduler-cmp)
-                         (pc/cmp-map :tc/persistence-cmp conf)
-                         (redis/cmp-map :tc/interop-cmp (merge (:redis conf)
-                                                               {:relay-types #{:perc/matches}}))
-                         (perc/cmp-map :tc/percolator-cmp conf)}]
-       [:cmd/route {:from :tc/client-cmp :to #{:tc/persistence-cmp :tc/percolator-cmp}}]
+      [[:cmd/init-comp
+        #{(tc/cmp-map :tc/client-cmp conf)
+          (sched/cmp-map :tc/scheduler-cmp)
+          (pc/cmp-map :tc/persistence-cmp conf)
+          (redis/cmp-map :tc/interop-cmp
+                         (merge (:redis conf) {:relay-types #{:perc/matches}}))
+          (perc/cmp-map :tc/percolator-cmp conf)}]
+       [:cmd/route {:from :tc/client-cmp :to #{:tc/persistence-cmp
+                                               :tc/percolator-cmp}}]
        [:cmd/route {:from :tc/percolator-cmp :to :tc/interop-cmp}]
        [:cmd/route {:from :tc/scheduler-cmp :to :tc/client-cmp}]

@@ -51,9 +55,10 @@
                           :repeat  true}]}]])))

 (defn -main
-  "Starts the application from command line. Also saves and logs process ID. The system that is fired up when
-  start! is called proceeds in core.async's thread pool. Since we don't want the application to exit when
-  just because the current thread is out of work, we just put it to sleep."
+  "Starts the application from command line. Also saves and logs process ID.
+   The system that is fired up when start! is called proceeds in core.async's
+   thread pool. Since we don't want the application to exit when just because
+   the current thread is out of work, we just put it to sleep."
   [& args]
   (pid/save (:pidfile-name conf))
   (pid/delete-on-shutdown! (:pidfile-name conf))


CMR-7080 default sorting keys (#1199)

CMR-7080 default sorting keys (#1199)

--- common-app-lib/src/cmr/common_app/services/search/query_model.clj
+++ common-app-lib/src/cmr/common_app/services/search/query_model.clj
@@ -277,6 +277,11 @@
   "Multimethod for returning the default sort keys for a concept type."
   (fn [concept-type]
     concept-type))
+
+(defmethod default-sort-keys :default
+  [_]
+  ;; No sorting by default
+  [])

 (defmulti concept-type->default-query-attribs
   "Multimethod for returning the default query attributes for a given concept type."


add missing import

add missing import

--- dada-core/src/main/clojure/org/dada/core/RemoteSessionManager.clj
+++ dada-core/src/main/clojure/org/dada/core/RemoteSessionManager.clj
@@ -21,6 +21,8 @@
    ConnectionFactory
    Queue
    Topic]
+  [clojure.lang
+   Atom]
   [org.dada.core
    Data
    Metadata


Related #32: generate less code to speed up load

--- src/java_time/defconversion.clj
+++ src/java_time/defconversion.clj
@@ -52,30 +52,28 @@
 (defn types-of [xs]
   (g/types (map type xs)))

-(defn- call-conversion [nm tp args]
-  {:pre [(symbol? tp)
-         (not (namespace tp))]}
-  `(if-let [[path# fn#] (g/conversion-fn
-                          @graph
-                          (types-of ~args)
-                          (g/types ~(to-seq tp)))]
-     (or (try (first (fn# ~args))
-              (catch Exception e#
-                (throw
-                  (ex-info "Conversion failed"
-                           {:path (:path path#), :arguments ~args, :to ~tp}
-                           e#))))
-         (throw (ex-info
-                  (format "Conversion from %s to %s returned nil!" ~args ~tp)
-                  {:arguments ~args, :to ~tp, :constructor ~nm})))
-     (throw (ex-info (format "Could not convert %s to %s!" ~args ~tp)
-                     {:arguments ~args, :to ~tp, :constructor ~nm}))))
+(defn ^:internal call-conversion [nm tp args]
+  (if-let [[path fn] (g/conversion-fn
+                       @graph
+                       (types-of args)
+                       (g/types [tp]))]
+    (or (try (first (fn args))
+             (catch Exception e
+               (throw
+                 (ex-info "Conversion failed"
+                          {:path (:path path), :arguments args, :to tp}
+                          e))))
+        (throw (ex-info
+                 (format "Conversion from %s to %s returned nil!" args tp)
+                 {:arguments args, :to tp, :constructor nm})))
+    (throw (ex-info (format "Could not convert %s to %s!" args tp)
+                    {:arguments args, :to tp, :constructor nm}))))

 (defn- gen-implicit-arities [nm tp arities]
   (for [arity arities]
     (let [args (mapv #(gensym (str "arg_" (inc %) "_")) (range arity))]
       `([~@args]
-        ~(call-conversion nm tp args)))))
+        (call-conversion ~nm ~tp ~args)))))

 (defn get-path [from to]
   (let [[p _] (g/conversion-fn @graph


Reverted changes I made

Reverted changes I made

--- test/cljs/zetawar/subs_test.cljs
+++ test/cljs/zetawar/subs_test.cljs
@@ -205,9 +205,7 @@
                  :unit-type/description
                  :unit-type/min-range
                  :unit-type/max-range
-                 :unit-type/armor-type
                  :unit-type/can-capture
-                 :unit-type/can-repair
                  :unit-type/image}
                (into #{} unit-type-keys)))))))


Add a test that all enlive selectors are valid

--- test/comic_reader/sites_test.clj
+++ test/comic_reader/sites_test.clj
@@ -75,6 +75,21 @@
 (defn comic-list-html []
   (when-let [image-resource (site-test-resource "comic_list.html")]
     (html/html-resource image-resource)))
+
+(defn valid-selector? [selector]
+  (and
+   (not (empty? selector))
+   (every? keyword? selector)))
+
+(defn test-enlive-selectors []
+  (tu/are-with-msg [sel-fn]
+                   (is (valid-selector? (sel-fn))
+                                (str "All elements of a selector "
+                                     "must be keywords."))
+    comic-list-selector
+    chapter-list-selector
+    page-list-selector
+    image-selector))

 (defn test-extract-image-tag [html image-tag]
   (and
@@ -192,6 +207,7 @@
        (call-with-options
         ((get-sites) site-name)
         #(and
+          (test-enlive-selectors)
           (if (has-test-folder?)
             (and
              (test-image-page-extraction)


Fix a bug in the TTL migration code

Fix a bug in the TTL migration code

--- src/kixi/datastore/filestore/migrators/dynamodb/migrator_20171221_ttl.clj
+++ src/kixi/datastore/filestore/migrators/dynamodb/migrator_20171221_ttl.clj
@@ -29,7 +29,6 @@
                                {:last-prim-kvs {prim-kv tok}}))))]
     (loop [out []
            r (scan nil)]
-      (println (count r) (count (set out)))
       (if (empty? r)
         out
         (recur (concat out r) (scan (get (last r) prim-kv)))))))
@@ -48,7 +47,7 @@
       (run! #(db/merge-data conn
                             (fsdb/primary-upload-cache-table profile)
                             fsdb/id-col
-                            (get % fsdb/id-col)
+                            (get % (keyword fsdb/id-col))
                             {::fsu/ttl (t/since-epoch (t/three-days-from-now))}) items))))
 (defn down
   [db]


symbols cannot have two consecutive '/'

symbols cannot have two consecutive '/'


resturcutre

resturcutre

--- test/epicea/utils/utils_test.clj
+++ test/epicea/utils/utils_test.clj
@@ -1,31 +0,0 @@
-(ns epicea.utils-test
-  (:require [clojure.test :refer :all]
-            [epicea.utils.core :refer :all]))
-
-(deftest map-with-keys-test
-  (testing "Testing map with keys"
-    (is (map-with-keys? {:rulle 119} #{:rulle}))
-    (is (map-with-keys? {:rulle 119} #{:rulle}))
-    (is (not (map-with-keys? {:rulle 119} #{:rull})))
-    (is (not (map-with-keys? [:rulle] #{:rulle})))))
-
-(deftest matrix-index-test
-  (testing "Matrix index computation"
-    (is (= 0 (compute-matrix-index [3 4] [0 0])))
-    (is (= 1 (compute-matrix-index [3 4] [1 0])))
-    (is (= 3 (compute-matrix-index [3 4] [0 1])))
-    (is (= 4 (compute-matrix-index [3 4] [1 1])))))
-
-(deftest provide-arguments-test
-  (testing "Providing arguments"
-    (let [f (provide-arguments get [[{:a 3 :b 4}] nil])]
-      (is (= 3 (f :a)))
-      (is (= 4 (f :b))))
-    (let [f (provide-arguments get [nil [:a]])]
-      (is (= 9 (f {:a 9})))
-      (is (= 12 (f {:a 12}))))))
-
-(deftest map-hierarchy-test
-  (testing "Flattening..."
-    (is (= (flatten-map-hierarchy {:a {1 :c 2 :d} :b {3 :k}})
-           {[:a 1] :c, [:a 2] :d, [:b 3] :k}))))


Use with-clear-comamnds in the app test, to make the test self-contained.

--- test/eventframework/app_test.clj
+++ test/eventframework/app_test.clj
@@ -1,6 +1,8 @@
 (ns eventframework.app-test
-  (:use
-    (eventframework app [commands :only [new-uuid]])
+  (:use
+    (eventframework app
+                    [commands :only [new-uuid]]
+                    commands-support)
     clojure.test
     midje.sweet
     ring.mock.request)
@@ -45,83 +47,84 @@
       => (contains {:status 404
                     :body (filematch #"typos")}))

-  ;; FIXME this is pretty horrendous
-  (let [thread-command-id        (new-uuid)
-        ;; start new thread command (next position will be 1)
-        new-thread-response      (app (new-thread-request thread-command-id "Hello World!"))
-        hello-world-thread-event {:type "newthread"
-                                  :id   thread-command-id
-                                  :body {:text "Hello World!"}}
-
-        ;; alice receives the thread started event
-        {alice-position-1 :position alice-events-from-0 :events}
-        (json-body (app (get-events-request "alice" "0")))
-
-        ;; alice subscribes (next position will be 2)
-        alice-subscribe-response (app (subscribe-request "alice" thread-command-id))
-
-        ;; alice receives subscribed event
-        {alice-position-2 :position alice-events-from-1 :events}
-        (json-body (app (get-events-request "alice" alice-position-1)))
-
-        ;; bob receives the thread started event
-        {bob-position-2 :position bob-events-from-0 :events}
-        (json-body (app (get-events-request "bob" "0")))
-
-        ;; bob subscribes (next position will be 3)
-        bob-subscribe-response (app (subscribe-request "bob" thread-command-id))
-
-        ;; bob receives subscribed event
-        {bob-position-3 :position bob-events-from-2 :events}
-        (json-body (app (get-events-request "bob" bob-position-2)))
-
-        ;; alice sends a message (next position will be 4)
-        alice-message-response (app (message-request thread-command-id "foo"))
-        test-message-event {:type "message" :body {:thread thread-command-id :message "foo"}}
-
-        ;; alice receives the message
-        {alice-position-4 :position alice-events-from-2 :events}
-        (json-body (app (get-events-request "alice" alice-position-2)))
-
-        ;; bob receives the message
-        {bob-position-4 :position bob-events-from-3 :events}
-        (json-body (app (get-events-request "bob" bob-position-3)))
-
-        ;; carol receives the thread started event
-        {carol-position-4 :position carol-events-from-0 :events}
-        (json-body (app (get-events-request "carol" "0")))
-
-        ;; carol subscribes (next position will be 5)
-        carol-subscribe-response (app (subscribe-request "carol" thread-command-id))
-
-        ;; carol receives the subscribed event and the message
-        {carol-position-5 :position carol-events-from-4 :events}
-        (json-body (app (get-events-request "carol" carol-position-4)))]
-
-       (fact "allows creation of conversation threads"
-         new-thread-response => (contains {:status 200}))
-
-       (fact "distributes new threads to users"
-         (first alice-events-from-0) => (contains hello-world-thread-event)
-         (first bob-events-from-0)   => (contains hello-world-thread-event)
-         (first carol-events-from-0) => (contains hello-world-thread-event))
-
-       (fact "allows subscription to threads"
-         (first alice-events-from-1) => (contains {:type "subscribe"
-                                                   :body {:thread thread-command-id :user "alice"}})
-         (first bob-events-from-2)   => (contains {:type "subscribe"
-                                                   :body {:thread thread-command-id :user "bob"}})
-         (first carol-events-from-4) => (contains {:type "subscribe"
-                                                   :body {:thread thread-command-id :user "carol"}}))
-
-       (fact "subscribed users receive messages as they are available"
-         (first alice-events-from-2) => (contains test-message-event)
-         (first bob-events-from-3)   => (contains test-message-event))
-
-       (fact "users subscribing later receive all existing messages within the subscribed event"
-         (first (:extraevents (first carol-events-from-4))) => (contains test-message-event))
-
-       (fact "position indicators are the same across clients"
-         alice-position-2 => bob-position-2
-         alice-position-4 => bob-position-4
-         alice-position-4 => carol-position-4)))+  (with-clear-commands
+	  ;; FIXME this is pretty horrendous
+	  (let [thread-command-id        (new-uuid)
+	        ;; start new thread command (next position will be 1)
+	        new-thread-response      (app (new-thread-request thread-command-id "Hello World!"))
+	        hello-world-thread-event {:type "newthread"
+	                                  :id   thread-command-id
+	                                  :body {:text "Hello World!"}}
+
+	        ;; alice receives the thread started event
+	        {alice-position-1 :position alice-events-from-0 :events}
+	        (json-body (app (get-events-request "alice" "0")))
+
+	        ;; alice subscribes (next position will be 2)
+	        alice-subscribe-response (app (subscribe-request "alice" thread-command-id))
+
+	        ;; alice receives subscribed event
+	        {alice-position-2 :position alice-events-from-1 :events}
+	        (json-body (app (get-events-request "alice" alice-position-1)))
+
+	        ;; bob receives the thread started event
+	        {bob-position-2 :position bob-events-from-0 :events}
+	        (json-body (app (get-events-request "bob" "0")))
+
+	        ;; bob subscribes (next position will be 3)
+	        bob-subscribe-response (app (subscribe-request "bob" thread-command-id))
+
+	        ;; bob receives subscribed event
+	        {bob-position-3 :position bob-events-from-2 :events}
+	        (json-body (app (get-events-request "bob" bob-position-2)))
+
+	        ;; alice sends a message (next position will be 4)
+	        alice-message-response (app (message-request thread-command-id "foo"))
+	        test-message-event {:type "message" :body {:thread thread-command-id :message "foo"}}
+
+	        ;; alice receives the message
+	        {alice-position-4 :position alice-events-from-2 :events}
+	        (json-body (app (get-events-request "alice" alice-position-2)))
+
+	        ;; bob receives the message
+	        {bob-position-4 :position bob-events-from-3 :events}
+	        (json-body (app (get-events-request "bob" bob-position-3)))
+
+	        ;; carol receives the thread started event
+	        {carol-position-4 :position carol-events-from-0 :events}
+	        (json-body (app (get-events-request "carol" "0")))
+
+	        ;; carol subscribes (next position will be 5)
+	        carol-subscribe-response (app (subscribe-request "carol" thread-command-id))
+
+	        ;; carol receives the subscribed event and the message
+	        {carol-position-5 :position carol-events-from-4 :events}
+	        (json-body (app (get-events-request "carol" carol-position-4)))]
+
+	       (fact "allows creation of conversation threads"
+	         new-thread-response => (contains {:status 200}))
+
+	       (fact "distributes new threads to users"
+	         (first alice-events-from-0) => (contains hello-world-thread-event)
+	         (first bob-events-from-0)   => (contains hello-world-thread-event)
+	         (first carol-events-from-0) => (contains hello-world-thread-event))
+
+	       (fact "allows subscription to threads"
+	         (first alice-events-from-1) => (contains {:type "subscribe"
+	                                                   :body {:thread thread-command-id :user "alice"}})
+	         (first bob-events-from-2)   => (contains {:type "subscribe"
+	                                                   :body {:thread thread-command-id :user "bob"}})
+	         (first carol-events-from-4) => (contains {:type "subscribe"
+	                                                   :body {:thread thread-command-id :user "carol"}}))
+
+	       (fact "subscribed users receive messages as they are available"
+	         (first alice-events-from-2) => (contains test-message-event)
+	         (first bob-events-from-3)   => (contains test-message-event))
+
+	       (fact "users subscribing later receive all existing messages within the subscribed event"
+	         (first (:extraevents (first carol-events-from-4))) => (contains test-message-event))
+
+	       (fact "position indicators are the same across clients"
+	         alice-position-2 => bob-position-2
+	         alice-position-4 => bob-position-4
+	         alice-position-4 => carol-position-4))))


Accidentally inverted ports for output test.

--- test/onyx/plugin/output_test.clj
+++ test/onyx/plugin/output_test.clj
@@ -15,7 +15,7 @@

 (def id (str (java.util.UUID/randomUUID)))

-(def zk-addr "127.0.0.1:2181")
+(def zk-addr "127.0.0.1:2188")

 (def es-host "127.0.0.1")

@@ -27,7 +27,7 @@
   {:onyx/id id
    :zookeeper/address zk-addr
    :zookeeper/server? true
-   :zookeeper.server/port 2181})
+   :zookeeper.server/port 2188})

 (def peer-config
   {:onyx/id id


[REPLIES 2/2] /api now returns replies. Count still at 10.

--- src/layzee/adapters/web/api.clj
+++ src/layzee/adapters/web/api.clj
@@ -3,7 +3,7 @@
             [layzee.adapters.twitter.search :refer :all :as twitter]
             [layzee.adapters.settings :as settings]
             [layzee.use-cases.lazy-web :as lazy-web]
-            [layzee.adapters.twitter.replies :as replies]))
+            [layzee.adapters.twitter.conversation :as conversation]))

 (def content-type-plain-text {"Content-Type" "text/plain"})
 (def content-type-json {"Content-Type" "application/json"})
@@ -24,14 +24,14 @@
   (fn [opts]
     (twitter/lazy-web settings/oauth-credential opts)))

-(defn- replies-for[tweet]
-  (assoc tweet (replies/to {:id (-> tweet :id_str) :screen-name (-> tweet :user :screen_name)})))
+(defn- assoc-replies-for[oauth-credential tweet]
+  (assoc tweet :replies (conversation/for oauth-credential (-> tweet :id_str))))

 (defn- search[]
   (let [results (lazy-web/run { :search-adapter-fn lazy-web-search } {:count 10} )]
-    (let [replies (pmap replies-for (:result results))]
+    (let [results-with-replies (pmap (partial assoc-replies-for settings/oauth-credential) (:result results))]
       (println replies)
-
+      (assoc results :result results-with-replies)
       )))

 (defn- reply-core[]


added mechanism for offlining category resources during development

--- src/notepad.clj
+++ src/notepad.clj
@@ -23,3 +23,46 @@
 ;(distillery.core-test/test-complete)

 ;(distillery.core-test/test-show-main-page)
+
+; -----------------
+
+;(let [dldir "C:\\Temp\\wiki\\"] (download-resources dldir) (adjust-job-for-offline dldir))
+;(adjust-job-for-offline "C:\\Temp\wiki\\")
+
+(defn download-resources
+  "Downloads all resources into dldir."
+  [dldir]
+  (let [ress (mapcat (fn [c] (map #(vector (:type %) (:url %))
+                                  (:resources c)))
+                     (:categories distillery.core-test/job-descr))]
+    (doseq [[typ url] ress]
+      (let [url* (java.net.URL. url)
+            p (.getPath url*)]
+        (when-not (= (.getProtocol url*) "file")
+          (let [n (.substring p (inc (.lastIndexOf p "/")))
+                f (str dldir n ".offline")]
+            (spit f (slurp (if (= :wikipedia typ)
+                             (str url "?action=render")
+                             url)))))))))
+
+(defn adjust-job-for-offline
+  [dldir]
+  (intern 'distillery.core-test 'job-descr
+    (update-in
+     distillery.core-test/job-descr [:categories]
+     (fn [cats]
+       (vec (map
+             (fn [cat]
+               (update-in
+                cat [:resources]
+                (fn [ress]
+                  (vec (map
+                        (fn [r]
+                          (let [url (:url r)
+                                p (.getPath (java.net.URL. url))
+                                n (.substring p (inc (.lastIndexOf p "/")))
+                                f (str dldir n ".offline")]
+                            (assoc r :url (str "file:///" f))))
+                        ress)))))
+             cats))))))
+


CMR-2146: Commented out output.

CMR-2146: Commented out output.

--- metadata-db-app/src/cmr/metadata_db/data/oracle/concepts.clj
+++ metadata-db-app/src/cmr/metadata_db/data/oracle/concepts.clj
@@ -310,7 +310,7 @@
                              seq-name
                              (str/join "," (repeat (count values) "?")))]
             ;; Uncomment to debug what's inserted
-            (debug "Executing" stmt "with values" (pr-str values))
+            ; (debug "Executing" stmt "with values" (pr-str values))
             (j/db-do-prepared db stmt values)
             (after-save conn provider concept)


Add TODO

Add TODO

--- src/main/clojure/pigpen/pig.clj
+++ src/main/clojure/pigpen/pig.clj
@@ -481,12 +481,14 @@
 returns the single value in the result channel."
   [[input-bags result]]
   {:pre [(util/channel? result)]}
-  (try
-    (doseq [b input-bags]
+  (doseq [b input-bags]
        (when b
          (a/close! b)))
     (util/safe-<!! result)
-    (catch Throwable z (throw (RuntimeException. z)))))
+    ;; TODO this is eating stack traces
+  #_(try
+
+     (catch Throwable z (throw (RuntimeException. z)))))

 (defn udf-cleanup
   "Cleans up any accumulator state by closing the result channel. Returns nil


refine sell-a-commodity test

refine sell-a-commodity test

--- test/clj_money/trading_test.clj
+++ test/clj_money/trading_test.clj
@@ -390,32 +390,38 @@
                               :description "Sell 25 shares of AAPL at 15.000"
                               :entity-id (-> context :entities first :id)
                               :memo nil
-                              :items [{:action :credit
-                                       :account-id (:id ltcg)
-                                       :memo "Sell 25 shares of AAPL at 15.000"
-                                       :transaction-date (t/local-date 2017 3 2)
-                                       :amount 125M
-                                       :value 125M
-                                       :balance 125M
-                                       :reconciled? false
-                                       :reconciliation-id nil
-                                       :index 0}
-                                      {:action :debit
+                              :items [{:action :debit
                                        :account-id (:id ira)
                                        :transaction-date (t/local-date 2017 3 2)
+                                       :description "Sell 25 shares of AAPL at 15.000"
                                        :amount 375M
                                        :value 375M
                                        :balance 1375M
+                                       :reconciliation-status nil
                                        :reconciled? false
                                        :reconciliation-id nil
                                        :memo nil
                                        :index 2}
                                       {:action :credit
+                                       :account-id (:id ltcg)
+                                       :memo "Sell 25 shares of AAPL at 15.000"
+                                       :transaction-date (t/local-date 2017 3 2)
+                                       :description "Sell 25 shares of AAPL at 15.000"
+                                       :amount 125M
+                                       :value 125M
+                                       :balance 125M
+                                       :reconciliation-status nil
+                                       :reconciled? false
+                                       :reconciliation-id nil
+                                       :index 0}
+                                      {:action :credit
                                        :account-id (:id commodity-account)
                                        :transaction-date (t/local-date 2017 3 2)
+                                       :description "Sell 25 shares of AAPL at 15.000"
                                        :amount 25M
                                        :balance 75M
                                        :value 250M
+                                       :reconciliation-status nil
                                        :reconciled? false
                                        :reconciliation-id nil
                                        :memo nil


Use transactions in POST/PUT/DELETE requests

--- mtg-pairings-server/src/clj/mtg_pairings_server/api/tournament.clj
+++ mtg-pairings-server/src/clj/mtg_pairings_server/api/tournament.clj
@@ -2,6 +2,7 @@
   (:require [compojure.api.sweet :refer :all]
             [clojure.string :as str]
             [clj-time.coerce]
+            [korma.db :as db]
             [schema.core :as s]
             [mtg-pairings-server.service.tournament :refer :all]
             [mtg-pairings-server.util.broadcast :refer [broadcast-tournament]]
@@ -9,16 +10,17 @@
             [mtg-pairings-server.util :refer [response]]))

 (defmacro validate-request [sanction-id apikey & body]
-  `(let [user# (user-for-apikey ~apikey)
-         owner# (owner-of-tournament ~sanction-id)]
-     (cond
-       (nil? owner#) {:status 404
-                      :body   "Virheellinen sanktiointinumero"}
-       (nil? user#) {:status 400
-                     :body   "Virheellinen API key"}
-       (not= owner# user#) {:status 403
-                            :body   "Eri käyttäjän tallentama turnaus"}
-       :else (do ~@body))))
+  `(db/transaction
+    (let [user# (user-for-apikey ~apikey)
+          owner# (owner-of-tournament ~sanction-id)]
+      (cond
+        (nil? owner#) {:status 404
+                       :body   "Virheellinen sanktiointinumero"}
+        (nil? user#) {:status 400
+                      :body   "Virheellinen API key"}
+        (not= owner# user#) {:status 403
+                             :body   "Eri käyttäjän tallentama turnaus"}
+        :else (do ~@body)))))

 (defroutes tournament-routes
   (POST "/" []
@@ -26,13 +28,14 @@
     :summary "Lisää turnaus"
     :query-params [key :- String]
     :body [tournament InputTournament {:description "Uusi turnaus"}]
-    (if-let [user (user-for-apikey key)]
-      (let [tournament (-> tournament
-                           (update :day clj-time.coerce/to-local-date)
-                           (assoc :owner user))]
-        (response (select-keys (add-tournament tournament) [:id])))
-      {:status 400
-       :body   "Virheellinen API key"}))
+    (db/transaction
+     (if-let [user (user-for-apikey key)]
+       (let [tournament (-> tournament
+                            (update :day clj-time.coerce/to-local-date)
+                            (assoc :owner user))]
+         (response (select-keys (add-tournament tournament) [:id])))
+       {:status 400
+        :body   "Virheellinen API key"})))
   (PUT "/:sanctionid" []
     :path-params [sanctionid :- s/Str]
     :query-params [key :- s/Str]


remove java_skeleton test directory

remove java_skeleton test directory

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


Task IDs arent returned through submit-job anymore.

--- test/onyx/plugin/output_test.clj
+++ test/onyx/plugin/output_test.clj
@@ -96,8 +96,7 @@

             _ (onyx.api/await-job-completion peer-config (:job-id job))
             job-id (:job-id job)
-            task-id (get-in (:task-ids job) [:write-messages :id])
-            ledger-ids (read-ledgers-data (:log (:env env)) id job-id task-id)]
+            ledger-ids (read-ledgers-data (:log (:env env)) id job-id :write-messages)]
         (is (= input-values
                (sort-by :a
                         (mapcat (fn [ledger-id]
@@ -117,4 +116,4 @@
                                         (if (.hasMoreElements entries)
                                           (recur new-entries (.nextElement entries))
                                           new-entries)))))
-                                ledger-ids))))))))
+                                ledger-ids))))))))


make defiles with now deps always run

make defiles with now deps always run

--- src/cake/core.clj
+++ src/cake/core.clj
@@ -104,9 +104,10 @@
                                (seq (filter (partial mtime< f#)
                                             (into ~file-deps
                                                   (map #(file ".cake" "run" (name %))
-                                                       '~task-deps)))))
+                                                       '~task-deps))))
+                               (nil? (seq ~deps))))
                            ~pred)
-                  ~@actions))))))
+                  ~@actions)))))

 (defmacro undeftask [& names]
   `(swap! tasks dissoc ~@(map #(list 'quote %) names)))


Update load-test for new apis.

Update load-test for new apis.

--- src/cavm/core.clj
+++ src/cavm/core.clj
@@ -60,11 +60,14 @@
                     (cgdata/matrix-data meta features (line-seq in)))]
       (load-exp stats meta data-fn features))))

-(defn- loadtest [name ^Integer m ^Integer n]
+(defn- loadtest [name m n]
   (create)
   (let [mi (Integer. m)
         ni (Integer. n)]
-  (load-exp name (now) "FIXME" (cgdata/matrix-data nil (data/matrix mi ni)))))
+  (load-exp
+    [{:name name :time (now) :hash "FIXME" }]
+    {"name" name}
+    (fn [] (cgdata/matrix-data {} nil (data/matrix mi ni))) nil)))

 ;


Consistent naming of kvs entry, not item.

--- src/cbfg/kvs.cljs
+++ src/cbfg/kvs.cljs
@@ -4,7 +4,7 @@

 ; A kvs is an abstraction of ordered-KV store.  Concrete examples
 ; would include couchkvs, forestDB, rocksDB, sqlite, bdb, gklite.
-; The mapping is ordered-key => sq => item, and ordered-sq => item.
+; The mapping is ordered-key => sq => entry, and ordered-sq => entry.
 ;
 ; Abstract operations include...
 ; - multi-get


Don't need opt-done-ch anymore.

Don't need opt-done-ch anymore.

--- src/cbfg/kvs.cljs
+++ src/cbfg/kvs.cljs
@@ -50,8 +50,8 @@
         [state {:status :not-found :status-info :no-kvs}])
       [state {:status :invalid :status-info :no-kvs-ident}])))

-(defn state-work [actx state-ch m work-fn & opt-done-ch]
-  (let [done-ch (or opt-done-ch (achan actx))]
+(defn state-work [actx state-ch m work-fn]
+  (let [done-ch (achan actx)]
     (act state-work actx
          (aput state-work state-ch [work-fn done-ch]))
          (aput state-work (:res-ch m)
@@ -84,7 +84,7 @@
    :multi-get
    (fn [actx state-ch m]
      (let [keys (:keys m)
-           res-m (dissoc m :keys)
+           res-m (dissoc m :status :status-info :partial :keys)
            res-ch (:res-ch m)
            work-fn (fn [state kvs]
                      (act multi-get actx


fix repl typo

fix repl typo

--- src/lt/plugins/kukui/query.cljs
+++ src/lt/plugins/kukui/query.cljs
@@ -330,7 +330,7 @@
 (defn files-must-be-in-sync [ids]
   (let [files (set (keep (comp :file d/entity) ids))
         [ed-files not-ed-files] ((juxt filter remove) #(-> % pool/by-path first) files)
-        dirty (filter :dirty (map #(-> % pool/by-path first deref) [file]))]
+        dirty (filter :dirty (map #(-> % pool/by-path first deref) ed-files))]
     (when (seq not-ed-files)
       (prn "Unable to verify these files not in buffers:" not-ed-files))
     (when (seq dirty)


Enable previously broken tests

Enable previously broken tests

--- test/joda_time/partial_test.clj
+++ test/joda_time/partial_test.clj
@@ -12,15 +12,13 @@
             LocalDateTime YearMonth MonthDay DateTimeUtils]
            [org.joda.time.chrono GJChronology]))

-;TODO: currently fails due to https://github.com/JodaOrg/joda-time/issues/96
-#_(defspec partial-reconstructed-from-map-representation 100
+(defspec partial-reconstructed-from-map-representation 100
   (prop/for-all [^ReadablePartial part jg/any-partial]
                 (= (j/partial (assoc (j/as-map part)
                                      :chronology (.getChronology part)))
                    part)))

-;TODO: currently fails due to https://github.com/JodaOrg/joda-time/issues/96
-#_(defspec map-of-merged-partials-same-as-merged-maps 100
+(defspec map-of-merged-partials-same-as-merged-maps 100
   (prop/for-all [partials (gen/not-empty (gen/vector jg/any-partial))]
                 (try
                   (= (apply j/merge partials)


Fix typo.

Fix typo.

--- test/kixi/hecuba/parse_test.clj
+++ test/kixi/hecuba/parse_test.clj
@@ -8,7 +8,7 @@

 (defn non-empty? [n] (if (coll? n) (seq n) n))

-;; This is a function copied from new_profile.cljs. Test shoudl be moved to cljs tests once they are set up.
+;; This is a function copied from new_profile.cljs. Test should be moved to cljs tests once they are set up.
 (defn parse
   "Remove all empty elements from the nested data structure and flatten :_value elements."
   [cursor]


Add integration tests for mget and mset

Add integration tests for mget and mset

--- test/poky/kv/jdbc/util_test.clj
+++ test/poky/kv/jdbc/util_test.clj
@@ -1,6 +1,7 @@
 (ns poky.kv.jdbc.util-test
   (:require [poky.kv.jdbc.util :refer :all]
             [poky.kv.core :as kv]
+            [poky.util :as util]
             [environ.core :refer [env]]
             [clj-time.core :as t]
             [clj-time.coerce :as tc]
@@ -20,25 +21,67 @@
                                         ?form
                                         (close-connection @@S)))]
   (facts :integration :jdbc-set
-         (jdbc-set @@S bucket "key" "value") => (contains {:result "inserted"})
-         (jdbc-set @@S bucket "key" "value") => (contains {:result "updated"})
-         (jdbc-set @@S bucket "key" "value"
-                   (tc/to-sql-date (t/plus (t/now) (t/days 1)))) => (contains {:result "updated"})
+    (jdbc-set @@S bucket "key" "value") => (contains {:result "inserted"})
+    (jdbc-set @@S bucket "key" "value") => (contains {:result "updated"})
+    (jdbc-set @@S bucket "key" "value"
+              (tc/to-sql-date (t/plus (t/now) (t/days 1)))) => (contains {:result "updated"})

-         ; unconditionally accept a set without a modified
-         (jdbc-set @@S bucket "key" "value") => (contains {:result "updated"})
+    ; unconditionally accept a set without a modified
+    (jdbc-set @@S bucket "key" "value") => (contains {:result "updated"})

-         ; the modified_at should be 1 day in the future. this should be
-         ; rejected
-         (jdbc-set @@S bucket "key" "value"
-                   (tc/to-sql-date (t/now))) => (contains {:result "rejected"}))
+    ; the modified_at should be 1 day in the future. this should be
+    ; rejected
+    (jdbc-set @@S bucket "key" "value"
+              (tc/to-sql-date (t/now))) => (contains {:result "rejected"}))

   (facts :integration :jdbc-get
-         (jdbc-get @@S bucket "key") => falsey
-         (jdbc-set @@S bucket "key" "value") => (contains {:result "inserted"})
-         (jdbc-get @@S bucket "key") => (contains {:key "key" :data "value"}))
+    (jdbc-get @@S bucket "key") => falsey
+    (jdbc-set @@S bucket "key" "value") => (contains {:result "inserted"})
+    (jdbc-get @@S bucket "key") => (contains {:key "key" :data "value"}))

   (facts :integration :jdbc-delete
-         (jdbc-set @@S bucket "key" "value") => (contains {:result "inserted"})
-         (jdbc-delete @@S bucket "key") => '(1)
-         (jdbc-delete @@S bucket "key") => '(0)))
+    (jdbc-set @@S bucket "key" "value") => (contains {:result "inserted"})
+    (jdbc-delete @@S bucket "key") => '(1)
+    (jdbc-delete @@S bucket "key") => '(0))
+
+
+  (with-state-changes [(around :facts (do
+                                        (jdbc-set @@S bucket "key1" "value1" (tc/to-sql-date (t/now)))
+                                        (jdbc-set @@S bucket "key2" "value2" (tc/to-sql-date (t/minus (t/now) (t/minutes 5))))
+                                        ?form
+                                        (jdbc-delete @@S bucket "key1")
+                                        (jdbc-delete @@S bucket "key2")))]
+    (facts :integration :jdbc-mget
+      (fact "basic mget"
+        (jdbc-mget @@S bucket [{:key "key1"} {:key "key2"}])
+        => (just
+             (contains {:key "key1"})
+             (contains {:key "key2"})
+             :in-any-order))
+
+      (facts "empty results"
+        (jdbc-mget @@S bucket []) => empty?
+        (jdbc-mget @@S bucket [{}]) => empty?
+        (jdbc-mget @@S bucket [{:key "unknown-key"}]) => empty?)
+
+      (facts "modified_at"
+        (let [key1-ts (-> (jdbc-get @@S bucket "key1") :modified_at)
+              key1-ts-invalid (java.sql.Timestamp. (+ (.getTime key1-ts) 36000))
+              key2-ts (-> (jdbc-get @@S bucket "key2") :modified_at)]
+          (fact "valid"
+            (jdbc-mget @@S bucket [{:key "key1" :modified_at key1-ts}]) => (just (contains {:key "key1"})))
+          (fact "invalid"
+            (jdbc-mget @@S bucket [{:key "key1" :modified_at key1-ts-invalid}]) => empty?)
+          (fact "invalid + valid"
+            (jdbc-mget @@S bucket [{:key "key1" :modified_at key1-ts-invalid}
+                                   {:key "key2" :modified_at key2-ts}]) => (just (contains {:key "key2"})))))))
+
+    (facts :integration :jdbc-mset
+      (fact "single set"
+        (jdbc-mset @@S bucket [{:key "key1" :data "data1"}]) => (just "inserted"))
+      (fact "multi set"
+        (let [key1-ts (util/http-date->Timestamp "Sat, 29 Jun 2013 22:43:43 GMT")]
+         (jdbc-mset @@S bucket [{:key "key1" :data "data1" :modified_at key1-ts}
+                                 {:key "key2" :data "data2"}]) => (just "inserted" "inserted")
+         (jdbc-get @@S bucket "key1") => (contains {:bucket bucket :key "key1" :data "data1" :modified_at key1-ts})
+         (jdbc-get @@S bucket "key2") => (contains {:bucket bucket :key "key2" :data "data2"})))))


CMR-5454: Fixed test.

CMR-5454: Fixed test.

--- system-int-test/src/cmr/system_int_test/data2/core.clj
+++ system-int-test/src/cmr/system_int_test/data2/core.clj
@@ -36,8 +36,7 @@
   for UMM JSON format."
   [concept-type format-key]
   (if-let [version (:version format-key)]
-    (mime-types/format->mime-type {:format format-key
-                                   :version version})
+    (mime-types/format->mime-type format-key)
     (if (= :umm-json format-key)
       (mime-types/format->mime-type {:format format-key
                                      :version (versioning/current-version concept-type)})
@@ -49,10 +48,7 @@
    (item->concept item :echo10))
   ([item format-key]
    (let [concept-type (umm-legacy/item->concept-type item)
-         format (format-key->concept-format concept-type format-key)
-         format-key (if-let [umm-format (:format format-key)]
-                      umm-format
-                      format-key)]
+         format (format-key->concept-format concept-type format-key)]
      (merge {:concept-type concept-type
              :provider-id (or (:provider-id item) "PROV1")
              :native-id (or (:native-id item) (item->native-id item))


Fix selector and priority integs

Fix selector and priority integs

--- modules/messaging/src/main/clojure/immutant/messaging/core.clj
+++ modules/messaging/src/main/clojure/immutant/messaging/core.clj
@@ -213,15 +213,17 @@
         (log/info "Topic already exists:" name)))
     (throw (Exception. (str "Unable to start topic: " name)))))

-(defn create-session [^javax.jms.XAConnection connection]
-  (if (registry/get factory-name)
-    (.createXASession connection)
-    (.createSession connection false Session/AUTO_ACKNOWLEDGE)))
+(defn create-session [connection]
+  (if-in-immutant
+   (.createXASession connection)
+   (.createSession connection false Session/AUTO_ACKNOWLEDGE)))

 (defn create-connection
   "Creates a connection and registers it in the *connections* map"
   [opts]
-  (let [conn (.createXAConnection (connection-factory opts) (:username opts) (:password opts))]
+  (let [conn (if-in-immutant
+              (.createXAConnection (connection-factory opts) (:username opts) (:password opts))
+              (.createConnection (connection-factory opts) (:username opts) (:password opts)))]
     (if (:client-id opts) (.setClientID conn (:client-id opts)))
     (if *connections* (set! *connections* (assoc *connections* (connection-key opts) conn)))
     conn))


doc(ccw.events): explained wy we need to wrap the data inside a vector

--- ccw.core/src/clj/ccw/events.clj
+++ ccw.core/src/clj/ccw/events.clj
@@ -25,11 +25,15 @@
 (defn send-event [topic data]
   (when-let [event-broker @event-broker]
     (println "will send" (as-topic topic) ", data:" data)
+    ;; we force the data type to smth other than a Map so
+    ;; we get consistent behavior in the handler
     (.send event-broker (as-topic topic) [data])))

 (defn post-event [topic data]
   (println "will post" (as-topic topic) ", data:" data)
   (when-let [event-broker @event-broker]
+    ;; we force the data type to smth other than a Map so
+    ;; we get consistent behavior in the handler
     (.post event-broker (as-topic topic) [data])))

 (defn subscribe
@@ -42,6 +46,8 @@
               (handleEvent [this event]
                 (event-handler-var
                   (topic-as-keyword (.getTopic event))
+                  ;; call to (get 0) to extract the data from the
+                  ;; vector
                   (first (.getProperty event DATA)))))]
         (when (.subscribe event-broker
                 (as-topic topic)


Also show :> in material-ui example

Also show :> in material-ui example

--- examples/material-ui/src/example/core.cljs
+++ examples/material-ui/src/example/core.cljs
@@ -93,9 +93,12 @@
                   (reset! text-state (.. e -target -value)))
      :select true}
     [menu-item
-     {:value 1} "Item 1"]
-    [menu-item
-     {:value 2} "Item 2"]]])
+     {:value 1}
+     "Item 1"]
+    ;; Same as previous, alternative to adapt-react-class
+    [:> mui/MenuItem
+     {:value 2}
+     "Item 2"]]])

 (defn start []
   (r/render [main] (js/document.getElementById "app")))


:tada: Give unique names to objects when pasting

--- frontend/src/uxbox/main/data/workspace.cljs
+++ frontend/src/uxbox/main/data/workspace.cljs
@@ -930,26 +930,34 @@
 ;; --- Add shape to Workspace

 (defn impl-retrieve-used-names
-  "Returns a set of already used names by shapes
-  in the current workspace page."
-  [state]
-  (let [page-id (::page-id state)
-        objects (get-in state [:workspace-data page-id :objects])]
-    (into #{} (map :name) (vals objects))))
+  [objects]
+  (into #{} (map :name) (vals objects)))
+
+(defn extract-numeric-suffix
+  [basename]
+  (let [result (re-find #"(.*)-([0-9]+)$" basename)]
+    (if result
+      [(get result 1) (+ 1 (js/parseInt (get result 2)))]
+      [basename 1])))

 (defn impl-generate-unique-name
-  "A unique name generator based on the current workspace page."
-  [state basename]
-  (let [used (impl-retrieve-used-names state)]
-    (loop [counter 1]
-      (let [candidate (str basename "-" counter)]
+  "A unique name generator"
+  [objects basename]
+  (let [used (impl-retrieve-used-names objects)
+        [prefix initial] (extract-numeric-suffix basename)]
+    (loop [counter initial]
+      (let [candidate (str prefix "-" counter)]
         (if (contains? used candidate)
           (recur (inc counter))
           candidate)))))

 (defn impl-assoc-shape
+  "Add a shape to the current workspace page, inside a given frame.
+  Give it a name that is unique in the page"
   [state {:keys [id frame-id] :as data}]
-  (let [name (impl-generate-unique-name state (:name data))
+  (let [page-id (::page-id state)
+        objects (get-in state [:workspace-data page-id :objects])
+        name (impl-generate-unique-name objects (:name data))
         shape (assoc data :name name)
         page-id (::page-id state)]
     (-> state
@@ -2051,27 +2059,48 @@

 (defn- paste-impl
   [{:keys [selected objects] :as data}]
-  (letfn [(prepare-change [delta id]
+  (letfn [(prepare-changes [state delta]
+            "Prepare objects to paste: generate new id, give them unique names,
+            and move to the position of mouse pointer"
+            (let [page-id (::page-id state)]
+              (loop [existing-objs (get-in state [:workspace-data page-id :objects])
+                     chgs []
+                     id   (first selected)
+                     ids  (rest selected)]
+                (if (nil? id)
+                  chgs
+                  (let [result (prepare-change id existing-objs delta)
+                        result (if (vector? result) result [result])]
+                    (recur
+                     (reduce conj existing-objs (map (fn [item] {(:id item) (:obj item)}) result))
+                     (into chgs result)
+                     (first ids)
+                     (rest ids)))))))
+
+          (prepare-change [id existing-objs delta]
             (let [obj (get objects id)]
               (if (= :frame (:type obj))
-                (prepare-frame-change obj delta)
-                (prepare-shape-change obj delta uuid/zero))))
-
-          (prepare-shape-change [obj delta frame-id]
+                (prepare-frame-change existing-objs obj delta)
+                (prepare-shape-change existing-objs obj delta uuid/zero))))
+
+          (prepare-shape-change [objects obj delta frame-id]
             (let [id (uuid/next)
-                  renamed-obj (assoc obj :id id :frame-id frame-id)
+                  name (impl-generate-unique-name objects (:name obj))
+                  renamed-obj (assoc obj :id id :frame-id frame-id :name name)
                   moved-obj (geom/move renamed-obj delta)]
               {:type :add-obj
                :id id
                :frame-id frame-id
                :obj moved-obj}))

-          (prepare-frame-change [obj delta]
+          (prepare-frame-change [objects obj delta]
             (let [frame-id (uuid/next)
+                  frame-name (impl-generate-unique-name objects (:name obj))
                   sch (->> (map #(get objects %) (:shapes obj))
-                           (map #(prepare-shape-change % delta frame-id)))
+                           (map #(prepare-shape-change objects % delta frame-id)))
                   renamed-frame (-> obj
                                     (assoc :id frame-id)
+                                    (assoc :name frame-name)
                                     (assoc :frame-id uuid/zero)
                                     (assoc :shapes (mapv :id sch)))
                   moved-frame (geom/move renamed-frame delta)
@@ -2090,8 +2119,7 @@
             delta {:x (- (:x mouse-pos) (:x orig-pos))
                    :y (- (:y mouse-pos) (:y orig-pos))}

-            rchanges (->> (map (partial prepare-change delta) selected)
-                          (flatten))
+            rchanges (prepare-changes state delta)
             uchanges (map (fn [ch]
                             {:type :del-obj
                              :id (:id ch)})


fix wallet contact migration

fix wallet contact migration

--- src/status_im/data_store/realm/schemas/account/v16/core.cljs
+++ src/status_im/data_store/realm/schemas/account/v16/core.cljs
@@ -64,7 +64,10 @@
   (log/debug "migrating v16 account database: " old-realm new-realm)
   (when-let [wallet-chat (chat-by-id new-realm "wallet")]
     (.delete new-realm wallet-chat))
-  (when-let [wallet-contact (chat-by-id new-realm "wallet")]
+  (when-let [wallet-contact (some-> new-realm
+                                    (.objects "contact")
+                                    (.filtered (str "whisper-identity = \"wallet\""))
+                                    (aget 0))]
     (.delete new-realm wallet-contact))
   (migrate-commands new-realm "command-request")
   (migrate-commands new-realm "command"))


Added tests for `process-token` with `swap`

--- test/simple_symbolic_regression_clojure/interpreter_test.clj
+++ test/simple_symbolic_regression_clojure/interpreter_test.clj
@@ -2,9 +2,6 @@
   (:use midje.sweet)
   (:use [simple-symbolic-regression-clojure.interpreter])
   )
-(fact "gets a vector containing two arguments, returns a vector with same elements reversed")
-      (swap 5 8) => [8 5])
-

 (fact "it gets a empty program and an empty binding it returns nil with an empty stack"
       (interpret [] {}) => {:result nil, :stack []})
@@ -84,6 +81,19 @@
                => [2469133333333333308642N]
              )
        )
+
+
+(fact "swap gets a vector containing two arguments, returns a vector with same elements reversed"
+      (swap 5 8) => [8 5])
+
+(facts "about process-token with :swap"
+       (fact "process-token with :swap and an empty stack"
+             (process-token [] :swap) => [])
+       (fact "process-token with :swap and only one number"
+             (process-token [7] :swap) => [7])
+       (fact "process-token with :swap and two numbers"
+             (process-token [3 5] :swap) => [5 3]))
+

 (facts "about process-token with a variable"
        (fact "process-token with an undefined variable"


Be less offensive.

Be less offensive.

--- modules/core/src/main/clojure/immutant/runtime/bootstrap.clj
+++ modules/core/src/main/clojure/immutant/runtime/bootstrap.clj
@@ -31,7 +31,6 @@
   (require 'leiningen.core.classpath)
   (require 'leiningen.core.project)
   (catch RuntimeException e
-    (println "FUCKTAR")
     (if (and (<= 1 (:major *clojure-version*))
              (> 4 (:minor *clojure-version*)))
       (println "WARNING: immutant.dev requires clojure 1.4 or greater and you've loaded it under clojure 1.3")


big image ui

big image ui

--- src/makerbar/pov/console/ui.clj
+++ src/makerbar/pov/console/ui.clj
@@ -28,10 +28,10 @@
     (p/translate (- (p/width)) 0))

   ; clear
-  (p/background 100)
+  (p/background 0)

   ; info
-  (p/text (str "Display dimensions: " s/pov-width " x " s/pov-height) 40 (- 80 20 (p/text-descent)))
+  #_(p/text (str "Display dimensions: " s/pov-width " x " s/pov-height) 40 (- 80 20 (p/text-descent)))

   (let [t @time-t
         now (System/currentTimeMillis)
@@ -39,16 +39,21 @@
     (reset! time-t now)

     ; display frames per second
-    (p/with-style
-      (p/stroke 255)
-      (p/text (str "Processing FPS: " (format "%.1f" fps)) 40 40))
+    #_(p/with-style
+       (p/stroke 255)
+       (p/text (str "Processing FPS: " (format "%.1f" fps)) 40 40))

     ; rotate
     (s/inc-pov-offset [(* (s/get-state :rotation-speed) (s/get-state :rotation-direction)) 0]))

   (p/with-matrix
-    (p/translate 40 80)
-    (p/scale 3)
+;    (p/translate 40 80)
+;    (p/scale 3)
+
+    (let [{:keys [offset scale]} (i/scale-image-instructions s/pov-width s/pov-height (* 0.9 (p/width)) (* 0.9 (p/height)))]
+      (p/translate (* 0.05 (p/width)) (* 0.05 (p/height)))
+      (p/translate offset)
+      (p/scale scale))

     ; draw image
     (d/draw-image)
@@ -59,34 +64,34 @@
         (n/pov-send-data pov-addr data)))

     ; draw frame
-    (p/with-style
-      (p/stroke 200)
-      (p/no-fill)
-      (p/rect -1 -1 (+ s/pov-width 1) (+ s/pov-height 1))))
+    #_(p/with-style
+       (p/stroke 200)
+       (p/no-fill)
+       (p/rect -1 -1 (+ s/pov-width 1) (+ s/pov-height 1))))

   ; image list
-  (p/with-matrix
-    (p/translate (- (p/width) 500) 100)
+  #_(p/with-matrix
+     (p/translate (- (p/width) 500) 100)

-    (p/with-matrix
-      (when-let [img (i/get-selected-image)]
-        (let [{:keys [offset scale]} (i/scale-image-instructions (.width img) (.height img) s/pov-width s/pov-height)]
-          (p/scale scale)
-          (p/image img offset))))
+     (p/with-matrix
+       (when-let [img (i/get-selected-image)]
+         (let [{:keys [offset scale]} (i/scale-image-instructions (.width img) (.height img) s/pov-width s/pov-height)]
+           (p/scale scale)
+           (p/image img offset))))

-    (p/with-style
-      (p/stroke 255)
-      (p/text (i/display-image-list) 0 120)))
+     (p/with-style
+       (p/stroke 255)
+       (p/text (i/display-image-list) 0 120)))

   ; instructions
-  (p/with-style
-    (p/stroke 255)
-    (p/text (k/display-keyboard-controls) 40 (- (p/height) 400)))
+  #_(p/with-style
+     (p/stroke 255)
+     (p/text (k/display-keyboard-controls) 40 (- (p/height) 400)))

   ; status
-  (p/with-style
-    (p/stroke 255)
-    (p/text (s/display-status) 400 (- (p/height) 400)))
+  #_(p/with-style
+     (p/stroke 255)
+     (p/text (s/display-status) 400 (- (p/height) 400)))

   ; fade overlay
   (p/with-style