Update to latest collection of dependencies, which match the v0.10.1 release (#53)

--- src/leiningen/new/re_frame/project.clj
+++ src/leiningen/new/re_frame/project.clj
@@ -1,11 +1,11 @@
 (defproject {{ns-name}} "0.1.0-SNAPSHOT"
   :dependencies [[org.clojure/clojure "1.8.0"]
-                 [org.clojure/clojurescript "1.9.229"]
-                 [reagent "0.6.0"]
-                 [re-frame "0.9.4"]{{#re-frisk?}}
+                 [org.clojure/clojurescript "1.9.908"]
+                 [reagent "0.7.0"]
+                 [re-frame "0.10.1"]{{#re-frisk?}}
                  [re-frisk "0.4.5"]{{/re-frisk?}}{{#re-com?}}
                  [org.clojure/core.async "0.2.391"]
-                 [re-com "2.0.0"]{{/re-com?}}{{#routes?}}
+                 [re-com "2.1.0"]{{/re-com?}}{{#routes?}}
                  [secretary "1.2.3"]{{/routes?}}{{#garden?}}
                  [garden "1.3.2"]
                  [ns-tracker "0.3.0"]{{/garden?}}{{#handler?}}
@@ -13,7 +13,7 @@
                  [yogthos/config "0.8"]
                  [ring "1.4.0"]{{/handler?}}]

-  :plugins [[lein-cljsbuild "1.1.4"]{{#garden?}}
+  :plugins [[lein-cljsbuild "1.1.5"]{{#garden?}}
             [lein-garden "0.2.8"]{{/garden?}}{{#less?}}
             [lein-less "1.7.5"]{{/less?}}{{#sass?}}
             [lein-sassy "1.0.8"]{{/sass?}}]
@@ -47,11 +47,11 @@

   :profiles
   {:dev
-   {:dependencies [[binaryage/devtools "0.8.2"]{{#cider?}}
+   {:dependencies [[binaryage/devtools "0.9.4"]{{#cider?}}
                    [figwheel-sidecar "0.5.9"]
                    [com.cemerick/piggieback "0.2.1"]{{/cider?}}]

-    :plugins      [[lein-figwheel "0.5.9"]{{#test?}}
+    :plugins      [[lein-figwheel "0.5.13"]{{#test?}}
                    [lein-doo "0.1.7"]{{/test?}}]
     }}


Исправления...

Исправления...

--- radiolamp-6P3S/src/r6p3s/ui/ul_navbar_nav_right.cljs
+++ radiolamp-6P3S/src/r6p3s/ui/ul_navbar_nav_right.cljs
@@ -1,4 +1,4 @@
-(ns r6p3s.ui.navbar-nav-right
+(ns r6p3s.ui.ul-navbar-nav-right
   (:require [om.dom :as dom :include-macros true]))


:bug: Fix image paste in production build

--- frontend/src/uxbox/util/webapi.cljs
+++ frontend/src/uxbox/util/webapi.cljs
@@ -86,10 +86,10 @@
   []
   (let [cboard (unchecked-get js/navigator "clipboard")
         read-item (fn [item]
-                    (let [img-type (->> (.-types item)
+                    (let [img-type (->> (.-types ^js item)
                                         (d/seek #(str/starts-with? % "image/")))]
                       (if img-type
-                        (rx/from (.getType item img-type))
+                        (rx/from (.getType ^js item img-type))
                         (rx/empty))))]
     (->> (rx/from (.read ^js cboard)) ;; Get a stream of item lists
          (rx/mapcat identity)     ;; Convert each item into an emission


add server support for disconnect timeout and configurable keepalive

--- src/ninjudd/eventual/server.clj
+++ src/ninjudd/eventual/server.clj
@@ -7,24 +7,29 @@
              "Content-Type" "text/event-stream; charset=utf-8"
              "Cache-Control" "no-cache"))

-(defn sse-channel [f events]
-  (let [out (chan)]
+(defn sse-channel [f events & [opts]]
+  (let [out (chan)
+        disconnect (if-let [t (:timeout opts)]
+                     (timeout t)
+                     (chan))]
     (go (loop []
-          (let [[event ch] (alts! [events (timeout 3000)])]
-            (if (= ch events)
-              (when event
-                (>! out (str "data: " (f event) "\n\n"))
-                (recur))
-              (do
-                (>! out ":keepalive\n")
-                (recur)))))
+          (let [keepalive (timeout (:keepalive opts 25000))
+                [event ch] (alts! [events keepalive disconnect])]
+            (cond
+             (= ch events)
+             (when event
+               (>! out (str "data: " (f event) "\n\n"))
+               (recur))
+             (= ch keepalive)
+             (do (>! out ":keepalive\n")
+                 (recur)))))
         (close! out))
     out))

-(defn edn-events [events]
+(defn edn-events [events & [opts]]
   (add-sse-headers
-   {:body (sse-channel pr-str events)}))
+   {:body (sse-channel pr-str events opts)}))

-(defn json-events [events]
+(defn json-events [events & [opts]]
   (add-sse-headers
-   {:body (sse-channel json/generate-string events)}))
+   {:body (sse-channel json/generate-string events opts)}))


Fix inbox activity render.

Fix inbox activity render.

--- src/oc/storage/api/activity.clj
+++ src/oc/storage/api/activity.clj
@@ -222,7 +222,7 @@
                              board-slugs-and-names (map #(array-map :slug (:slug %) :access (:access %) :name (:name %)) boards)
                              board-by-uuids (zipmap board-uuids board-slugs-and-names)
                              activity (assemble-inbox conn params org board-by-uuids allowed-boards user-id)]
-                          (activity-rep/render-activity-list params org "inbox" nil activity boards user))))
+                          (activity-rep/render-activity-list params org "inbox" activity boards user))))

 ;; ----- Routes -----


fix Exercise 1.13

fix Exercise 1.13


Revert "React property _reactInternalInstance was removed in React 0.13"

This reverts commit 3f4a421f144a49413bfd3d26540e0126b4d62b72.

--- src/reagent/impl/component.cljs
+++ src/reagent/impl/component.cljs
@@ -268,7 +268,8 @@
        create-react-class))

 (defn component-path [c]
-  (let [elem (some-> c
+  (let [elem (some-> (or (some-> c ($ :_reactInternalInstance))
+                          c)
                      ($ :_currentElement))
         name (some-> elem
                      ($ :type)


Set stylesheet on entire scene

Set stylesheet on entire scene

--- src/net/sekao/nightcode/controller.clj
+++ src/net/sekao/nightcode/controller.clj
@@ -280,7 +280,7 @@
 ; dark

 (defn dark-theme! [^Scene scene]
-  (-> scene .getRoot .getStylesheets (.add "dark.css"))
+  (-> scene .getStylesheets (.add "dark.css"))
   (p/theme-webviews! (swap! runtime-state assoc :theme :dark)))

 (defn -onDarkTheme [this ^ActionEvent event]
@@ -289,7 +289,7 @@
 ; light

 (defn light-theme! [^Scene scene]
-  (-> scene .getRoot .getStylesheets .clear)
+  (-> scene .getStylesheets .clear)
   (p/theme-webviews! (swap! runtime-state assoc :theme :light)))

 (defn -onLightTheme [this ^ActionEvent event]


Port templates for the remaining account subpages. Behavior hasn't been ported yet.

--- frontend/components/account.cljs
+++ frontend/components/account.cljs
@@ -3,6 +3,7 @@
             [clojure.string :as string]
             [frontend.async :refer [put!]]
             [frontend.components.common :as common]
+            [frontend.components.forms :as forms]
             [frontend.routes :as routes]
             [frontend.state :as state]
             [frontend.utils :as utils :include-macros true]
@@ -18,6 +19,141 @@

 (defn handle-email-notification-change [ch pref]
   (put! ch [:preferences-updated {:basic_email_prefs pref}]))
+
+;; XXX 1. Styling is off here
+;; 2. user-and-orgs is just user data now, find out how to get real data
+(defn plans [app owner]
+  (reify
+    om/IRender
+    (render [_]
+      (let [controls-ch (om/get-shared owner [:comms :controls])
+            user-and-orgs [(get-in app state/user-path)]]
+        (html/html
+         [:div#settings-plans
+          [:div.plans-item [:h2 "Org Settings"]]
+          [:div.plans-item
+           [:h4 "Set up a plan for one of your Organizations:"]
+           [:p "You can set up plans for any organization that you admin."]
+           [:div
+            (map
+             (fn [org]
+               ;; XXX Dummy org data, make sure works with real org data
+               (let [org-url    (routes/v1-org-settings-subpage {:org     (:login org)
+                                                                 :subpage "plans"})
+                     avatar-url (gh-utils/gravatar-url {:gravatar_id (:gravatar_id org)
+                                                        :login       (:login org)
+                                                        :size        25})]
+                 [:div
+                  [:a
+                   {:href org-url}
+                   [:img
+                    {:src    avatar-url
+                     :height 25
+                     :width  25}]]
+                  [:a
+                   {:href org-url}
+                   [:span (:login org)]]
+                  [:br]]))
+             user-and-orgs)]]])))))
+
+;; XXX 1. The placeholder drops over the field value whenever saving, not
+;; sure why
+;; XXX 2. How can we re-enable the form after it's been processed?
+(defn heroku-key [app owner]
+  (reify
+    om/IRender
+    (render [_]
+      (let [controls-ch          (om/get-shared owner [:comms :controls])
+            heroku-api-key       (get-in app (conj state/user-path :heroku_api_key))
+            heroku-api-key-input (str (om/get-state owner :heroku-api-key-input))
+            processing-form?     (om/get-state owner :processing?)
+            form-processed?      false
+            submit-form!         #(when (seq heroku-api-key-input)
+                                    (om/set-state! owner :processing? true)
+                                    (put! controls-ch [:heroku-key-add-attempted {:heroku_api_key %}]))]
+        (html/html
+         [:div#settings-heroku
+          [:div.heroku-item
+           [:h2 "Heroku API key"]
+           [:p
+            "Add your "
+            [:a
+             {:href "\\https://dashboard.heroku.com/account\\"}
+             "Heroku API Key"]
+            " to set up deployment with Heroku."
+            [:br]
+            "You'll also need to set yourself as the Heroku deploy user from your project's settings page."]
+           [:form
+            {:onSubmit (fn [event]
+                         (.preventDefault event)
+                         (submit-form! heroku-api-key-input))}
+            (when heroku-api-key
+              [:div
+               [:input.disabled
+                {:required  "",
+                 :type      "text",
+                 :value heroku-api-key}]
+               [:label {:placeholder "Current Heroku key"}]])
+            [:input
+             {:required  true
+              :type      "text",
+              :value     heroku-api-key-input
+              :disabled  processing-form?
+              :class     (when processing-form?
+                           "disabled")
+              :onChange  (fn [event]
+                           (om/set-state! owner :heroku-api-key-input (.. event -target -value)))}]
+            [:label {:placeholder "Add new key"}]
+            (forms/managed-button
+             [:a {:data-loading-text "Saving...",
+                  :data-failed-text  "Failed to save Heroku key",
+                  :data-success-text "Saved",
+                  :on-click          #(submit-form! heroku-api-key-input)}
+              "Save Heroku key"])]]])))))
+
+;; XXX Not finished - how to find current list of tokens?
+(defn api-tokens [app owner]
+  (reify
+    om/IRender
+    (render [_]
+      (let [controls-ch (om/get-shared owner [:comms :controls])]
+        (html/html
+         [:div#settings-api
+          [:div.api-item
+           [:h2 "API Tokens"]
+           [:p
+            "Create and revoke API tokens to access this account's details using our API.Apps using these tokens can act as you, and have full read- and write-permissions!"]
+           [:form
+            [:input#api-token
+             {:required "",
+              :name "label",
+              :type "text",
+              :data-bind "value: tokenLabel"}]
+            [:label {:placeholder "Token name"}]
+            [:input.btn
+             {:data-failed-text  "Failed",
+              :data-success-text "Created",
+              :data-loading-text "Creating...",
+              :data-bind         "click: create_token",
+              :value             "Create",
+              :type              "submit"}]]]
+          [:div.api-item
+           {:data-bind "if: tokens().length"}
+           [:table.table
+            [:thead [:th "Label"] [:th "Token"] [:th "Created"] [:th]]
+            [:tbody
+             {:data-bind "foreach: tokens"}
+             [:tr
+              [:td {:data-bind "text: label"}]
+              [:td [:span.code {:data-bind "text: token"}]]
+              [:td {:data-bind "text: time"}]
+              [:td
+               [:span
+                {:data-bind "click: $root.current_user().delete_token"}
+                [:a.revoke-token
+                 {:title "Revoke this token", :href "#"}
+                 [:i.fa {:fa-times-circle "fa-times-circle"}]
+                 " revoke"]]]]]]]])))))

 (defn notifications [app owner]
   (reify
@@ -87,7 +223,12 @@
     (render [_]
       (let [subpage     (or (get-in app state/account-subpage-path)
                             :notifications)
-            coms        {:notifications notifications}
+            coms        {;; Finished converting
+                         :notifications notifications
+                         ;; Pending conversion
+                         :heroku        heroku-key
+                         :api           api-tokens
+                         :plans         plans}
             subpage-com (get coms subpage)]
         (html
          [:div#account-settings


Use proper gauges for epoch and replica version.

--- src/onyx/lifecycle/metrics/metrics.clj
+++ src/onyx/lifecycle/metrics/metrics.clj
@@ -11,21 +11,6 @@
   (:import [java.util.concurrent TimeUnit]
            [java.util.concurrent.atomic AtomicLong]
            [com.codahale.metrics Gauge]))
-
-(defprotocol IGauge
-  (setGauge [this value]))
-
-(deftype OGauge [value]
-  IGauge
-  (setGauge [this new-value]
-    (.set ^AtomicLong value ^long new-value))
-  Gauge
-  (getValue [this]
-    (.get ^AtomicLong value)))
-
-;(def v (->OGauge (AtomicLong.)))
-;(setGauge v 9933)
-;(.getValue v)

 (defn new-lifecycle-latency [reg tag lifecycle]
   (let [timer ^com.codahale.metrics.Timer (t/timer reg (into tag ["task-lifecycle" (name lifecycle)]))]
@@ -52,12 +37,11 @@
                                     0
                                     (:tree (:onyx.core/results (task/get-event state)))))))))

-(defn update-rv-epoch [cnt-replica-version cnt-epoch epoch-rate]
+(defn update-rv-epoch [^AtomicLong replica-version ^AtomicLong epoch epoch-rate]
   (fn [state latency-ns]
     (m/mark! epoch-rate 1)
-    (c/inc! cnt-replica-version (- (task/replica-version state)
-                                   (c/value cnt-replica-version)))
-    (c/inc! cnt-epoch (- (task/epoch state) (c/value cnt-epoch)))))
+    (.set ^AtomicLong replica-version (task/replica-version state))
+    (.set ^AtomicLong epoch (task/epoch state))))

 ;; FIXME, close counters and remove them from the registry
 (defn before-task [{:keys [onyx.core/job-id onyx.core/id onyx.core/monitoring
@@ -77,10 +61,12 @@
         reg (:registry monitoring)
         _ (when-not reg (throw (Exception. "Monitoring component is not setup")))
         tag ["job" job-name "task" task-name "peer-id" (str id)]
-        cnt-replica-version (c/counter reg (conj tag "replica-version"))
-        cnt-epoch (c/counter reg (conj tag "epoch"))
+        replica-version (AtomicLong.)
+        epoch (AtomicLong.)
+        gg-replica-version (g/gauge-fn reg (conj tag "replica-version") (fn [] (.get ^AtomicLong replica-version)))
+        gg-epoch (g/gauge-fn reg (conj tag "epoch") (fn [] (.get ^AtomicLong epoch)))
         epoch-rate (m/meter reg  (conj tag "epoch-rate"))
-        update-rv-epoch-fn (update-rv-epoch cnt-replica-version cnt-epoch epoch-rate)]
+        update-rv-epoch-fn (update-rv-epoch replica-version epoch epoch-rate)]
     {:onyx.core/monitoring (reduce
                             (fn [mon lifecycle]
                               (assoc mon
@@ -95,4 +81,3 @@

 (def calls
   {:lifecycle/before-task-start before-task})
-


Avoid tracking completions for non-input tasks Clean up completion timings on retry

--- src/onyx/lifecycle/metrics/metrics.clj
+++ src/onyx/lifecycle/metrics/metrics.clj
@@ -11,7 +11,6 @@
 (defrecord Metrics [rate batch-start rate+latency-10s retry-rate completion-tracking completion-rate+latencies-10s])

 (defn before-task [event lifecycle]
-
   (when (:onyx.metrics.metrics/metrics event)
     (throw (ex-info "Only one metrics lifecyle is supported per task." lifecycle)))

@@ -162,9 +161,10 @@
     (let [{:keys [rate batch-start rate+latency-10s completion-tracking]} (:onyx.metrics.metrics/metrics event)
           timestamp (System/nanoTime)
           latency (- timestamp @batch-start)
-          batch (:onyx.core/batch event)
-          map-timings-transducer (map (fn [v] (clojure.lang.MapEntry. (:id v) timestamp)))]
-      (swap! completion-tracking into map-timings-transducer batch)
+          batch (:onyx.core/batch event)]
+      (when (= (:onyx/type (:onyx.core/task-map event)) :input)
+        (let [transducer (map (fn [v] (clojure.lang.MapEntry. (:id v) timestamp)))]
+          (swap! completion-tracking into map-timings-transducer batch)))
       (im/update! rate (count batch))
       (im/update! rate+latency-10s latency)
       {}))
@@ -181,6 +181,7 @@
 (defn on-retry [event message-id rets lifecycle]
   (let [metric (:onyx.metrics.metrics/metrics event)
         retry-rate (:retry-rate metric)]
+    (swap! (:completion-tracking metric) dissoc message-id)
     (im/update! retry-rate 1)))

 (defn after-task [event lifecycle]


Fix missing reader conditional.

Fix missing reader conditional.

--- src/onyx/windowing/window_compile.cljc
+++ src/onyx/windowing/window_compile.cljc
@@ -67,7 +67,7 @@
   (let [agg (:window/aggregation window)
         agg-var (if (sequential? agg) (first agg) agg)
         calls (resolve-var (u/kw->fn agg-var))
-        _ (validation/validate-state-aggregation-calls calls)
+        #?@(:clj (_ (validation/validate-state-aggregation-calls calls)))
         init-fn (resolve-window-init window calls)
         triggers (->> all-triggers
                       (filter #(= (:window/id window) (:trigger/window-id %)))


hardcode large buffer size, less than ideal :/

--- src/org/spootnik/cyanite/es_client.clj
+++ src/org/spootnik/cyanite/es_client.clj
@@ -11,11 +11,15 @@
             [clojure.tools.logging :refer [error info debug]])
   (:import clojurewerkz.elastisch.rest.Connection))

+(def buf-size (* 4096 1024 1024))
+
 (defn multi-get
   [^Connection conn index mapping-type query func]
   (go
     (let [url  (rest/index-mget-url conn index mapping-type)
-          resp (<! (http/post url {:body (json/encode {:docs query})}))]
+          resp (<! (http/post url {:body (json/encode {:docs query})
+                                   :response-buffer-size buf-size
+                                   :request-buffer-size buf-size}))]
       (if (= 200 (:status resp))
         (let [body (json/decode (:body resp) true)]
           (func (filter :found (:docs body))))
@@ -29,7 +33,9 @@
                       (interleave (repeat "\n"))
                       (str/join))]
     (go
-      (let [resp   (<! (http/post url {:body bulk-json}))
+      (let [resp   (<! (http/post url {:body bulk-json
+                                       :response-buffer-size buf-size
+                                       :request-buffer-size buf-size}))
             status (:status resp)]
         (when-not (= 200 status)
           (func resp))))))


Add the ability to create a point instance from hash-map.

--- frontend/src/uxbox/util/geom/point.cljs
+++ frontend/src/uxbox/util/geom/point.cljs
@@ -30,6 +30,9 @@
      (or (vector? v)
          (seq? v))
      (Point. (first v) (second v))
+
+     (map? v)
+     (Point. (:x v) (:y v))

      (number? v)
      (Point. v v)


[ISSUE #3316] Do not avoid keyboard in wallet/fee screen

Signed-off-by: Julien Eluard <c768e13f1ba4c3ebed2909a1fc1e4b50bb021a2f@gmail.com>

--- src/status_im/ui/screens/wallet/send/views.cljs
+++ src/status_im/ui/screens/wallet/send/views.cljs
@@ -106,10 +106,9 @@
 (defview transaction-fee []
   (letsubs [{:keys [amount symbol] :as transaction} [:wallet.send/transaction]
             edit [:wallet/edit]]
-    (let [gas (or (:gas edit) (:gas transaction))
+    (let [gas       (or (:gas edit) (:gas transaction))
           gas-price (or (:gas-price edit) (:gas-price transaction))]
-      [wallet.components/simple-screen {:avoid-keyboard?     true
-                                        :status-toolbar-type :modal-wallet}
+      [wallet.components/simple-screen {:status-toolbar-type :modal-wallet}
        [toolbar true act/close-white
         (i18n/label :t/wallet-transaction-fee)]
        [react/view components.styles/flex


Update to latest clojure version

Update to latest clojure version

--- clojure/cljsearch/project.clj
+++ clojure/cljsearch/project.clj
@@ -4,7 +4,7 @@
   :license {:name "Eclipse Public License"
             :url "http://www.eclipse.org/legal/epl-v10.html"}
   :dependencies [
-                  [org.clojure/clojure "1.8.0"]
+                  [org.clojure/clojure "1.9.0"]
                   [org.clojure/data.json "0.2.6"]
                 ]
   :main ^:skip-aot cljsearch.cljsearch


remove the sort

remove the sort

--- src/stl_collector/flattener.clj
+++ src/stl_collector/flattener.clj
@@ -27,10 +27,9 @@
 (s/defn fill-container :- c/Container
   [container :- c/Container
    boxes :- [b/Box]]
-  (let [sorted-boxes (sort-by (fn [[x y]] (- (* x y))) boxes)]
-    (reduce (fn [cnt box] (c/add cnt box))
-            container
-            sorted-boxes)))
+  (reduce (fn [cnt box] (c/add cnt box))
+          container
+          boxes))

 (s/defn collect-with-rejections :- {:stl        m/STL
                                     :rejections [m/STL]}


Add proper label to draw tools.

Add proper label to draw tools.

--- src/uxbox/locales/en.cljs
+++ src/uxbox/locales/en.cljs
@@ -22,7 +22,7 @@

    "ds.recent-colors" "Recent colors"
    "ds.element-options" "Element options"
-   "ds.tools" "Tools"
+   "ds.draw-tools" "Draw tools"
    "ds.sitemap" "Sitemap"

    "ds.help.rect" "Box (Ctrl + B)"


set token cookie to higher-level domain in order to be read across UI+orchestration

--- src/cljs/org/broadinstitute/firecloud_ui/utils.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/utils.cljs
@@ -81,7 +81,7 @@

 (defn set-access-token-cookie [token]
   (if token
-    (.set goog.net.cookies "FCtoken" token)
+    (.set goog.net.cookies "FCtoken" token -1 "/" (join "." (rest (split js/window.location.hostname "."))))
     (delete-access-token-cookie)))

 (defn get-access-token-cookie []


Refactored to more idiomatic style

Refactored to more idiomatic style

--- src/time_tracker/invoices/handlers.clj
+++ src/time_tracker/invoices/handlers.clj
@@ -60,8 +60,8 @@

 (defn- print-invoice
   [printable-invoice]
-  (let [pdf-stream         (ring-io/piped-input-stream
-                           (partial invoices-core/generate-pdf printable-invoice))]
+  (let [pdf-stream   (ring-io/piped-input-stream
+                     (partial invoices-core/generate-pdf printable-invoice))]
     (-> (res/response pdf-stream)
         (res/content-type "application/pdf"))))

@@ -83,10 +83,9 @@
     (if (or (empty? projects)
             (empty? users))
       web-util/error-not-found
-      (do
-        (let [invoice-to-print (printable-invoice invoice-data)]
-          (invoices-db/create! connection invoice-to-print)
-          (print-invoice invoice-to-print))))))
+      (let [invoice-to-print (printable-invoice invoice-data)]
+        (invoices-db/create! connection invoice-to-print)
+        (print-invoice invoice-to-print)))))

 ;; Endpoint for retrieving all invoices
 ;; GET /api/invoices/
@@ -114,16 +113,14 @@
 ;; GET /api/invoices/<id>/
 (defn retrieve
   [request connection]
-  (let [invoice-id (Integer/parseInt (:id (:route-params request)))]
+  (let [invoice-id   (Integer/parseInt (:id (:route-params request)))
+        content-type (:content-type request)]
     (if-let [invoice (invoices-db/retrieve
                       connection
                       invoice-id)]
-      (do
-        (log/debug {:event "invoice-received" :data invoice})
-        (let [content-type (:content-type request)]
-          (if (= "application/pdf" content-type)
-            (print-invoice (invoice-record->invoice invoice))
-            (res/response invoice))))
+      (if (= "application/pdf" content-type)
+        (print-invoice (invoice-record->invoice invoice))
+        (res/response invoice))
       web-util/error-not-found)))

 ;; Endpoint for updating a single invoice.


Indentation

Indentation

--- test/exploud/web_test.clj
+++ test/exploud/web_test.clj
@@ -34,10 +34,10 @@
                             :headers {}
                             :params {}}}]]
   (let [{:keys [body headers] :as response} (app {:body body
-                                                   :headers headers
-                                                   :params params
-                                                   :request-method method
-                                                   :uri resource})]
+                                                  :headers headers
+                                                  :params params
+                                                  :request-method method
+                                                  :uri resource})]
     (cond-> response
             (streamed-body? response) (update-in [:body] slurp)
             (json-response? response) (update-in [:body] (fn [b] (json/parse-string b true))))))


Removed no longer valid test

Removed no longer valid test

--- test/emender_jenkins/metadata_analyzer_test.clj
+++ test/emender_jenkins/metadata_analyzer_test.clj
@@ -27,12 +27,6 @@
 ; Tests for various function definitions
 ;

-(deftest test-data->csv-existence
-    "Check that the emender-jenkins.metadata-analyzer/data->csv definition exists."
-    (testing "if the emender-jenkins.metadata-analyzer/data->csv definition exists."
-        (is (callable? 'emender-jenkins.metadata-analyzer/data->csv))))
-
-
 (deftest test-select-results-existence
     "Check that the emender-jenkins.metadata-analyzer/select-results definition exists."
     (testing "if the emender-jenkins.metadata-analyzer/select-results definition exists."


call f in each walk step

call f in each walk step

--- test/osmium/core_test.clj
+++ test/osmium/core_test.clj
@@ -1,7 +1,8 @@
 (ns osmium.core-test
   (:require [clojure.test :refer :all]
             [clj-webdriver.taxi :as taxi]
-            [osmium.core :refer :all]))
+            [osmium.core :as o]
+            [clojure.set :as set]))

 (defmulti eval!* (fn [driver [type data]] type))

@@ -39,15 +40,16 @@
 ;; TODO: select options
 ;; TODO: wait (not necessary for a performance demo!)

-
 (defn- ele->id [ele]
   (taxi/attribute ele "id"))

 (defn find-actions [driver]
-  (letfn [(ele->action [])])
   (->> (taxi/find-elements driver {:css ".osmium-action"})
        (map (fn [ele] [:action (ele->id ele)]))
        set))
+
+(defn possible-actions [driver]
+  (conj (find-actions driver) :back :forward :back))

 ;; ======================================================================
 ;; API
@@ -64,14 +66,17 @@
   (eval!* driver x))

 (defn walk-n-steps!
-  "Generates an action and evals it until n actions or no possible actions"
-  [d n]
-  (loop [n n
-         actions []]
-    (if (zero? n)
-      actions
-      (if-let [action (first (find-actions d))]
-        (do
-          (eval! d action)
-          (recur (dec n) (conj actions action)))
-        actions))))
+  "Generates an action and evals it until n actions or no possible actions,
+  calling (f action) at each step."
+  ([d n] (walk-n-steps! d n (fn [_] nil)))
+  ([d n f]
+   (loop [n n
+          actions []]
+     (if (zero? n)
+       actions
+       (if-let [action (first (find-actions d))]
+         (do
+           (eval! d action)
+           (f action)
+           (recur (dec n) (conj actions action)))
+         actions)))))


Story ID: RPC-236 Summary: Added tests in terminal-spec for arrows handling unexpected exceptions on the left hand side

--- test/untangled_spec/reporters/terminal_spec.clj
+++ test/untangled_spec/reporters/terminal_spec.clj
@@ -19,7 +19,10 @@
           (behavior "basic"
             (is (= [5 3] (test-case '(5 => 3)))))
           (behavior "complex"
-            (is (= [5 3] (test-case '((+ 3 2) => (+ 2 1)))))))
+            (is (= [5 3] (test-case '((+ 3 2) => (+ 2 1))))))
+          (behavior "deals with unexpected exceptions"
+            (is (= ["clojure.lang.ExceptionInfo:  {}" 3]
+                   (test-case '((throw (ex-info "" {})) => 3))))))

         (component "=fn=>"
           (behavior "basic"
@@ -30,7 +33,10 @@
                               test-case second str))))
           (behavior "complex"
             (is (= [7 '(fn [x] (even? x))]
-                   (test-case '((+ 5 2) =fn=> (fn [x] (even? x))))))))
+                   (test-case '((+ 5 2) =fn=> (fn [x] (even? x)))))))
+          (behavior "deals with unexpected exceptions"
+            (is (= ["clojure.lang.ExceptionInfo:  {}" 'even?]
+                   (test-case '((throw (ex-info "" {})) =fn=> even?))))))

         (component "=throws=>"
           (behavior "simple"


improved dockstring

improved dockstring

--- moebius/src/moebius/core.clj
+++ moebius/src/moebius/core.clj
@@ -53,7 +53,20 @@

 (defn moebius-fn
   "Takes a normal clojure function and add the necessary metadata
-   to be used inside a pipeline"
+   to be used inside a pipeline.
+
+     - `name`: is the function name as in `defn`
+     - `type`: is one of: :enrichment, `:correlation`, `:filtering`
+          or `:pipeline`
+     - `statefulness`: whether the function is handling the state
+          as well or it is stateless. Should be one of the following
+          options: `:stateful` or `:stateless`
+     - `f`: is the function which either process a single event
+          or it process `state` and `event`
+     - `opts`: optional parameters are used to add more details
+          such as `moebius-fns` in the pipeline which contains
+          the list of function which have been packed together.
+  "
   [name type statefulness f & {:as opts}]
   (with-meta f
     (merge


Added Neo4j to docs

Added Neo4j to docs

--- src/webapp/client/views/docs_view.cljs
+++ src/webapp/client/views/docs_view.cljs
@@ -84,19 +84,6 @@

-        (el :div {:style "margin: 200px;" :id "ss1" :text "Some text1"})
-        (el :div {:style "margin: 200px;" :id "ss2" :text "Some text2"})
-        (el :div {:style "margin: 200px;" :id "ss3" :text "Some text3"})
-        (el :div {:style "margin: 200px;" :id "ss4" :text "Some text4"})
-        (el :div {:style "margin: 200px;" :id "ss5" :text "Some text5"})
-        (el :div {:style "margin: 200px;" :id "ss6" :text "Some text6"})
-        (el :div {:style "margin: 200px;" :id "ss7" :text "Some text7"})
-        (el :div {:style "margin: 200px;" :id "ss8" :text "Some text8"})
-        (el :div {:style "margin: 200px;" :id "ss9" :text "Some text9"})
-        (el :div {:style "margin: 200px;" :id "ss10" :text "Some text10"})
-        (el :div {:style "margin: 200px;" :id "ss11" :text "Some text11"})
-
-
       ]
   )
 )
@@ -108,13 +95,16 @@
         (header-text "Installing the development tools" )
         (body-html "
To install Clojure on Coils you need to install the following:

+
                    JDK SE 1.7

                    LightTable

                    Leiningen
-

+

                    GIT
+

+                   Neo4j

")


Allow kick to be configured outside of system

This allows oneshot builds to function where kick won't be present in
the prod integrant system, but does need production configuration.

--- edge.kick/src/edge/kick.clj
+++ edge.kick/src/edge/kick.clj
@@ -18,7 +18,9 @@

 (defn -main
   [& [target-arg]]
-  (let [kick-init-config (:edge.kick/builder (system/system-config {:profile :prod}))
+  (let [config (system/config {:profile :prod})
+        kick-init-config (get-in config [:edge.kick/config]
+                                 (get-in config [:ig/system :edge.kick/builder]))
         kick-config (assoc kick-init-config
                            :kick.builder/target
                            (or target-arg


Address PR feedback

Address PR feedback

--- src-cljs/frontend/components/project_settings.cljs
+++ src-cljs/frontend/components/project_settings.cljs
@@ -1681,50 +1681,49 @@
     om/IRenderState
     (render-state [_ {:keys [modal]}]
       (component
-       (html
-        [:div
-         (case modal
-           :basic (jira-basic-modal project owner)
-           :connect (jira-connect-modal project owner)
-           nil)
-         (when (config/jira-connect-enabled?)
-           [:p.intro "There are 2 options for setting up JIRA with CircleCI: Atlassian Connect or JIRA Basic Authentication. Choose one of the options below to continue."])
-         (letfn [(track-event [auth-type]
-                   ((om/get-shared owner :track-event)
-                    {:event-type :add-credentials-clicked
-                     :properties {:component "jira-integration"
-                                  :auth-type auth-type}}))]
-           (element
-            :column-group
-            (html
-             [:div
-              (when (config/jira-connect-enabled?)
+        (html
+         [:div
+          (case modal
+            :basic (jira-basic-modal project owner)
+            :connect (jira-connect-modal project owner)
+            nil)
+          (when (config/jira-connect-enabled?)
+            [:p.intro "There are 2 options for setting up JIRA with CircleCI: Atlassian Connect or JIRA Basic Authentication. Choose one of the options below to continue."])
+          (letfn [(track-event [auth-type]
+                    ((om/get-shared owner :track-event)
+                     {:event-type :add-credentials-clicked
+                      :properties {:component "jira-integration"
+                                   :auth-type auth-type}}))]
+            (element :column-group
+              (html
+               [:div
+                (when (config/jira-connect-enabled?)
+                  [:.column
+                   [:.title "Atlassian Connect for CircleCI"]
+                   [:p "If you are an Atlassian administrator you can get a token by following the instructions "
+                    [:a
+                     {:href "https://marketplace.atlassian.com/plugins/circleci.jira/cloud/overview"
+                      :target "_blank"}
+                     "here"]
+                    "."]
+                   (button/button {:kind :primary
+                                   :on-click (fn [_]
+                                               (om/set-state! owner :modal :connect)
+                                               (track-event "connect"))}
+                                  "Add Token")])
                 [:div.column
-                 [:.title "Atlassian Connect for CircleCI"]
-                 [:p "If you are an Atlassian administrator you can get a token by following the instructions "
-                  [:a
-                   {:href "https://marketplace.atlassian.com/plugins/circleci.jira/cloud/overview"
-                    :target "_blank"}
-                   "here"]
-                  "."]
+                 (when (config/jira-connect-enabled?)
+                   [:.title "JIRA Basic Authentication"])
+                 [:p (str
+                      (if (config/jira-connect-enabled?)
+                        "If you are not an Atlassian administrator you can s"
+                        "S")
+                      "tore your JIRA username, password, and JIRA base hostname to connect JIRA and CircleCI.")]
                  (button/button {:kind :primary
                                  :on-click (fn [_]
-                                             (om/set-state! owner :modal :connect)
-                                             (track-event "connect"))}
-                                "Add Token")])
-              [:div.column
-               (when (config/jira-connect-enabled?)
-                 [:.title "JIRA Basic Authentication"])
-               [:p (str
-                    (if (config/jira-connect-enabled?)
-                      "If you are not an Atlassian administrator you can s"
-                      "S")
-                    "tore your JIRA username, password, and JIRA base hostname to connect JIRA and CircleCI.")]
-               (button/button {:kind :primary
-                               :on-click (fn [_]
-                                           (om/set-state! owner :modal :basic)
-                                           (track-event "basic"))}
-                              "Add Credentials")]])))])))))
+                                             (om/set-state! owner :modal :basic)
+                                             (track-event "basic"))}
+                                "Add Credentials")]])))])))))

 (defmulti jira-installed
   "View to display when jira credentials are installed on the project."


Hide cancel button from people without permission

Hide the cancel build button from people without write-settings
permission for the build - this means viewing a public build page
without push access to the repo it belongs to.

(Also prevented on the backend.)

--- src-cljs/frontend/components/build_head.cljs
+++ src-cljs/frontend/components/build_head.cljs
@@ -664,7 +664,7 @@
                  {:title "Report error with build",
                   :on-click #(raise! owner [:report-build-clicked {:build-url (:build_url @build)}])}
                  "Report"])
-              (when (build-model/can-cancel? build)
+              (when (and (build-model/can-cancel? build) (has-scope :write-settings data))
                 (forms/managed-button
                  [:button.cancel_build
                   {:data-loading-text "Canceling",


Work around bug in window.opener (#470)

Work around bug in window.opener (#470)

--- src/cljs/org/broadinstitute/firecloud_ui/main.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/main.cljs
@@ -376,29 +376,33 @@
                                (swap! state assoc :config-status :error)))}))
    :authenticate-user
    (fn [{:keys [this state]}]
-     (if-let [parent (.-opener js/window)]
-       ;; This window was used for login. Send the token to the parent. No need to render the UI.
-       (do
-         ((aget parent sign-in/handler-fn-name) (parse-hash-into-map))
-         (.close js/window))
-       (if-let [token (get (parse-hash-into-map) "access_token")]
-         ;; New access token. Attempt to authenticate with it.
-         (react/call :authenticate-with-fresh-token this token)
-         (let [token (utils/get-access-token-cookie)]
-           (if token
-             (attempt-auth token (fn [{:keys [success? status-code]}]
-                                   (cond
-                                     (= 401 status-code) ; maybe bad cookie, not auth failure
-                                     (do (utils/delete-access-token-cookie)
+     ;; Note: window.opener can be non-nil even when it wasn't opened with window.open, so be
+     ;; careful with this check.
+     (let [opener (.-opener js/window)
+           sign-in-handler (and opener (aget opener sign-in/handler-fn-name))]
+       (if sign-in-handler
+         ;; This window was used for login. Send the token to the parent. No need to render the UI.
+         (do
+           (sign-in-handler (parse-hash-into-map))
+           (.close js/window))
+         (if-let [token (get (parse-hash-into-map) "access_token")]
+           ;; New access token. Attempt to authenticate with it.
+           (react/call :authenticate-with-fresh-token this token)
+           (let [token (utils/get-access-token-cookie)]
+             (if token
+               (attempt-auth token (fn [{:keys [success? status-code]}]
+                                     (cond
+                                       (= 401 status-code) ; maybe bad cookie, not auth failure
+                                       (do (utils/delete-access-token-cookie)
                                          (swap! state assoc :user-status :not-logged-in))
-                                     (= 403 status-code)
-                                     (swap! state assoc :user-status :not-activated)
-                                     ;; 404 just means not registered
-                                     (or success? (= status-code 404))
-                                     (react/call :handle-successful-auth this token)
-                                     :else
-                                     (swap! state assoc :user-status :error))))
-             (swap! state assoc :user-status :not-logged-in))))))
+                                       (= 403 status-code)
+                                       (swap! state assoc :user-status :not-activated)
+                                       ;; 404 just means not registered
+                                       (or success? (= status-code 404))
+                                       (react/call :handle-successful-auth this token)
+                                       :else
+                                       (swap! state assoc :user-status :error))))
+               (swap! state assoc :user-status :not-logged-in)))))))
    :authenticate-with-fresh-token
    (fn [{:keys [this state]} token]
      (attempt-auth token (fn [{:keys [success? status-code]}]


Fix background color for metronome buttons.

--- src/afterglow/controllers/ableton_push_2.clj
+++ src/afterglow/controllers/ableton_push_2.clj
@@ -584,13 +584,13 @@

 (defn draw-bottom-button-label
   "Draw a label for a button below the graphical display."
-  [controller index text color]
+  [controller index text color & {:keys [background-color] :or {background-color off-color}}]
   (let [graphics (create-graphics controller)
         font (get-display-font :roboto-medium Font/BOLD 14)
         context (.getFontRenderContext graphics)
         label (fit-string text font context (- button-cell-width button-cell-margin))
         width (string-width label font context)]
-    (set-graphics-color graphics off-color)
+    (set-graphics-color graphics background-color)
     (.fillRect graphics (* index button-cell-width) (- Wayang/DISPLAY_HEIGHT 15)
                button-cell-width 15)
     (set-graphics-color graphics color)
@@ -1008,9 +1008,9 @@
                           white-color)

                    ;; Add the labels for reset and sync, and light the pads
-                   (draw-bottom-button-label controller 0 "Reset" red-color)
+                   (draw-bottom-button-label controller 0 "Reset" red-color :background-color metronome-background)
                    (draw-bottom-button-label controller 1 (metronome-sync-label controller)
-                                             (metronome-sync-color controller))
+                                             (metronome-sync-color controller) :background-color metronome-background)
                    (swap! (:next-top-pads controller) assoc 0 dim-red-color)
                    (swap! (:next-top-pads controller) assoc 1 (dim (metronome-sync-color controller))))
                  (handle-control-change [this message]


#19 Hint on nodeService, fixed set-properties

--- lambdalf-lib/src/main/clojure/alfresco/nodes.clj
+++ lambdalf-lib/src/main/clojure/alfresco/nodes.clj
@@ -20,10 +20,11 @@
             [alfresco.auth :as a])
   (:import [org.alfresco.model ContentModel]
            [org.alfresco.service.cmr.repository ChildAssociationRef
+            NodeService
             StoreRef
             NodeRef]))

-(defn node-service
+(defn ^NodeService node-service
   []
   (.getNodeService (c/alfresco-services)))

@@ -70,9 +71,8 @@

   (aspect? [node aspect] (.hasAspect (node-service) node (m/qname aspect)))

-  (properties [node] (into {} (let [prop-map (.getProperties (node-service) node)]
-                             (zipmap (map m/qname-str (keys prop-map))
-                                     (vals prop-map)))))
+  (properties [node] (into {} (.getProperties (node-service) node)))
+
   (aspects [node] (into #{} (doall (map m/qname-str (.getAspects (node-service) node)))))

   (dir? [node] (= (m/qname :cm/folder) (.getType (node-service) node)))
@@ -130,16 +130,12 @@
    [node prop]
     (.getProperty (node-service) node (m/qname prop)))

-
-
   (set-properties!
    [node & prop-defs]
    {:pre [(or (nil? prop-defs) (even? (count prop-defs)))]}
-   (let [current-props (properties node)
-         prop-map (merge current-props (defs2map prop-defs))
-         qnamed-map (zipmap (map m/qname (keys prop-map))
+    (let [prop-map (defs2map prop-defs)
+          qnamed-map (zipmap (map m/qname (keys prop-map))
                             (vals prop-map))]
-
      (.setProperties (node-service) node qnamed-map)))

   (type-qname


Fixes based on pull request feedback

Fixes based on pull request feedback

--- src/com/puppetlabs/puppetdb/query/event_counts.clj
+++ src/com/puppetlabs/puppetdb/query/event_counts.clj
@@ -114,7 +114,7 @@
     (format "SELECT * FROM (%s) count_results WHERE %s" sql where)
     sql))

-(defn- create-subject-map
+(defn- munge-subject
   "Helper function to transform the event count subject data from the raw format that we get back from the
   database into the more structured format that the API specifies."
   [summarize-by result]
@@ -124,10 +124,10 @@
            (contains? result :certname)
            (every? #(contains? result %) [:resource_type :resource_title])
            (contains? result :containing_class))]
-   :pose [(map? %)
+   :post [(map? %)
           (not (contains-some % [:certname :resource_type :resource_title :containing_class]))
           (map? (:subject %))
-          (contains? #{"node" "resource" "containing-class"} (:subject-type %))]}
+          (= summarize-by (:subject-type %))]}
   (condp = summarize-by
     "node"              (-> result
                           (assoc :subject-type "node")
@@ -144,13 +144,13 @@
                           (assoc :subject {:title (:containing_class result)})
                           (dissoc :containing_class))))

-(defn- create-subject-maps
+(defn- munge-subjects
   "Helper function to transform the event count subject data from the raw format that we get back from the
   database into the more structured format that the API specifies."
   [summarize-by results]
   {:pre [(vector? results)]
    :post [(vector? %)]}
-  (mapv (partial create-subject-map summarize-by) results))
+  (mapv (partial munge-subject summarize-by) results))

 (defn query->sql
   "Convert an event-counts `query` and a value to `summarize-by` into a SQL string.
@@ -185,4 +185,4 @@
     (update-in
       (execute-query (apply vector sql params) paging-options)
       [:result]
-      (partial create-subject-maps summarize-by))))
+      (partial munge-subjects summarize-by))))


More passing tests.

More passing tests.


changing npm deps did not properly trigger reloads in watch

--- src/main/shadow/cljs/devtools/server/reload_npm.clj
+++ src/main/shadow/cljs/devtools/server/reload_npm.clj
@@ -6,7 +6,8 @@
             [shadow.build.npm :as npm]
             [shadow.cljs.devtools.server.system-bus :as sys-bus]
             [shadow.cljs.model :as m]
-            [shadow.cljs.util :as util]))
+            [shadow.cljs.util :as util]
+            [clojure.set :as set]))

 (defn dissoc-all [m files]
   (reduce dissoc m files))
@@ -44,9 +45,12 @@
       (swap! index-ref invalidate-files modified-files)

       (let [modified-provides
-            (into #{} (map :provides) modified-resources)]
+            (->> modified-resources
+                 (map :provides)
+                 (reduce set/union #{}))]

-        (sys-bus/publish! system-bus ::m/resource-update {:provides modified-provides})
+        (sys-bus/publish! system-bus ::m/resource-update {:added #{}
+                                                          :namespaces modified-provides})
         ))))

 (defn watch-loop [system-bus npm control-chan]


forced to add a docstring, again.  :unamused:

--- src/metabase/driver/generic_sql/query_processor.clj
+++ src/metabase/driver/generic_sql/query_processor.clj
@@ -167,7 +167,10 @@
              :=           ['=    (formatted value)]
              :!=          ['not= (formatted value)])}))

-(defn filter-clause->predicate [{:keys [compound-type subclause subclauses], :as clause}]
+(defn filter-clause->predicate
+  "Given a filter CLAUSE, return a Korma filter predicate form for use in korma `where`.  If this is a compound
+   clause then we call `filter-subclause->predicate` on all of the subclauses."
+  [{:keys [compound-type subclause subclauses], :as clause}]
   (case compound-type
     :and (apply kfns/pred-and (map filter-clause->predicate subclauses))
     :or  (apply kfns/pred-or  (map filter-clause->predicate subclauses))


Janus perf run

Janus perf run

--- perf-test/clj/reitit/opensensors_perf_test.clj
+++ perf-test/clj/reitit/opensensors_perf_test.clj
@@ -711,6 +711,7 @@
     ;; 19688ns
     (b! "ataraxy" ataraxy-f)

+    ;; 7550ns
     (b! "janus" janus-f)))

 (comment


Added License header.

Added License header.

--- src/clj/backtype/storm/daemon/supervisor.clj
+++ src/clj/backtype/storm/daemon/supervisor.clj
@@ -1,3 +1,7 @@
+;; Copyright (c) 2013 Yahoo! Inc. All Rights Reserved.
+;; Copyrights licensed under the Eclipse Public License.
+;; See the accompanying LICENSE.html file for terms.
+
 (ns backtype.storm.daemon.supervisor
   (:import [backtype.storm.scheduler ISupervisor])
   (:use [backtype.storm bootstrap])


find partioned table name

find partioned table name

--- src/clj_money/models/storage/sql_storage.clj
+++ src/clj_money/models/storage/sql_storage.clj
@@ -779,7 +779,7 @@

   (update-transaction-item-index-and-balance
     [_ transaction-item]
-    (let [sql (sql/format (-> (h/update :transaction_items)
+    (let [sql (sql/format (-> (h/update (table-name (:transaction-date transaction-item) :transaction_items))
                                 (h/sset (->update-set transaction-item
                                                       :index
                                                       :balance))


Refactor.  No longer crashes.

Refactor.  No longer crashes.

--- src/clojure/com/dankee/camera_spike/main.clj
+++ src/clojure/com/dankee/camera_spike/main.clj
@@ -8,19 +8,18 @@
 (def capture-image-activity-request-code 100)

 (defactivity com.dankee.camera_spike.MainActivity
-  :def a

   :on-create
-  (fn [this bundle]
+  (fn [activity bundle]
     (let [intent (android.content.Intent. MediaStore/ACTION_IMAGE_CAPTURE)]
       (doto intent
         (.putExtra MediaStore/EXTRA_OUTPUT (get-output-image-uri)) )
-      (.startActivityForResult a intent capture-image-activity-request-code)) )
+      (.startActivityForResult activity intent capture-image-activity-request-code)) )

   :on-activity-result
-  (fn [request-code result-code intent]
+  (fn [activity request-code result-code intent]
     (on-ui
-     (set-content-view! a
+     (set-content-view! activity
        (make-ui [:linear-layout {}
                  [:text-view {:text "Hello from Clojure!"}] ] ) ) ) ) )


Remove unused test directory.

Remove unused test directory.

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


NE | 227 | Fixing feed controller test for retrieve-activities response

--- test/mooncake/test/controller/feed.clj
+++ test/mooncake/test/controller/feed.clj
@@ -13,6 +13,7 @@
 (def ten-oclock "2015-01-01T10:00:00.000Z")
 (def eleven-oclock "2015-01-01T11:00:00.000Z")
 (def twelve-oclock "2015-01-01T12:00:00.000Z")
+(def next-day "2015-01-02T12:00:00.000Z")

 (fact "feed handler displays activities retrieved from activity sources"
       (let [store (dbh/create-in-memory-store)]
@@ -183,8 +184,9 @@
              request {:context {:activity-sources {:activity-src-1 {:activity-types ["Enabled" "Disabled"]}
                                                    :activity-src-2 {:activity-types ["No-preference"]}}}
                       :t       (constantly "")
-                      :session {:username ...username...}}
-             response (fc/feed store request)]
+                      :session {:username ...username...}
+                      :params {:timestamp next-day}}
+             response (fc/retrieve-activities store request)]

          (fact "enabled activity types are shown"
                (:body response) => (contains "Activity source 1: enabled type"))


Une première solution à l'exercice "isbn verifier" de Exercism dans la track Clojure

--- exercism/clojure/isbn-verifier/src/isbn_verifier.clj
+++ exercism/clojure/isbn-verifier/src/isbn_verifier.clj
@@ -1,5 +1,50 @@
 (ns isbn-verifier)

-(defn isbn? [isbn] ;; <- arglist goes here
-  ;; your code goes here
-)
+(defn filter-dashes
+  "Remove the dashes from a ISBN"
+  [isbn]
+  (filter #(or (Character/isDigit %) (= \X %)) isbn))
+
+(defn transform-char-as-digit
+  "Transform a char that is a digit or that is the character 'X' in the corresponding number. X is translate as 10"
+  [digit-as-char-or-x]
+  (cond
+    (Character/isDigit digit-as-char-or-x) (Character/digit digit-as-char-or-x 10)
+    (= \X digit-as-char-or-x) 10))
+
+(defn indexed-from
+  "Taken a first index value and a sequence return a sequence of vector [index value].
+   For example (indexed-form 1 [a b c]) returns [[1 a] [2 b] [3 c]]"
+  [from sequence]
+  (map vector (iterate inc from) sequence))
+
+(defn multiply-by-index-and-add
+  "Taken acc as an integer value and current-element as a 2 elements vector of integer.
+   the acc value is added to the result of multiplying the 2 elements of the vector"
+  [acc current-element]
+  (+ acc (* (nth current-element 1) (nth current-element 0))))
+
+(defn compute-isbn-numeric-value-from-formula
+  "Compute the value of a well-formed isbn"
+  [isbn]
+  (->> isbn
+       (filter-dashes)
+       (map transform-char-as-digit)
+       (reverse)
+       (indexed-from 1)
+       (reduce multiply-by-index-and-add 0)))
+
+(defn isbn-well-formed?
+  "check whether an isbn is well-formed. The isbn can be well-formed but invalid"
+  [isbn]
+  (not (nil? (re-matches #"\d\-?\d{3}\-?\d{5}\-?(\d|X)" isbn))))
+
+(defn isbn-valid?
+  "check whether a well-formed isbn is valid"
+  [isbn]
+  (= 0 (mod  (compute-isbn-numeric-value-from-formula isbn) 11)))
+
+(defn isbn?
+  "check whether the provided string is a correct isbn"
+  [isbn]
+  (and (isbn-well-formed? isbn) (isbn-valid? isbn)))


Remove most uses of `are`.

Remove most uses of `are`.

--- test/provisdom/spectomic/core_test.clj
+++ test/provisdom/spectomic/core_test.clj
@@ -75,66 +75,68 @@
          (spectomic/find-type-via-generation ::map nil))))

 (deftest datomic-schema-test
-  (are [schema specs] (= schema (spectomic/datomic-schema specs))
-    ;; basic Datomic types
-    [{:db/ident       ::string
-      :db/valueType   :db.type/string
-      :db/cardinality :db.cardinality/one}
-     {:db/ident       ::int
-      :db/valueType   :db.type/long
-      :db/cardinality :db.cardinality/one}
-     {:db/ident       ::inst
-      :db/valueType   :db.type/instant
-      :db/cardinality :db.cardinality/one}
-     {:db/ident       ::double
-      :db/valueType   :db.type/double
-      :db/cardinality :db.cardinality/one}
-     {:db/ident       ::float
-      :db/valueType   :db.type/float
-      :db/cardinality :db.cardinality/one}
-     {:db/ident       ::uuid
-      :db/valueType   :db.type/uuid
-      :db/cardinality :db.cardinality/one}
-     {:db/ident       ::bigdec
-      :db/valueType   :db.type/bigdec
-      :db/cardinality :db.cardinality/one}
-     {:db/ident       ::bigint
-      :db/valueType   :db.type/bigint
-      :db/cardinality :db.cardinality/one}
-     {:db/ident       ::uri
-      :db/valueType   :db.type/uri
-      :db/cardinality :db.cardinality/one}
-     {:db/ident       ::keyword
-      :db/valueType   :db.type/keyword
-      :db/cardinality :db.cardinality/one}
-     {:db/ident       ::bytes
-      :db/valueType   :db.type/bytes
-      :db/cardinality :db.cardinality/one}]
-    [::string ::int ::inst ::double ::float ::uuid
-     ::bigdec ::bigint ::uri ::keyword ::bytes]
-    ;; :db.type/ref
-    [{:db/ident       ::map
-      :db/valueType   :db.type/ref
-      :db/cardinality :db.cardinality/one}
-     {:db/ident       ::nilable-map
-      :db/valueType   :db.type/ref
-      :db/cardinality :db.cardinality/one}]
-    [::map ::nilable-map]
-    ;; :db.cardinality/many
-    [{:db/ident       ::int-coll
-      :db/valueType   :db.type/long
-      :db/cardinality :db.cardinality/many}
-     {:db/ident       ::nilable-int-coll
-      :db/valueType   :db.type/long
-      :db/cardinality :db.cardinality/many}]
-    [::int-coll ::nilable-int-coll]
-    ;; extra schema attrs
-    [{:db/ident       ::int
-      :db/valueType   :db.type/long
-      :db/cardinality :db.cardinality/one
-      :db/index       true
-      :db/unique      :db.unique/identity}]
-    [[::int {:db/index true :db/unique :db.unique/identity}]])
+  (testing "basic datomic types"
+    (is (= [{:db/ident       ::string
+            :db/valueType   :db.type/string
+            :db/cardinality :db.cardinality/one}
+           {:db/ident       ::int
+            :db/valueType   :db.type/long
+            :db/cardinality :db.cardinality/one}
+           {:db/ident       ::inst
+            :db/valueType   :db.type/instant
+            :db/cardinality :db.cardinality/one}
+           {:db/ident       ::double
+            :db/valueType   :db.type/double
+            :db/cardinality :db.cardinality/one}
+           {:db/ident       ::float
+            :db/valueType   :db.type/float
+            :db/cardinality :db.cardinality/one}
+           {:db/ident       ::uuid
+            :db/valueType   :db.type/uuid
+            :db/cardinality :db.cardinality/one}
+           {:db/ident       ::bigdec
+            :db/valueType   :db.type/bigdec
+            :db/cardinality :db.cardinality/one}
+           {:db/ident       ::bigint
+            :db/valueType   :db.type/bigint
+            :db/cardinality :db.cardinality/one}
+           {:db/ident       ::uri
+            :db/valueType   :db.type/uri
+            :db/cardinality :db.cardinality/one}
+           {:db/ident       ::keyword
+            :db/valueType   :db.type/keyword
+            :db/cardinality :db.cardinality/one}
+           {:db/ident       ::bytes
+            :db/valueType   :db.type/bytes
+            :db/cardinality :db.cardinality/one}]
+          (spectomic/datomic-schema [::string ::int ::inst ::double ::float ::uuid
+                                     ::bigdec ::bigint ::uri ::keyword ::bytes]))))
+  (testing ":db.type/ref"
+    (is (= [{:db/ident       ::map
+             :db/valueType   :db.type/ref
+             :db/cardinality :db.cardinality/one}
+            {:db/ident       ::nilable-map
+             :db/valueType   :db.type/ref
+             :db/cardinality :db.cardinality/one}]
+           (spectomic/datomic-schema [::map ::nilable-map]))))
+
+  (testing ":db.cardinality/many"
+    (is (= [{:db/ident       ::int-coll
+             :db/valueType   :db.type/long
+             :db/cardinality :db.cardinality/many}
+            {:db/ident       ::nilable-int-coll
+             :db/valueType   :db.type/long
+             :db/cardinality :db.cardinality/many}]
+           (spectomic/datomic-schema [::int-coll ::nilable-int-coll]))))
+
+  (testing "extra schema attrs"
+    (is (= [{:db/ident       ::int
+             :db/valueType   :db.type/long
+             :db/cardinality :db.cardinality/one
+             :db/index       true
+             :db/unique      :db.unique/identity}]
+           (spectomic/datomic-schema [[::int {:db/index true :db/unique :db.unique/identity}]]))))
+
   (are [spec] (thrown? clojure.lang.ExceptionInfo (spectomic/datomic-schema [spec]))
     ::nil ::or ::or-coll ::coll-of-coll ::myobject))

@@ -165,11 +167,11 @@
              :db/isComponent true}]]))

 (deftest datomic-schema-valueType-test
-  (are [schema specs] (= schema (spectomic/datomic-schema specs))
-    [{:db/ident       ::string
-      :db/valueType   :db.type/keyword
-      :db/cardinality :db.cardinality/one}]
-    [[::string {:db/valueType :db.type/keyword :db/cardinality :db.cardinality/one}]]))
+  (is (= [{:db/ident       ::string
+           :db/valueType   :db.type/keyword
+           :db/cardinality :db.cardinality/one}]
+         (spectomic/datomic-schema
+           [[::string {:db/valueType :db.type/keyword :db/cardinality :db.cardinality/one}]]))))

 (def test-schema-specs
   [::string ::int ::inst ::double ::float ::uuid


Formatting

Formatting

--- test/clojure/clojurewerkz/cassaforte/batch_test.clj
+++ test/clojure/clojurewerkz/cassaforte/batch_test.clj
@@ -5,11 +5,14 @@
             [clojurewerkz.cassaforte.policies :as cp]
             [clojurewerkz.cassaforte.cql :as cql :refer :all]
             [clojurewerkz.cassaforte.uuids :as uuids]
+            [clojurewerkz.cassaforte.query :refer :all]
+
             [clojure.test :refer :all]
-            [clojurewerkz.cassaforte.query :refer :all]
+
             [qbits.hayt.dsl.statement :as hs]
             [qbits.hayt.dsl.clause :as hc]
             [qbits.hayt.fns :as fns]
+
             [clj-time.core :refer [seconds ago before? date-time] :as tc]
             [clj-time.format :as tf]
             [clj-time.coerce :as cc]))


Delete default test

Delete default test

--- test/beehive_http/core_test.clj
+++ test/beehive_http/core_test.clj
@@ -2,6 +2,3 @@
   (:require [clojure.test :refer :all]
             [beehive-http.core :refer :all]))

-(deftest a-test
-  (testing "FIXME, I fail."
-    (is (= 0 1))))


Fix some reflection in tests

Fix some reflection in tests

--- test/caesium/byte_bufs_test.clj
+++ test/caesium/byte_bufs_test.clj
@@ -25,7 +25,7 @@
    (is (instance? ByteBuffer buf))
    (when-not (instance? ByteBuffer src)
      ;; when the input is a byte buffer, don't convert
-     (is (not (.isDirect buf))))))
+     (is (not (.isDirect ^ByteBuffer buf))))))

 (defspec ->direct-byte-buf-spec
   1000
@@ -38,7 +38,7 @@
    (is (instance? ByteBuffer buf))
    (when-not (instance? ByteBuffer src)
      ;; when the input is a byte buffer, don't convert
-     (is (.isDirect buf)))))
+     (is (.isDirect ^ByteBuffer buf)))))

 (defspec buflen-spec
   1000


Refactored test

Refactored test

--- test/puppetlabs/certificate_authority/core_test.clj
+++ test/puppetlabs/certificate_authority/core_test.clj
@@ -404,24 +404,24 @@
       (is (true? (issued-by? crl (generate-x500-name "issuer"))))
       (is (false? (issued-by? crl "issuer"))))))

-(let [cert-with-exts (-> "certs/cert-with-exts.pem"
-                         open-ssl-file
-                         pem->cert)]
-  (deftest extensions-returned
-    (testing "Found all extensions"
-      (let [extensions (get-extensions cert-with-exts)]
-        (is (= 10 (count extensions)))
-        (doseq [oid ["2.5.29.15" "2.5.29.19" "2.5.29.37"
-                     "2.5.29.14" "2.5.29.35"]]
-          (is (get extensions oid)))
-        (doseq [[oid value] [["1.3.6.1.4.1.34380.1.1.1"
-                              "ED803750-E3C7-44F5-BB08-41A04433FE2E"]
-                             ["1.3.6.1.4.1.34380.1.1.2"
-                              "1234567890"]
-                             ["1.3.6.1.4.1.34380.1.1.3"
-                              "my_ami_image"]
-                             ["1.3.6.1.4.1.34380.1.1.4"
-                              "342thbjkt82094y0uthhor289jnqthpc2290"]
-                             ["2.16.840.1.113730.1.13"
-                              "Puppet Ruby/OpenSSL Internal Certificate"]]]
-          (is (= (get extensions oid) value)))))))+
+(deftest extensions-returned
+  (testing "Found all extensions"
+    (let [extensions (get-extensions (-> "certs/cert-with-exts.pem"
+                                         open-ssl-file
+                                         pem->cert))]
+      (is (= 10 (count extensions)))
+      (doseq [oid ["2.5.29.15" "2.5.29.19" "2.5.29.37"
+                   "2.5.29.14" "2.5.29.35"]]
+        (is (get extensions oid)))
+      (doseq [[oid value] [["1.3.6.1.4.1.34380.1.1.1"
+                            "ED803750-E3C7-44F5-BB08-41A04433FE2E"]
+                           ["1.3.6.1.4.1.34380.1.1.2"
+                            "1234567890"]
+                           ["1.3.6.1.4.1.34380.1.1.3"
+                            "my_ami_image"]
+                           ["1.3.6.1.4.1.34380.1.1.4"
+                            "342thbjkt82094y0uthhor289jnqthpc2290"]
+                           ["2.16.840.1.113730.1.13"
+                            "Puppet Ruby/OpenSSL Internal Certificate"]]]
+        (is (= (get extensions oid) value))))))


Idiomatically ignore argument

Idiomatically ignore argument

--- test/cljs/fatlip/core_test.cljs
+++ test/cljs/fatlip/core_test.cljs
@@ -40,8 +40,8 @@
     (is (= (count (:p graph)) 2) "Number of p nodes")
     (is (= (count (:q graph)) 2) "Number of q nodes")
     (is (= (count (:r graph)) 2) "Number of r nodes")
-    (is (= (count (mapcat (fn [[n es]] es) (:succs graph)))
-           (count (mapcat (fn [[n es]] es) (:preds graph)))
+    (is (= (count (mapcat (fn [[_ es]] es) (:succs graph)))
+           (count (mapcat (fn [[_ es]] es) (:preds graph)))
            14)
         "Number of edges")
   ))


More idiomatic testing

More idiomatic testing

--- test/cljs/fatlip/core_test.cljs
+++ test/cljs/fatlip/core_test.cljs
@@ -44,8 +44,8 @@
     (is (= (count (:ps graph)) 2) "Number of p nodes")
     (is (= (count (:qs graph)) 2) "Number of q nodes")
     (is (= (count (:rs graph)) 2) "Number of r nodes")
-    (is (= (count (mapcat (fn [[_ es]] es) (:succs graph)))
-           (count (mapcat (fn [[_ es]] es) (:preds graph)))
+    (is (= (reduce + (map count (vals (:succs graph))))
+           (reduce + (map count (vals (:preds graph))))
            14)
         "Number of edges")


Print correct metadata in console reporter

--- src/main/clojure/lazytest/report/console.clj
+++ src/main/clojure/lazytest/report/console.clj
@@ -17,7 +17,7 @@
   (p [this]
      (println "\nFAIL")
      (print "Metadata: ")
-     (pprint (meta this))
+     (pprint (meta (:source this)))
      (print "Reason: ")
      (p (:reason this)))

@@ -25,7 +25,7 @@
   (p [this]
      (println "\nERROR")
      (print "Metadata: ")
-     (pprint (meta this))
+     (pprint (meta (:source this)))
      (print-cause-trace (:throwable this)))

   lazytest.result.Pending


Turn check-existence-on-delete back on by default

--- src/main/clojure/pdok/featured/processor.clj
+++ src/main/clojure/pdok/featured/processor.clj
@@ -438,7 +438,7 @@
          batch-size (or (config/env :processor-batch-size) 10000)]
      (merge {:dataset dataset
              :check-validity-on-delete true
-             :check-existence-on-delete false
+             :check-existence-on-delete true
              :disable-validation false
              :persistence initialized-persistence
              :projectors initialized-projectors


remove 3d library

remove 3d library

--- src/webapp/framework/client/views/debugger-3d.cljs
+++ src/webapp/framework/client/views/debugger-3d.cljs
@@ -1,65 +0,0 @@
-(ns webapp.framework.client.debugger-3d
-    (:refer-clojure :exclude [val empty remove find next parents])
-    (:require
-        [cljs.reader :as reader]
-        [crate.core :as crate]
-        [cljs.core.async :as async :refer [chan close!]]
-        ;[google.maps]
-        ;[google.maps.MapTypeId]
-    )
-
-  (:require-macros
-    [cljs.core.async.macros :refer [go alt!]])
-
-  (:use
-        [webapp.framework.client.coreclient :only [width height popup do-before-remove-element new-dom-id
-                                                   find-el clj-to-js sql-fn
-                                                   header-text body-text body-html make-sidebar
-                                                   swap-section  el clear remote add-to]]
-        [jayq.core                          :only [attr $ css append fade-out fade-in empty]]
-        [webapp.framework.client.help       :only [help]]
-        [webapp.framework.client.eventbus   :only [do-action esb undefine-action]]
-    )
-    (:use-macros
-        [webapp.framework.client.eventbus :only [define-action redefine-action]]
-        [webapp.framework.client.coreclient :only [ns-coils]]
-     )
-)
-(ns-coils 'webapp.framework.client.debugger-3d)
-
-
-
-(defn show-3d []
-  (clear "main-section")
-  (let [scene        (js/THREE.Scene.)
-        width        (width "main-section")
-        height       (height "main-section")
-        camera       (js/THREE.PerspectiveCamera. 75 (/ width height) 0.1 1000 )
-        renderer (js/THREE.CanvasRenderer.)
-        geometry (js/THREE.CubeGeometry. 1 1 1)
-        material (js/THREE.MeshBasicMaterial. (clj->js {:color 0x00ff00}))
-        cube (js/THREE.Mesh. geometry material)
-        render (fn cb []
-                   (js/requestAnimationFrame cb)
-                   (set! (.-x (.-rotation cube))  (+ 0.1 (.-x (.-rotation cube))) )
-                   (set! (.-y (.-rotation cube))  (+ 0.1 (.-y (.-rotation cube))) )
-                   (.render renderer scene camera)
-                 )
-        ]
-    (.setSize renderer width height)
-    (add-to "main-section" (.-domElement renderer) )
-    (.add scene cube)
-    (set! (.-z (.-position camera))  5)
-    (render)
-    )
-
-)
-
-
-;(-> ($ (find-el "main-section") ) (. height))
-
-;(show-3d)
-
-(redefine-action "show 3d debugger"
-  (show-3d)
-)


temporarily remove buf-wr checking - needs to be more lenient.

--- src/overtone/sc/machinery/ugen/metadata/buf_io.clj
+++ src/overtone/sc/machinery/ugen/metadata/buf_io.clj
@@ -61,7 +61,7 @@
               {:name "bufnum", :default 0 :doc "the index of the buffer to use"}
               {:name "phase", :default 0.0 :doc "modulatable index into the buffer (has to be audio rate)."}
               {:name "loop", :default 1.0 :doc "1 means true, 0 means false.  This is modulatable"}]
-       :check (when-ar (nth-input-ar 1))
+;;       :check (when-ar (nth-input-ar 1))
        :doc "writes to a buffer at a given index. Note, buf-wr (in difference to buf-rd) does not do multichannel expansion, because input is an array."}

       {:name "RecordBuf",


Removed obsolete comment.

Removed obsolete comment.

--- umm-spec-lib/test/cmr/umm_spec/test/generate_and_parse.clj
+++ umm-spec-lib/test/cmr/umm_spec/test/generate_and_parse.clj
@@ -24,7 +24,6 @@
   "Seq of formats to use in round-trip conversion and XML validation tests."
   [:dif :dif10 :echo10 :iso19115 :iso-smap])

-;; TODO add formats here as they are implemented.
 (def collection-destination-formats
   "Converting to these formats is tested in the roundrobin test."
   [:echo10 :dif10 :dif :iso19115 :iso-smap])


Remove state monad from labs.

Remove state monad from labs.

--- src/cats/labs/state.cljc
+++ src/cats/labs/state.cljc
@@ -1,254 +0,0 @@
-;; Copyright (c) 2014-2015 Andrey Antukh <niwi@niwi.nz>
-;; Copyright (c) 2014-2015 Alejandro Gómez <alejandro@dialelo.com>
-;; All rights reserved.
-;;
-;; Redistribution and use in source and binary forms, with or without
-;; modification, are permitted provided that the following conditions
-;; are met:
-;;
-;; 1. Redistributions of source code must retain the above copyright
-;;    notice, this list of conditions and the following disclaimer.
-;; 2. Redistributions in binary form must reproduce the above copyright
-;;    notice, this list of conditions and the following disclaimer in the
-;;    documentation and/or other materials provided with the distribution.
-;;
-;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-;; OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-;; IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-;; INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-;; NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-;; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-;; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-;; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-;; THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-(ns cats.labs.state
-  "The State Monad."
-  #?(:cljs (:require [cats.protocols :as p]
-                     [cats.context :as ctx :include-macros true]
-                     [cats.data :as d]
-                     [cats.util :as util])
-     :clj  (:require [cats.protocols :as p]
-                     [cats.context :as ctx]
-                     [cats.data :as d]
-                     [cats.util :as util])))
-
-(declare context)
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Protocol declaration
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(defprotocol MonadState
-  "A specific case of Monad abstraction for
-  work with state in pure functional way."
-  (-get-state [m] "Return the current state.")
-  (-put-state [m newstate] "Update the state.")
-  (-swap-state [m f] "Apply a function to the current state and update it."))
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Type constructors and functions
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(deftype State [mfn]
-  p/Contextual
-  (-get-context [_] context)
-
-  #?@(:cljs [cljs.core/IFn
-             (-invoke [self seed]
-               (mfn seed))]
-      :clj  [clojure.lang.IFn
-             (invoke [self seed]
-               (mfn seed))]))
-
-(alter-meta! #'->State assoc :private true)
-
-(defn state
-  "The State type constructor.
-
-  The purpose of State type is wrap a simple
-  function that fullfill the state signature.
-
-  It exists just for avoid extend the clojure
-  function type because is very generic type."
-  [f]
-  (State. f))
-
-(defn state?
-  "Return true if `s` is instance of
-  the State type."
-  [s]
-  (instance? State s))
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Monad definition
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(def ^{:no-doc true}
-  context
-  (reify
-    p/Context
-    (-get-level [_] ctx/+level-default+)
-
-    p/Functor
-    (-fmap [_ f fv]
-      (state (fn [s]
-                 (let [[v ns]  (fv s)]
-                   (d/pair (f v) ns)))))
-
-    p/Monad
-    (-mreturn [_ v]
-      (state (partial d/pair v)))
-
-    (-mbind [_ self f]
-      (state (fn [s]
-                 (let [p        (self s)
-                       value    (.-fst p)
-                       newstate (.-snd p)]
-                   ((f value) newstate)))))
-
-    MonadState
-    (-get-state [_]
-      (state #(d/pair %1 %1)))
-
-    (-put-state [_ newstate]
-      (state #(d/pair % newstate)))
-
-    (-swap-state [_ f]
-      (state #(d/pair %1 (f %1))))
-
-    p/Printable
-    (-repr [_]
-      #"<State>")))
-
-(util/make-printable (type context))
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Monad Transformer
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(defn state-t
-  "The State transformer constructor."
-  [inner-monad]
-  (reify
-    p/Context
-    (-get-level [_] ctx/+level-transformer+)
-
-    p/Functor
-    (-fmap [_ f fv]
-      (state (fn [s]
-                 (let [wr (fv s)]
-                   (p/-fmap inner-monad
-                            (fn [[v ns]]
-                              (d/pair (f v) ns))
-                            wr)))))
-
-    p/Monad
-    (-mreturn [_ v]
-      (state (fn [s]
-                 (p/-mreturn inner-monad
-                             (d/pair v s)))))
-
-    (-mbind [_ self f]
-      (state (fn [s]
-                 (let [mp (self s)]
-                   (p/-mbind inner-monad
-                             mp
-                             (fn [[v ns]]
-                               ((f v) ns)))))))
-    p/MonadZero
-    (-mzero [_]
-      (state (fn [s]
-                 (p/-mzero inner-monad))))
-
-    p/MonadPlus
-    (-mplus [_ mv mv']
-      (state (fn [s]
-                 (p/-mplus inner-monad (mv s) (mv' s)))))
-
-    MonadState
-    (-get-state [_]
-      (state (fn [s]
-                 (p/-mreturn inner-monad
-                             (d/pair s s)))))
-
-    (-put-state [_ newstate]
-      (state (fn [s]
-                 (p/-mreturn inner-monad
-                             (d/pair s newstate)))))
-
-    (-swap-state [_ f]
-      (state (fn [s]
-                 (p/-mreturn inner-monad
-                             (d/pair s (f s))))))
-
-    p/MonadTrans
-    (-lift [_ mv]
-      (state (fn [s]
-                 (p/-mbind inner-monad
-                           mv
-                           (fn [v]
-                             (p/-mreturn inner-monad
-                                         (d/pair v s)))))))
-
-    p/Printable
-    (-repr [_]
-      "#<State-T>")))
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Public Api
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(defn get-state
-  "Return a State instance with computation that returns
-  the current state."
-  []
-  (-get-state (ctx/get-current context)))
-
-(defn put-state
-  "Return a State instance with computation that replaces
-  the current state with specified new state."
-  [newstate]
-  (-put-state (ctx/get-current context) newstate))
-
-(defn swap-state
-  "Return a State instance with computation that applies the
-  specified function to state and returns the old state."
-  [f]
-  (-swap-state (ctx/get-current context) f))
-
-(defn run-state
-  "Given a State instance, execute the
-  wrapped computation and returns a cats.data.Pair
-  instance with result and new state.
-
-    (def computation (mlet [x (get-state)
-                            y (put-state (inc x))]
-                       (return y)))
-
-    (def initial-state 1)
-    (run-state computation initial-state)
-
-  This should be return something to: #<Pair [1 2]>"
-  [state seed]
-  (ctx/with-context context
-    (state seed)))
-
-(defn eval-state
-  "Given a State instance, execute the
-  wrapped computation and return the resultant
-  value, ignoring the state.
-  Equivalent to taking the first value of the pair instance
-  returned by `run-state` function."
-  [state seed]
-  (first (run-state state seed)))
-
-(defn exec-state
-  "Given a State instance, execute the
-  wrapped computation and return the resultant
-  state.
-  Equivalent to taking the second value of the pair instance
-  returned by `run-state` function."
-  [state seed]
-  (second (run-state state seed)))


using reload handler

using reload handler

--- src/celestial/launch.clj
+++ src/celestial/launch.clj
@@ -58,6 +58,7 @@
     (info "generating a default keystore")
     (generate (cert-conf :keystore) (cert-conf :password))))

+
 (defn -main [& args]
   (setup-logging)
   (p/reset-admin)
@@ -66,9 +67,16 @@
   (info "version 0.0.1 see http://celestial-ops.com")
   (jobs/initialize-workers)
   (default-key)
-  (run-jetty (app true)
-             {:port (get* :celestial :port) :join? true
+  (run-jetty (app true)
+             {:port (get* :celestial :port) :join? false
               :ssl? true :keystore (cert-conf :keystore)
               :key-password  (cert-conf :password)
               :ssl-port (get* :celestial :https-port)}))

+
+(comment
+  (def jetty (-main))
+  (.stop jetty)
+  (.start jetty)
+  (ring.adapter.jetty/reload-handler jetty (app true))
+  )


Added way to list the public members of a namespace

--- src/clj/cljdocs/core.clj
+++ src/clj/cljdocs/core.clj
@@ -14,8 +14,14 @@
         json (assoc info :ns (str (:ns info)))]
     json))

+(defn list-ns [namespace]
+  (let [sym (symbol namespace)]
+    (keys (ns-publics sym))))
+
 (defroutes app-routes
   ;(GET "/" [] "
Hello from compojure
")
+  (GET "/clojure_core/:namespace" [namespace]
+       (response/response (list-ns namespace)))
   (GET "/clojure_core/clojure.core/:function" [function]
        (response/response (lookup-fn function)))
   (route/resources "/")


fix regression in cljs.closure/build

fix regression in cljs.closure/build

return final output again

--- src/clj/cljs/closure.clj
+++ src/clj/cljs/closure.clj
@@ -951,28 +951,28 @@
                                               [(-compile (io/resource "cljs/nodejs.cljs") all-opts)])))
                              (when (= :nodejs (:target all-opts))
                                [(-compile (io/resource "cljs/nodejscli.cljs") all-opts)]))
-                 optim (:optimizations all-opts)]
-             (if (and optim (not= optim :none))
-               (do
-                 (when-let [fname (:source-map all-opts)]
-                   (assert (string? fname)
-                           (str ":source-map must name a file when using :whitespace, "
-                                ":simple, or :advanced optimizations"))
-                   (doall (map #(source-on-disk all-opts %) js-sources)))
-                 (->> js-sources
-                      (apply optimize all-opts)
-                      (add-wrapper all-opts)
-                      (add-source-map-link all-opts)
-                      (add-header all-opts)
-                      (output-one-file all-opts)))
-               (apply output-unoptimized all-opts js-sources))
+                 optim (:optimizations all-opts)
+                 ret (if (and optim (not= optim :none))
+                       (do
+                         (when-let [fname (:source-map all-opts)]
+                           (assert (string? fname)
+                             (str ":source-map must name a file when using :whitespace, "
+                               ":simple, or :advanced optimizations"))
+                           (doall (map #(source-on-disk all-opts %) js-sources)))
+                         (->> js-sources
+                           (apply optimize all-opts)
+                           (add-wrapper all-opts)
+                           (add-source-map-link all-opts)
+                           (add-header all-opts)
+                           (output-one-file all-opts)))
+                       (apply output-unoptimized all-opts js-sources))]
              ;; emit Node.js bootstrap script for :none & :whitespace optimizations
              (when (and (= (:target opts) :nodejs)
-                     (#{:none :whitespace} (:optimizations opts)))
-               (let [outfile (io/file (io/file (output-directory opts))
-                               "goog/bootstrap/nodejs.js")]
+                        (#{:none :whitespace} (:optimizations opts)))
+               (let [outfile (io/file (io/file (output-directory opts)) "goog/bootstrap/nodejs.js")]
                  (comp/mkdirs outfile)
-                 (spit outfile (slurp (io/resource "cljs/nodejs.js")))))))))))
+                 (spit outfile (slurp (io/resource "cljs/nodejs.js")))))
+             ret))))))

 (comment


CLJ-2004 include retag in multi-spec form

Signed-off-by: Stuart Halloway <4dc50fc3bc007be011b5445f3f79298b9eeb51b7@cognitect.com>

--- src/clj/clojure/spec.clj
+++ src/clj/clojure/spec.clj
@@ -928,7 +928,7 @@
                   (when (every? identity gs)
                     (gen/one-of gs)))))
         (with-gen* [_ gfn] (multi-spec-impl form mmvar retag gfn))
-        (describe* [_] `(multi-spec ~form))))))
+        (describe* [_] `(multi-spec ~form ~retag))))))

 (defn ^:skip-wiki tuple-impl
   "Do not call this directly, use 'tuple'"


Force end-point.

Force end-point.

--- src/clj/medusa/alert.clj
+++ src/clj/medusa/alert.clj
@@ -15,7 +15,8 @@
         (println "SUBJECT: " subject)
         (println "BODY: " subject)
         (println "===================================================="))
-    (ses/send-email :destination {:to-addresses destinations}
+    (ses/send-email {:endpoint "us-west-2"}
+                    :destination {:to-addresses destinations}
                     :source "telemetry-alerts@mozilla.com"
                     :message {:subject subject
                               :body {:text body}})))


Add possibility to run multiple requests in one scenario

--- src/clj_gatling/core.clj
+++ src/clj_gatling/core.clj
@@ -1,4 +1,5 @@
 (ns clj-gatling.core
+  (:use [clojure.set :only [rename-keys]])
   (:import (io.gatling.charts.report ReportsGenerator)
            (io.gatling.charts.result.reader FileDataReader)
            (io.gatling.core.config GatlingConfiguration))
@@ -6,24 +7,31 @@
             [clojure-csv.core :as csv])
   (:gen-class))

+(def test-scenario {:requests ["Request1" "Request2"]})
+
 (defmacro bench [expr]
   `(let [start# (System/currentTimeMillis)
          result# ~expr]
       {:result result# :start start# :end (System/currentTimeMillis) }))

-(defn request [id]
-  (println (str "Simulating request for " id))
-  (Thread/sleep (rand 1000)))
+(defn run-request [name id]
+  ;(println (str "Simulating request for " id))
+  (Thread/sleep (rand 1000))
+  "OK")

-(defn process [id]
-  (let [bench-result (bench (request id))]
-    {:id id :start (:start bench-result) :end (:end bench-result)}))
+(defn run-scenario [scenario id]
+  (assoc
+    (rename-keys
+      (bench
+        (map #(assoc (bench (run-request % id)) :name % :id id) (:requests scenario)))
+      {:result :requests})
+    :id id))

 (defn run-simulation [threads]
   (println (str "Run simulation with " threads " threads"))
   (let [cs (repeatedly threads async/chan)
         ps (map vector (iterate inc 0) cs)]
-    (doseq [[i c] ps] (go (>! c (process i))))
+    (doseq [[i c] ps] (go (>! c (run-scenario test-scenario i))))
     (let [result (for [i (range threads)]
       (let [[v c] (async/alts!! cs)]
         v))]
@@ -37,20 +45,26 @@
     (GatlingConfiguration/setUp conf)
     (ReportsGenerator/generateFor "out" (FileDataReader. "23"))))

-(defn map-request [line]
-  (let [start (.toString (:start line))
-        end (.toString (:end line))]
-    ["REQUEST" "Scenario name" (.toString (:id line)) "" "request_1" start start "1390591841245" end "OK" "\u0020"]))
+(defn map-request [request]
+  (let [start (.toString (:start request))
+        end (.toString (:end request))]
+    ["REQUEST" "Scenario name" (.toString (:id request)) "" (:name request) start start "1390591841245" end "OK" "\u0020"]))

-(defn map-scenario [line]
-  (let [start (.toString (:start line))
-        end (.toString (:end line))]
-    ["SCENARIO"	"Scenario name"	(.toString (:id line)) start end]))
+(defn flatten-one-level [coll]
+  (mapcat #(if (sequential? %) % [%]) coll))
+
+(defn map-scenario [scenario]
+  (let [start (.toString (:start scenario))
+        end (.toString (:end scenario))
+        requests (apply concat (map #(vector (map-request %)) (:requests scenario)))]
+    (conj requests ["SCENARIO" "Scenario name" (.toString (:id scenario)) start end])))

 (defn create-result-lines [result]
-  (let [header ["RUN" "20140124213040" "basicexamplesimulation" "\u0020"]
-        reqs-and-scenarios (apply concat (map #(vector (map-request %) (map-scenario %)) result))]
-    (conj reqs-and-scenarios header)))
+  (let [header ["RUN" "20140124213040" "basicexamplesimulation" "\u0020"]
+        scenarios (apply concat (map #(vector (map-scenario %)) result))
+       result-lines (conj (flatten-one-level scenarios) header)]
+    (println result-lines)
+    result-lines))

 (defn -main [threads]
   (let [result (run-simulation (read-string threads))


Proper recursion for scraping the pages

Proper recursion for scraping the pages

--- src/clj_scraper/core.clj
+++ src/clj_scraper/core.clj
@@ -76,35 +76,18 @@
   (str base-url (:href (:attrs (nth arrows 0))))
   )

-; do-scrape and test-dom should probably be combined into one function
-; with a single recursive call.
-(declare do-scrape)
-
-(defn test-dom
-  "Test the DOM to see if it contains >>, if it does then go to the next page and scrape"
+(defn do-scrape
+  "Recursively scrape all search pages"
   [dom]
   (let [arrows (vec (extract-arrows dom))]
     (if (= (count arrows) 2)
-    (do-scrape (get-dom (get-linkfromarrows arrows)))
-    [])))
-
-(defn do-scrape
-  "First check the DOM for other pages then get the content on this DOM"
-  [dom]
-  (concat (test-dom dom) (get-content dom)))
-
-
-(defn do-scrape2
-  [dom]
-  (let [arrows (vec (extract-arrows dom))]
-    (if (= (count arrows) 2)
-    (concat (do-scrape2 (get-dom (get-linkfromarrows arrows))) (get-content dom))
+    (concat (do-scrape (get-dom (get-linkfromarrows arrows))) (get-content dom))
     (get-content dom))))

 (defn -main
   [& args]
     (create-db)
-    (let [data (vec (do-scrape2 (get-dom website)))]
+    (let [data (vec (do-scrape (get-dom website)))]
       (doall (map insert-record data)))
     )


Selection of players and score with dropdowns

--- src/cljs/darts/core.cljs
+++ src/cljs/darts/core.cljs
@@ -91,45 +91,39 @@
       (println @game)]]))

-(defn select-player-pane []
-  [:div
-   (when (both-players-selected?)
-     [:div
-      [:button {:on-click (fn []
-                            (reset! player1 "")
-                            (reset! player2 ""))} "Reset"]])
-   (let [select-fn (fn [player]
-                     [:ul
-                      (doall
-                       (map (fn [{:keys [name]}]
-                              (when (and (not= name @player1)
-                                         (not= name @player2))
-                                ^{:key name}
-                                [:li
-                                 [:button {:on-click (fn []
-                                                       (reset! player name))}
-                                  name]]))
-                            (parse-json @players)))]
-                     )]
-     (if (= "" @player1)
-       (select-fn player1)
-       (select-fn player2)))
-   [:a {:href "#/new-player"} "New player"]])
-
 (defn select-game-pane []
   [:div
-   [:p "Starting score: " @game-score]
-   (map (fn [score] ^{:key score} [:button {:on-click #(reset! game-score score)} score]) [310 410 510])])
+   [:div "Starting score: "
+    [:select {:id "score"
+              :on-change #(reset! game-score (.-value (js/document.getElementById "score")))}
+     (map (fn [score] ^{:key score} [:option score]) [310 410 510])]]])

 (defn new-game-page []
   (load-players)
   [:div
    [:a {:href "#"} "Home"]
    [:div [:h2 "New game"]
+    [:a {:href "#/new-player"} "New player"]
     [:ul
-     [:li (str "Player 1: " @player1)]
-     [:li (str "Player 2: " @player2)]]
-    [select-player-pane]
+     [:li (str "Player 1: ")
+      [:select {:id "player1"
+                :value @player1
+                :on-change #(reset! player1 (.-value (js/document.getElementById "player1")))}
+       (doall
+        (concat [^{:key "1-nil"}[:option ""]]
+                (map (fn [{:keys [name]}]
+                       ^{:key name}[:option name])
+                     (parse-json @players))))]]
+     [:li (str "Player 2: ")
+      [:select {:id "player2"
+                :value @player2
+                :on-change #(reset! player2 (.-value (js/document.getElementById "player2")))}
+       (doall
+        (concat [^{:key "2-nil"}[:option ""]]
+                (map (fn [{:keys [name]}]
+                       (when (not= @player1 name)
+                         ^{:key name}[:option name]))
+                     (parse-json @players))))]]]
     [select-game-pane]]
    (when (both-players-selected?)
      [:div


Fix arity error calling (h "span")

Fix arity error calling (h "span")

--- src/cljs/klang/core.cljs
+++ src/cljs/klang/core.cljs
@@ -339,7 +339,7 @@
                          :type "text"
                          :defaultValue (:search @db "")
                          :placeholder "Search"})
-          (h "span"))
+          (h "span" #js{}))
         (h "button" #js{:style #js{:cursor "pointer"
                                    :color (if (:frozen-at @db) "orange" "green")}
                         :onClick #(toggle-freeze)}


Update save-project-settings docstring

Update save-project-settings docstring

--- frontend/controllers/controls.cljs
+++ frontend/controllers/controls.cljs
@@ -549,10 +549,10 @@
   "Takes the state of project settings inputs and PUTs the new settings to
   /api/v1/project/:project/settings.

-  `merge-path` is a path into the nested project data-structure. When
-  merge-path is non-nil the part of the project data-structure at that path is
-  used as the base values for the settings. The new settings from the inputs
-  state are merged on top.
+  `merge-paths` is a list of paths into the nested project data-structure.
+  When a merge-path is non-nil the part of the project data-structure at
+  that path is used as the base values for the settings. The new settings
+  from the inputs state are merged on top.

   This allows all the settings on a page to be submitted, even if the user only
   modifies one.
@@ -566,7 +566,7 @@
   The user sets a new access key ID so inputs is
     {:aws {:keypair {:access_key_id \"new key id\"}}}

-  :merge-path is [:aws :keypair]
+  :merge-paths is [[:aws :keypair]]

   The settings posted to the settings API will be:
     {:aws {:keypair {:access_key_id \"new key id\"


ensure-leadership added to all methods of thrift service handler

--- src/clj/backtype/storm/daemon/nimbus.clj
+++ src/clj/backtype/storm/daemon/nimbus.clj
@@ -880,6 +880,7 @@
       (^void submitTopologyWithOpts
         [this ^String storm-name ^String uploadedJarLocation ^String serializedConf ^StormTopology topology
          ^SubmitOptions submitOptions]
+        (ensure-leadership leader-elections)
         (try
           (assert (not-nil? submitOptions))
           (validate-topology-name! storm-name)
@@ -920,13 +921,16 @@

       (^void submitTopology
         [this ^String storm-name ^String uploadedJarLocation ^String serializedConf ^StormTopology topology]
+        (ensure-leadership leader-elections)
         (.submitTopologyWithOpts this storm-name uploadedJarLocation serializedConf topology
                                  (SubmitOptions. TopologyInitialStatus/ACTIVE)))

       (^void killTopology [this ^String name]
+        (ensure-leadership leader-elections)
         (.killTopologyWithOpts this name (KillOptions.)))

       (^void killTopologyWithOpts [this ^String storm-name ^KillOptions options]
+        (ensure-leadership leader-elections)
         (check-storm-active! nimbus storm-name true)
         (let [wait-amt (if (.is_set_wait_secs options)
                          (.get_wait_secs options)
@@ -935,6 +939,7 @@
           ))

       (^void rebalance [this ^String storm-name ^RebalanceOptions options]
+        (ensure-leadership leader-elections)
         (check-storm-active! nimbus storm-name true)
         (let [wait-amt (if (.is_set_wait_secs options)
                          (.get_wait_secs options))
@@ -951,13 +956,16 @@
           ))

       (activate [this storm-name]
+        (ensure-leadership leader-elections)
         (transition-name! nimbus storm-name :activate true)
         )

       (deactivate [this storm-name]
+        (ensure-leadership leader-elections)
         (transition-name! nimbus storm-name :inactivate true))

       (beginFileUpload [this]
+        (ensure-leadership leader-elections)
         (let [fileloc (str (inbox nimbus) "/stormjar-" (uuid) ".jar")]
           (.put (:uploaders nimbus)
                 fileloc
@@ -967,6 +975,7 @@
           ))

       (^void uploadChunk [this ^String location ^ByteBuffer chunk]
+        (ensure-leadership leader-elections)
         (let [uploaders (:uploaders nimbus)
               ^WritableByteChannel channel (.get uploaders location)]
           (when-not channel
@@ -977,6 +986,7 @@
           ))

       (^void finishFileUpload [this ^String location]
+        (ensure-leadership leader-elections)
         (let [uploaders (:uploaders nimbus)
               ^WritableByteChannel channel (.get uploaders location)]
           (when-not channel
@@ -988,6 +998,7 @@
           ))

       (^String beginFileDownload [this ^String file]
+        (ensure-leadership leader-elections)
         (let [is (BufferInputStream. (.open storage file))
               id (uuid)]
           (.put (:downloaders nimbus) id is)
@@ -995,6 +1006,7 @@
           ))

       (^ByteBuffer downloadChunk [this ^String id]
+        (ensure-leadership leader-elections)
         (let [downloaders (:downloaders nimbus)
               ^BufferInputStream is (.get downloaders id)]
           (when-not is
@@ -1008,18 +1020,23 @@
             )))

       (^String getNimbusConf [this]
+        (ensure-leadership leader-elections)
         (to-json (:conf nimbus)))

       (^String getTopologyConf [this ^String id]
+        (ensure-leadership leader-elections)
         (to-json (read-storm-conf storage conf id)))

       (^StormTopology getTopology [this ^String id]
+        (ensure-leadership leader-elections)
         (system-topology! (read-storm-conf storage conf id) (read-storm-topology storage id)))

       (^StormTopology getUserTopology [this ^String id]
+        (ensure-leadership leader-elections)
         (read-storm-topology storage id))

       (^ClusterSummary getClusterInfo [this]
+        (ensure-leadership leader-elections)
         (let [storm-cluster-state (:storm-cluster-state nimbus)
               supervisor-infos (all-supervisor-info storm-cluster-state)
               ;; TODO: need to get the port info about supervisors...
@@ -1059,6 +1076,7 @@
           ))

       (^TopologyInfo getTopologyInfo [this ^String storm-id]
+        (ensure-leadership leader-elections)
         (let [storm-cluster-state (:storm-cluster-state nimbus)
               storm-topology (read-storm-topology storage storm-id)
               storm-conf (read-storm-conf storage conf storm-id)


str/includes? -> str/starts-with? in geodash.clj

--- src/clj/org/openforis/ceo/db/geodash.clj
+++ src/clj/org/openforis/ceo/db/geodash.clj
@@ -53,7 +53,7 @@

 (defn gateway-request [{:keys [params json-params server-name]}]
   (let [path (:path params)
-        url  (if (str/includes? server-name "local")
+        url  (if (str/starts-with? server-name "local")
                "https://ceodev.servirglobal.net"
                "https://localhost")]
     (client/post (str url ":8888/" path)