Fix archived over-writing styles for limbo and private

--- src/braid/ui/styles/thread.cljs
+++ src/braid/ui/styles/thread.cljs
@@ -34,17 +34,17 @@
       :top 0
       :left 0}]

+      [:&.archived
+       [:.head:before
+        {:background vars/archived-thread-accent-color}]]
+
       [:&.private
        [:.head:before
         {:background vars/private-thread-accent-color}]]

       [:&.limbo
        [:.head:before
-        {:background vars/limbo-thread-accent-color}]]
-
-      [:&.archived
-       [:.head:before
-        {:background vars/archived-thread-accent-color}]]]
+        {:background vars/limbo-thread-accent-color}]]]

    [:.card
     mixins/flex


fix CSS classes on new-group button

fix CSS classes on new-group button

fixes active indicator on the plus button and fixes the height issue

--- src/braid/ui/views/sidebar.cljs
+++ src/braid/ui/views/sidebar.cljs
@@ -174,8 +174,9 @@
 (defn new-group-view []
  (let [page (subscribe [:page])]
    (fn []
-     [:a.option.plus {:class (when (= (@page :type) :group-explore) "active")
-                      :href (routes/other-path {:page-id "group-explore"})}])))
+     [:a.option.plus.group
+      {:class (when (= (@page :type) :group-explore) "active")
+       :href (routes/other-path {:page-id "group-explore"})}])))

 (defn sidebar-view []
   [:div.sidebar


Delete unnecessary dependencies

Delete unnecessary dependencies

--- src/midje/data/metaconstant.clj
+++ src/midje/data/metaconstant.clj
@@ -1,14 +1,8 @@
 (ns ^{:doc "A notation that avoids confusion between what’s essential
             about data and what’s accidental. A stand in for constant data."}
   midje.data.metaconstant
-  (:use [midje.util.form-utils :only [translate-zipper fnref-symbol]]
-        [midje.util.zip :only [skip-down-then-rightmost-leaf]]
-        [midje.util.thread-safe-var-nesting :only [unbound-marker]]
-        [midje.error-handling.exceptions :only [user-error]]
-        [utilize.seq :only (find-first)]
-        [clojure.core.incubator :only [-?>>]])
-  (:require [clojure.zip :as zip]
-            [midje.util.ecosystem :as ecosystem]))
+  (:use [midje.util.thread-safe-var-nesting :only [unbound-marker]])
+  (:require [midje.util.ecosystem :as ecosystem]))

 ;;; Metaconstants are built from special symbols, called "metaconstant symbol". Such symbols


cleanup

cleanup

--- src/clj/ceres_analytics/core.clj
+++ src/clj/ceres_analytics/core.clj
@@ -101,5 +101,4 @@

   (stop-server)

-
   )


limit Security Testing to work only on Runner's turn

--- src/clj/game/cards-resources.clj
+++ src/clj/game/cards-resources.clj
@@ -728,7 +728,8 @@
                                     {:mandatory true
                                      :effect (effect (resolve-ability
                                                        {:msg "gain 2 [Credits] instead of accessing"
-                                                        :effect (effect (gain :credit 2))} st nil))})))}}
+                                                        :effect (effect (gain :credit 2))} st nil))})))}
+             :runner-turn-ends {:effect (effect (update! (dissoc card :testing-target)))}}
     :abilities [ability]})

    "Spoilers"


Joshua B. correctly add tag at the end of the run.

--- src/clj/game/cards-resources.clj
+++ src/clj/game/cards-resources.clj
@@ -247,8 +247,10 @@
    "Joshua B."
    {:events {:runner-turn-begins
              {:optional {:prompt "Use Joshua B. to gain [Click]?"
-                         :yes-ability { :msg "gain [Click]" :effect (effect (gain :click 1))}
-                         :end-turn {:effect (effect (tag-runner 1)) :msg "gain 1 tag"}}}}}
+                         :yes-ability {:msg "gain [Click]"
+                                       :effect (effect (gain :click 1))}}}
+             :end-turn {:effect (effect (tag-runner 1))
+                        :msg "gain 1 tag"}}}

    "Kati Jones"
    {:abilities


Faster test migration reset

Faster test migration reset

--- src/clj/salava/core/migrator.clj
+++ src/clj/salava/core/migrator.clj
@@ -115,10 +115,21 @@
       (migratus/migrate (migratus-config conf plugin))
       (run-seed conf plugin))))

+(defn- test-drop-all! [conf]
+  (let [conn (jdbc-uri conf)
+        db-name (get-in conf [:datasource :database-name] "salava_test")
+        sql "SELECT table_name FROM information_schema.tables WHERE table_schema = ?"
+        tables (map :table_name (jdbc/query conn [sql db-name]))]
+    (doseq [t tables]
+      (jdbc/execute! conn [(str "DROP TABLE " t)]))))

 (defn run-test-reset []
-  (doseq [plugin (plugins (test-config))]
-    (run-reset (test-config) plugin)))
+  (let [conf (test-config)]
+    (test-drop-all! conf)
+    (doseq [plugin (plugins conf)]
+      (log/info "running reset functions for plugin" (plugin-str plugin))
+      (migratus/migrate (migratus-config conf plugin))
+      (run-seed conf plugin))))

 (defn migrate-all [config-path]


render output-paths in chunk progress

render output-paths in chunk progress

--- src/clj_money/import/gnucash.clj
+++ src/clj_money/import/gnucash.clj
@@ -276,21 +276,22 @@
       result)))

 (defn- process-output
-  [{:keys [verbose records output-folder file-name output-paths] :as context}]
+  [{:keys [verbose
+           records
+           output-folder
+           file-name
+           output-paths
+           progress-chan]
+    :as context}]
   (if (seq records)
     (let [output-path (format "%s/%s_%s.edn.gz"
                               output-folder
                               file-name
                               (count output-paths))]
-
-      (log/info "Writing" (count records) "records to" output-path)
-
       (binding [*print-meta* true]
         (with-open [writer (io/writer (GZIPOutputStream. (FileOutputStream. output-path)))]
           (.write writer (prn-str records))))
-
-      (log/info "Finished writing" output-path)
-
+      (>!! progress-chan [:output-path output-path])
       (-> context
           (assoc :records [])
           (update-in [:output-paths] #(conj % output-path))))
@@ -326,7 +327,7 @@
 (defn- process-chunk-record
   "Processes a single record for the file chunking process"
   [{:keys [progress-chan] :as context} record]
-  (>!! progress-chan record)
+  (>!! progress-chan [:record record])
   (-> context
       (update-in [:records] #(conj % record))
       advance-context))
@@ -342,19 +343,24 @@
         progress-chan (chan)
         result (go
                  (with-open [input-stream (FileInputStream. input-file)]
-                   (reduce process-chunk-record
-                           {:output-paths []
-                            :verbose (-> opts :options :verbose)
-                            :records []
-                            :max-record-count (-> opts :options :maximum)
-                            :file-name (second (re-matches #"^(.+)(\..+)$" file-name))
-                            :output-folder output-folder
-                            :progress-chan progress-chan}
-                           (read-source :gnucash input-stream))))]
-    (go-loop [record (<! progress-chan)]
-             (when (not (:verbose opts))
-               (print (-> record meta :record-type name first))
-               (flush))
+                   (->> (read-source :gnucash input-stream)
+                        (reduce process-chunk-record
+                                {:output-paths []
+                                 :verbose (-> opts :options :verbose)
+                                 :records []
+                                 :max-record-count (-> opts :options :maximum)
+                                 :file-name (second (re-matches #"^(.+)(\..+)$" file-name))
+                                 :output-folder output-folder
+                                 :progress-chan progress-chan})
+                        process-output)))]
+    (go-loop [value (<! progress-chan)]
+             (case (first value)
+               :record
+               (when (not (:verbose opts))
+                 (print (-> value second meta :record-type name first))
+                 (flush))
+               :output-path
+               (println "\n" (second value)))
              (recur (<! progress-chan)))
     (println "reading the source file...")
     (<!! result)


Collision detection works on top & btm walls.

--- src/cljs/clj_mini_apps/pong.cljs
+++ src/cljs/clj_mini_apps/pong.cljs
@@ -80,21 +80,17 @@
 (defn on-collision [state]
   (let [ball-x (:x (:ball state))
         ball-y (:y (:ball state))
-        new-y-dir (if (= + (:y-dir (:ball state))) - +)
-        _ (log (str (new-y-dir 0 1)))]
-    (log "on-collision")
+        top-wall (+ 9 7.5)
+        btm-wall (- 490 7.5)
+        new-y-dir (if (= + (:y-dir (:ball state))) - +)]
     ;Check wall collision
-    (if (not (and (> ((:y-dir (state :ball)) ball-speed ball-y)
-                     (+ 9 7.5))
-                  (< ((:y-dir (state :ball)) ball-speed ball-y)
-                     (- 490 7.5))))
+    (if (not (and (> ball-y top-wall)
+                  (< ball-y btm-wall)))
       (as-> state state
         (assoc-in state [:ball :y-dir] new-y-dir)
-        (if (= (:y-dir state) -)
-          (assoc-in state [:ball :y] 50)
-          (assoc-in state [:ball :y] 450))
-        ;(update-in state [:ball :x] (:x-dir (:ball state)) ball-speed)
-        )
+        (if (= (:y-dir (:ball state)) +)
+          (assoc-in state [:ball :y] top-wall)
+          (assoc-in state [:ball :y] btm-wall)))
       state)))

 (defn draw-game


html5 sketch

html5 sketch

--- src/cljs_dnd/backends/html5.cljs
+++ src/cljs_dnd/backends/html5.cljs
@@ -1,100 +1,29 @@

-(ns cljs-dnd.backends.html5)
+(ns cljs-dnd.backends.html5
   (:require-macros [cljs.core.async.macros :refer [go go-loop]])
   (:require
-    [cljs-dnd.state :refer [state]]
-    [cljs.core.async :refer [<! put! chan timeout]]
+    [cljs-dnd.state :refer [state update-state!]]
+    ; [cljs.core.async :refer [<! put! chan timeout]]
     [goog.events :as events])
   (:import [goog.events EventType]))

-(defn register-source [])

-(defn register-target [])
+(defmulti handle-action
+  (fn [type args]
+    type))

-(defn handle-drag-start [])
+(defmethod handle-action :default [type]
+  (.log js/console "Unknown action: " type))

-(defn handle-drag [])
+(defmethod handle-action :register-source [_ node]
+  (do
+    (aset node "draggable" true)
+    (events/listen node EventType.DRAGSTART #(handle-action :drag-start %))))

-;; is there a such thing??
-(defn handle-drag-end [])
+(defmethod handle-action :register-target [])

-(defn handle-drop [])
+(defmethod handle-action :drag-start [_ e]
+  (update-state! :is-dragging true))

-
-;;----------------------------------------------------------------------
-;;----------------------------------------------------------------------
-
-(def dnd-chan (chan))
-
-(defn handle-drag-start [e]
-  (let [{:keys [drag-index item-type]} e
-        updated {:drag-index drag-index
-                 :item-type item-type}]
-      (swap! state merge updated)))
-
-(defn handle-drag-enter [e]
-  (let [{:keys [dix hix]} @state]))
-  ;; TODO update accrordin to event
-
-(defn handle-drag-leave [e]
-  (let [{:keys [dix hix]} @state]))
-  ;; TODO update accrordin to event
-
-(defn handle-drag-end [e]
-  (let [{:keys [dix hix]} @state]))
-  ;; TODO update accrordin to event
-
-(defn handle-drag [e]
-  (swap! state assoc :y (.-clientY e)))
-  ;; TODO update accrordin to event
-
-(defn handle-drag-over [e]
-  (let [{:keys [dix hix]} @state]))
-  ;; TODO update accrordin to event
-
-(defn handle-drop [e])
-  ;; TODO update accrordin to event
-
-
-;; --------------------------
-;; EVENTS:
-
-(defn parse-event
-  "Normalizes the event for dnd purposes"
-  [e]
-  (let [event-type (-> e .-type)
-        item-index (-> e .-target .-dataset .-index int)
-        bottom (-> e .-target .getBoundingClientRect .-bottom)
-        top (-> e .-target .getBoundingClientRect .-top)]
-    {:event-type event-type
-     :item-index item-index
-     :top top
-     :bottom bottom}))
-
-(defn on-event [e]
-  (put! dnd-chan (parse-event e)))
-
-
-;; --------------------------
-;; LISTENER:
-
-(defn dnd-start! [backend]
-  (events/listen js/window EventType.DRAGSTART on-event)
-  (events/listen js/window EventType.DRAGOVER  on-event)
-  (events/listen js/window EventType.DRAGEND   on-event)
-  (events/listen js/window EventType.DRAG      on-event)
-  (events/listen js/window EventType.DRAGENTER on-event)
-  (events/listen js/window EventType.DRAGLEAVE on-event)
-
-  (go-loop []
-     (let [e (<! dnd-chan)
-           {:keys [event-type]} e]
-        (condp = event-type
-          "dragenter" (handle-drag-enter e)
-          "dragleave" (handle-drag-leave e)
-          "dragstart" (handle-drag-start e)
-          "dragover"  (handle-drag-over e)
-          "drag"      (handle-drag e)
-          "drop"      (handle-drop e)
-          :default    (prn event-type))
-       (recur))))
+(defmethod handle-action :drop []
+  (update-state! :is-dragging false))


fix reflection bug

fix reflection bug

--- src/clj/backtype/storm/util.clj
+++ src/clj/backtype/storm/util.clj
@@ -781,7 +781,7 @@
 (defmacro fast-map-iter [[bind amap] & body]
   `(let [iter# (map-iter ~amap)]
     (while (iter-has-next? iter#)
-      (let [entry# (.next iter#)
+      (let [entry# (iter-next iter#)
             ~bind (convert-entry entry#)]
         ~@body
         ))))


Formatting

Formatting

--- src/clj/cglossa/data_import.clj
+++ src/clj/cglossa/data_import.clj
@@ -170,9 +170,9 @@
                      "with 'tid' (text ID) as the first header."))
         (write-csv tsv-file (->> rows
                                  (mapcat (fn [row]
-                                       (map (fn [field header]
-                                              [(str corpus "_" header) field])
-                                            (rest row) other-headers)))
+                                           (map (fn [field header]
+                                                  [(str corpus "_" header) field])
+                                                (rest row) other-headers)))
                                  (filter #(non-blank? (second %)))
                                  (cons ["corpus_cat" "value"])))))))


Implemented label+purge trash Diwan (install cost manual)

--- src/clj/game/cards-programs.clj
+++ src/clj/game/cards-programs.clj
@@ -142,6 +142,13 @@
                              {:req (req (>= (get-virus-counters state side card) 3)) :msg "look at the top card of R&D"
                               :effect (effect (prompt! card (str "The top card of R&D is "
                                                                  (:title (first (:deck corp)))) ["OK"] {}))}}}
+
+   "Diwan"
+   {:prompt "Choose the server that this copy of Diwan is targeting:"
+    :choices (req servers)
+    :effect (effect (update! (assoc card :named-target target)))
+    :leave-play (effect (update! (dissoc card :named-target)))
+    :events {:purge {:effect (effect (trash card))}}}

    "Djinn"
    {:abilities [{:label "Add a virus program to your Grip from your Stack"


Demonstrate we're actually evaluating Clojure in the default value.

--- src/cljs/leipzig_live/core.cljs
+++ src/cljs/leipzig_live/core.cljs
@@ -6,8 +6,8 @@
     [reagent.core :as reagent :refer [atom]]))

 (defn mount-root []
-  (let [state-atom (atom {:music [[1 0.5 1.5] [100 125 150]]
-                          :text "'((1 0.5 1.5) (100 120 150))"})]
+  (let [state-atom (atom {:music [[1 (- 1 0.5) 1.5] [100 (+ 100 25) (* 3 50)]]
+                          :text "'((1 (- 1 0.5) 1.5) (100 (+ 100 25) (* 3 50)))"})]
     (reagent/render
       [view/home-page (partial framework/apply-action! state-atom) @state-atom]
       js/document.body)))


Added note about missing behaviour functionality.  Should probably be logged as an issue as well

--- src/clojure/alfresco/behave.clj
+++ src/clojure/alfresco/behave.clj
@@ -39,3 +39,7 @@
                          NodeServicePolicies$OnAddAspectPolicy/QNAME
                          (m/qname ~qname)
                          b#)))
+
+; ####TODO: add macros for other policy types and notification frequencies
+; OR (better)
+; provide a generic macro that can handle all possible policy types and notification frequencies


Rewrite UI element hierarchy system

Rewrite UI element hierarchy system

--- src/clojure/neko/ui/mapping.clj
+++ src/clojure/neko/ui/mapping.clj
@@ -23,17 +23,18 @@
 (def ^{:private true} keyword-mapping
   (atom
    ;; UI widgets
-   {:button {:classname android.widget.Button
-             :traits [:layout-params :on-click :def]
+   {:view {:traits [:def :layout-params :on-click :text]}
+    :button {:classname android.widget.Button
+             :inherits :view
              :attributes {:text "Default button"}}
     :linear-layout {:classname android.widget.LinearLayout
-                    :traits [:layout-params :def]}
+                    :inherits :view}
     :edit {:classname android.widget.EditText
-           :traits [:layout-params :def]}
+           :inherits :view}
     :text-view {:classname android.widget.TextView
-                :traits [:layout-params :def]}
+                :inherits :view}
     :list-view {:classname android.widget.ListView
-                :traits [:layout-params :def]}
+                :inherits :view}

     ;; Other
     :layout-params {:classname ViewGroup$LayoutParams
@@ -69,11 +70,10 @@
   "Returns the list of all unique traits for `kw`. The list is built
   recursively."
   [kw]
-  (let [first-level-traits (get-in @keyword-mapping [kw :traits])]
-    (->> first-level-traits
-         (mapcat all-traits)
-         (concat first-level-traits)
-         distinct)))
+  (let [own-traits (get-in @keyword-mapping [kw :traits])
+        parent (get-in @keyword-mapping [kw :inherits])]
+    (concat own-traits (when parent
+                         (all-traits parent)))))

 (defn set-value!
   "Associate the value keyword with the provided value for the given
@@ -83,14 +83,20 @@

 (defn value
   "If the value is a keyword then returns the value for it from the
-keyword-mapping. If the value-keyword isn't present in the
-keyword-mapping, form the value as
-`classname-for-element-kw/CAPITALIZED-VALUE-KW`."
+  keyword-mapping. The value is sought in the element itself and all
+  its parents. If the value-keyword isn't present in any element's
+  keyword-mapping, form the value as
+  `classname-for-element-kw/CAPITALIZED-VALUE-KW`."
   [element-kw value]
-  (if-not (keyword? value)
-    value
-    (get-in @keyword-mapping [element-kw :values value]
-            (keyword->static-field (classname element-kw) value))))
+  (let [mapping @keyword-mapping
+        recursive-find (fn [kw]
+                         (when kw
+                           (or (get-in mapping [kw :values value])
+                               (recur (get-in mapping [kw :inherits])))))]
+    (if-not (keyword? value)
+      value
+      (or (recursive-find element-kw)
+          (keyword->static-field (classname element-kw) value)))))

 (defn add-default-atribute-value!
   "Adds a default attribute value for the given element."
@@ -99,22 +105,21 @@
          update-in [element-kw :attributes attribute-kw] value))

 (defn default-attributes [element-kw]
-  "Returns a map of default attributes for the given element keyword."
+  "Returns a map of default attributes for the given element keyword
+  and all its parents."
   [element-kw]
-  (get-in @keyword-mapping [element-kw :attributes]))
+  (merge (when element-kw
+           (default-attributes (get-in @keyword-mapping
+                                       [element-kw :inherits])))
+         (get-in @keyword-mapping [element-kw :attributes])))

 (defn defelement
   "Defines the element of the given class with the provided name to
-  use in the UI construction. Takes the element's classname, a list of
-  traits and a map of specific values as optional arguments."
-  [kw-name & {:keys [classname traits values attributes inherits]}]
-  (when inherits
-    (swap! keyword-mapping #(assoc % kw-name (inherits %))))
-  (when classname
-    (set-classname! kw-name classname))
-  (when traits
-    (swap! keyword-mapping update-in [kw-name :traits] concat traits))
-  (when values
-    (swap! keyword-mapping update-in [kw-name :values] merge values))
-  (when attributes
-    (swap! keyword-mapping update-in [kw-name :attributes] merge attributes)))
+  use in the UI construction. Takes the element's classname, a parent
+  it inherits, a list of traits and a map of specific values as
+  optional arguments.
+
+  Optional arguments
+  - :classname, :inherits, :traits, :values, :attributes. "
+  [kw-name & args]
+  (swap! keyword-mapping assoc kw-name (apply hash-map args)))


Make :onyx.core/scheduler-event use scheduler enum

--- src/onyx/information_model.cljc
+++ src/onyx/information_model.cljc
@@ -610,7 +610,8 @@
                        :onyx.core/results {:type :results
                                            :optional? true
                                            :doc "A map of read segment to a vector of segments produced by applying the function of this task"}
-                       :onyx.core/scheduler-event {:type [:one-of peer-scheduler-event-types]
+                       :onyx.core/scheduler-event {:type :keyword
+                                                   :choices peer-scheduler-event-types
                                                    :optional? true
                                                    :doc "The cause of a peer allocated to a task being stopped. This will be added to the event map before the `:lifecycle/after-task-stop` lifecycle function is called."}


Add optional key `:onyx/percentage` in base-task-map schema. (#892)

--- src/onyx/schema.cljc
+++ src/onyx/schema.cljc
@@ -94,6 +94,7 @@
    (s/optional-key :onyx/max-peers) PosInt
    (s/optional-key :onyx/min-peers) PosInt
    (s/optional-key :onyx/n-peers) PosInt
+   (s/optional-key :onyx/percentage) PosInt
    (s/optional-key :onyx/required-tags) [s/Keyword]
    (restricted-ns :onyx) s/Any})


returning iterator seq from mongo aggregate

--- src/ophion/mongo.clj
+++ src/ophion/mongo.clj
@@ -104,7 +104,7 @@
    (let [coll (.getCollection db collection)
          aggropts (build-aggregation-options opts)
          pipe (util/into-array-list (convert/to-db-object pipeline))]
-     (.aggregate coll pipe aggropts))))
+     (iterator-seq (.aggregate coll pipe aggropts)))))

 (def document-limit 10000)


corrected several minor errors

corrected several minor errors

--- src/paredit/core.clj
+++ src/paredit/core.clj
@@ -14,6 +14,7 @@
   (:use clojure.contrib.def)
   (:use clojure.test)
   (:use paredit.parser)
+  (:use clojure.set)
   (:require clojure.contrib.pprint)
   (:require [clojure.contrib.str-utils2 :as str2])
   (:require [clojure.zip :as zip]))
@@ -240,6 +241,8 @@
 	                 "(a,|b)" "(a, (|) b)"
 	                 "(a,|)" "(a, (|))"
 	                 "\\| " "\\(| "
+	                 "~|" "~(|)"
+	                 "~@|" "~@(|)"
 	                 "\\\\| " "\\\\ (|) "}]
 	    [")"         :paredit-close-round
 	                {"(a |b)" "(a b)|"
@@ -254,7 +257,7 @@
 	                 "(a b |c ,  )" "(a b c)|"
 	                 "(a b| [d e]" "(a b)| [d e]"
 	                 "; Hello,| world!"  "; Hello,)| world!"
-	                 "  \"Hello,| world!\" foo" "  \"Hello,)| world!\" foo"
+	                 "(  \"Hello,| world!\" foo )" "(  \"Hello,)| world!\" foo )"
 	                 "  \"Hello,| world!" "  \"Hello,)| world!"
 	                 "foo \\|" "foo \\)|"}]
 	    #_["M-)"       :paredit-close-round-and-newline
@@ -325,6 +328,8 @@
 (def *open-brackets* (conj (set "([{") nil)) ; we add nil to the list to also match beginning of text
 (def *close-brackets* (conj (set ")]}") nil)) ; we add nil to the list to also match end of text

+(def *form-macro-chars* #{\# \~ "~@" \' \` \@ "#^" "#'" "#_"})
+
 (defn text-spec-to-text
   "Converts a text spec to text map"
   [#^String text-spec]
@@ -390,12 +395,12 @@
   ([{:keys [#^String text offset length] :as t}] (previous-char t 1))
   ([{:keys [#^String text offset length] :as t} n]
     (assert (>= length 0))
-    (when (>= (- offset n) 0)
+    (when (< -1 (- offset n) (.length text))
       (.charAt text (- offset n)))))

 (defn next-char [{:keys [#^String text offset length] :as t}]
   (assert (>= length 0))
-  (when (< (+ offset length) (.length text))
+  (when (< -1 (+ offset length) (.length text))
     (.charAt text (+ offset length))))

 (defmulti paredit (fn [k & args] k))
@@ -423,10 +428,9 @@
 (defn close-balanced
   [[o c] {:keys [#^String text offset length] :as t}
    chars-with-no-space-before chars-with-no-space-after]
-    (let [parsed (parse text (.length text))] ; changed offset to (.length text)
-      (if-let [offset-loc (and
-                            (in-code? parsed)
-                            (-> parsed parsed-root-loc (loc-for-offset offset)))]
+    (let [parsed (parse text (.length text))
+          offset-loc (-> parsed parsed-root-loc (loc-for-offset offset))]
+      (if (and offset-loc (not (*not-in-code* (-> offset-loc zip/node :tag))))
         (let [up-locs (take-while identity (iterate zip/up offset-loc))
               match (some #(when (= o (-> % zip/node :tag)) %) up-locs)]
           (if match
@@ -445,21 +449,21 @@
   :paredit-open-round
   [cmd {:keys [text offset length] :as t}]
   (open-balanced [\( \)] t
-    (into *real-spaces* *open-brackets*)
+    (union (conj (into *real-spaces* *open-brackets*) \#) *form-macro-chars*)
     (into *extended-spaces* *close-brackets*)))

 (defmethod paredit
   :paredit-open-square
   [cmd {:keys [text offset length] :as t}]
   (open-balanced [\[ \]] t
-    (into *real-spaces* *open-brackets*)
+    (union (into *real-spaces* *open-brackets*) *form-macro-chars*)
     (into *extended-spaces* *close-brackets*)))

 (defmethod paredit
   :paredit-open-curly
   [cmd {:keys [text offset length] :as t}]
   (open-balanced [\{ \}] t
-    (conj (into *real-spaces* *open-brackets*) \#) ; add # for not inserting space before a set FIXME
+    (union (conj (into *real-spaces* *open-brackets*) \#) *form-macro-chars*)
     (into *extended-spaces* *close-brackets*)))

 (defmethod paredit


World-desc updating, but preserve the back history too.

--- src/player/core.cljs
+++ src/player/core.cljs
@@ -483,7 +483,8 @@
         (if (or (empty? seen)
                 (not (roll/seen-config? (:seen-configs w) last-config)))
           (let [newest (if (and (not (empty? old-configs))
-                                (< (count old-configs) (count new-configs)))
+                                (< (count old-configs) (count new-configs))
+                                (= (:desc w) (:desc new-w)))
                          (concat [(last old-configs)]
                                  (subvec new-configs (count old-configs)))
                          new-configs)
@@ -557,68 +558,96 @@
     (update-world! world reset-world)))

 ; remake ha defs from desc, then translate old valuations into new world def.
-; todo: if we want to save the "back" history, we need to translate all the old
-; configs into the new domain, which will be lossy but may be convenient. the
-; seen configs/polys/regions/etc will still be wrong, so it's not clear how helpful it is,
-; except for stuff like "try something, change the level, go back, try again". which is
-; definitely a useful case! so let's do that.
+; we need to translate all the old configs into the new domain, which will be
+; lossy but may be convenient. the seen configs/polys/regions/etc will still be
+; wrong, so it's not clear how helpful it is, except for stuff like "try
+; something, change the level, go back, try again". which is definitely a useful
+; case! so let's do that.
+
+(defn update-object-vals [old-defs new-defs old-vals new-vals t]
+  (into {}
+        (map
+          (fn [[k v]]
+            (let [v (assoc v :entry-time t)
+                  new-type (.-ha-type v)
+                  old-val (get old-vals k)
+                  old-type (when old-val
+                             (.-ha-type old-val))
+                  old-def (when old-val
+                            (get old-defs old-type))
+                  old-val (when old-val
+                            (ha/extrapolate old-def old-val t))
+                  old-state (when old-val
+                              (.-state old-val))
+                  new-def (get new-defs new-type)
+                  relevant-vals (when old-val
+                                  (select-keys (.-v0 old-val)
+                                               (keys (.-v0 v))))]
+              [k (cond
+                   ; if no old val, leave it alone
+                   (nil? old-val)
+                   v
+                   ; if the old val's state is still valid in the new desc,
+                   ; copy over the state and the v0
+                   (and (= old-type new-type)
+                        (contains? (.-states new-def) old-state))
+                   (assoc v :v0 (merge (.-v0 v) relevant-vals)
+                            :state old-state)
+                   ; if the old val's state is no longer valid or if the
+                   ; type has changed, try to copy over the valuation
+                   :else
+                   (assoc v :v0 (merge (.-v0 v) relevant-vals)))]))
+          new-vals)))
+
+(defn reenter-current-config [w]
+  (let [now (ha/floor-time (:now w) heval/time-unit)
+        defs (:ha-defs w)
+        reenter-config (update
+                         (assoc (current-config w) :entry-time now)
+                         :objects
+                         (fn [os]
+                           (into
+                             {}
+                             (map (fn [[k v]]
+                                    [k (ha/extrapolate (get defs (.-ha-type v))
+                                                       v
+                                                       now)])
+                                  os))))]
+    (if (not= reenter-config (current-config w))
+      (world-append w reenter-config)
+      w)))
+
 (defn world-update-desc [w desc]
-  (let [old-vals (:objects (current-config w))
+  (let [w (reenter-current-config w)
         old-defs (:ha-defs w)
-        now (ha/floor-time (:now w) heval/time-unit)
         new-world (make-world desc)
-        new-world (assoc new-world :now now)
-        new-world (update new-world :configs
-                          (fn [cs] (mapv (fn [c]
-                                           (assoc c :entry-time now))
-                                         cs)))
         new-defs (:ha-defs new-world)
-        new-world (update-in new-world
-                             [:configs 0 :objects]
-                             (fn [objs]
-                               (into {}
-                                     (map
-                                       (fn [[k v]]
-                                         (let [v (assoc v :entry-time now)
-                                               new-type (.-ha-type v)
-                                               old-val (get old-vals k)
-                                               old-type (when old-val
-                                                          (.-ha-type old-val))
-                                               old-def (when old-val
-                                                         (get old-defs old-type))
-                                               old-val (when old-val
-                                                         (ha/extrapolate old-def old-val now))
-                                               old-state (when old-val
-                                                           (.-state old-val))
-                                               new-def (get new-defs new-type)
-                                               relevant-vals (when old-val
-                                                               (select-keys (.-v0 old-val)
-                                                                            (keys (.-v0 v))))]
-                                           [k (cond
-                                                ; if no old val, leave it alone
-                                                (nil? old-val)
-                                                v
-                                                ; if the old val's state is still valid in the new desc,
-                                                ; copy over the state and the v0
-                                                (and (= old-type new-type)
-                                                     (contains? (.-states new-def) old-state))
-                                                (assoc v :v0 (merge (.-v0 v) relevant-vals)
-                                                         :state old-state)
-                                                ; if the old val's state is no longer valid or if the
-                                                ; type has changed, try to copy over the valuation
-                                                :else
-                                                (assoc v :v0 (merge (.-v0 v) relevant-vals)))]))
-                                       objs))))]
-    (update new-world
-            :configs
-            (fn [[c]]
-              [(heval/recache-trs new-defs c)]))))
+        new-vals (:objects (current-config new-world))
+        w (assoc w :ha-defs new-defs
+                   :desc desc
+                   :walls (:walls new-world)
+                   :seen-polys {}
+                   :explored #{}
+                   :seen-configs #{})
+        w (update w
+                  :configs
+                  (fn [cfgs]
+                    (mapv
+                      (fn [{old-vals :objects t :entry-time :as cfg}]
+                        (assoc cfg :objects (update-object-vals old-defs
+                                                                new-defs
+                                                                old-vals
+                                                                new-vals
+                                                                t)
+                                   :tr-caches nil))
+                      cfgs)))]
+    (world-append (update w :configs #(subvec % 0 (dec (count %))))
+                  (heval/recache-trs new-defs (current-config w)))))

 (defn world-update-desc! [desc]
-  (update-world! world (fn [w]
-                         (world-update-desc w desc))))
-
-
+  (update-world! world
+                 (fn [w]
+                   (world-update-desc w desc))))

 (def keycode->keyname
   {37 :left
@@ -831,7 +860,7 @@
                                             (fn [w]
                                               (assoc w :pause-on-change (.-checked (.-target %)))))}]]
                 [:button {:onClick #(reset-world! (:desc @world))} "RESET"]
-                [:button {:onClick #(world-update-desc! (:desc @world))} "KICK"]
+                [:button {:onClick #(world-update-desc! new-world-desc)} "KICK"]
                 [:button {:onClick  #(swap! world
                                             (fn [w]
                                               (let [new-configs (subvec (:configs w) 0 (dec (count (:configs w))))


Env wrap plugin

Env wrap plugin

--- src/com/wsscode/pathom/core.cljc
+++ src/com/wsscode/pathom/core.cljc
@@ -239,6 +239,13 @@
                    (fn [env tx]
                      (parser (merge env extra-env) tx)))})

+(defn env-wrap-plugin [extra-env-wrapper]
+  "This plugin receives a function that will be called to wrap the current
+  enviroment each time the main parser is called (parser level)."
+  {::wrap-parser (fn [parser]
+                   (fn [env tx]
+                     (parser (extra-env-wrapper env) tx)))})
+
 ;; PARSER READER

 (defn wrap-add-path [reader]


target java 7 when compiling broker

target java 7 when compiling broker

Signed-off-by: Chris Hedley <711c73f64afdce07b7e38039a96d2224209e9a6c@cghsystems.net>

--- src/rabbitmq-broker/project.clj
+++ src/rabbitmq-broker/project.clj
@@ -31,7 +31,7 @@
   :source-paths      ["src/clojure"]
   :java-source-paths ["src/java"]
   :resource-paths    ["src/resources"]
-  :javac-options     ["-target" "1.6" "-source" "1.6"]
+  :javac-options     ["-target" "1.7" "-source" "1.7"]
   :main io.pivotal.pcf.rabbitmq.main
   :global-vars {*warn-on-reflection* true}
   :jvm-opts ["-Xmx512m"]


log ex-data for any exception - especially the one biting us right now

--- src/gh_active_issues/service.clj
+++ src/gh_active_issues/service.clj
@@ -3,7 +3,8 @@
               [io.pedestal.service.http.route :as route]
               [io.pedestal.service.http.body-params :as body-params]
               [io.pedestal.service.http.route.definition :refer [defroutes]]
-              [io.pedestal.service.interceptor :refer [defon-response]]
+              [io.pedestal.service.interceptor :refer [definterceptor] :as interceptor]
+              [io.pedestal.service.log :as log]
               [clostache.parser :refer [render-resource]]
               [clojure.data.json :as json]
               [gh-active-issues.util :refer [get-in! get! hex-hmac-sha1]]
@@ -58,9 +59,17 @@
           (update-gh-issues)))))
   {:status 200})

+(definterceptor log-exception-data
+  (interceptor/interceptor
+    :name ::log-exception-info
+    :error (fn [{:keys [servlet-response] :as context} exception]
+             (log/error :exception exception
+                        :msg (str "Unexpected exception within application: " exception)
+                        :exception-data (ex-data exception)))))
+
 (defroutes routes
   [[["/" {:get home-page}
-     ^:interceptors [bootstrap/html-body]
+     ^:interceptors [log-exception-data bootstrap/html-body]
      ["/webhook" {:post webhook-page}]
      ]]])


Added seq implementation and Persistent and Transient Map

--- src/main/cljs/fast_map/core.cljs
+++ src/main/cljs/fast_map/core.cljs
@@ -1,8 +1,13 @@
 (ns cljs.fast-map.core
   (:refer-clojure :exclude [Box ->Box BitmapIndexedNode ->BitmapIndexedNode
                             HashCollisionNode ->HashCollisionNode
+                            PersistentHashMap ->PersistentHashMap
+                            TransientHashMap ->TransientHashMap
+                            NodeSeq ->NodeSeq
                             create-inode-seq create-array-node-seq create-node
                             mask bitmap-indexed-node-index bitpos]))
+
+(declare NodeSeq TransientHashMap PersistentHashMap)

 (deftype Box [^:mutable added ^:mutable modified])

@@ -54,6 +59,9 @@
       (aset dst idx-new node)
       (array-copy arr (+ idx-new 2) dst (inc idx-new) (- (alength arr) idx-new 2))
       (BitmapIndexedNode. e (bit-or datamap bit) (bit-xor nodemap bit) dst)))
+
+  (inode-seq [inode]
+    (NodeSeq. nil arr (* 2 (bit-count datamap)) (bit-count nodemap) 0 nil nil))

   (inode-assoc [inode aedit shift hash key val changed?]
     (let [bit (bitpos hash shift)]
@@ -117,19 +125,174 @@
             (.inode-assoc edit shift key1hash key1 val1 changed?)
             (.inode-assoc edit shift key2hash key2 val2 changed?))))))

+(deftype PersistentHashMap [meta cnt root ^:mutable __hash]
+  Object
+  (toString [coll]
+    (pr-str* coll))
+  (equiv [this other]
+    (-equiv this other))
+
+  ICloneable
+  (-clone [_] (PersistentHashMap. meta cnt root __hash))
+
+  IWithMeta
+  (-with-meta [coll meta] (PersistentHashMap. meta cnt root  __hash))
+
+  IMeta
+  (-meta [coll] meta)
+
+  IEmptyableCollection
+  (-empty [coll] (-with-meta (.-EMPTY PersistentHashMap) meta))
+
+  IEquiv
+  (-equiv [coll other] (equiv-map coll other))
+
+  IHash
+  (-hash [coll] (caching-hash coll hash-unordered-coll __hash))
+
+  ISeqable
+  (-seq [coll]
+    (when (pos? cnt)
+      (.inode-seq root)))
+
+  ICounted
+  (-count [coll] cnt)
+
+  IAssociative
+  (-assoc [coll k v]
+    (let [changed? (Box. false false)
+          new-root    (-> (if (nil? root)
+                            (.-EMPTY BitmapIndexedNode)
+                            root)
+                          (.inode-assoc nil 0 (hash k) k v changed?))]
+      (if (identical? new-root root)
+        coll
+        (PersistentHashMap. meta (if ^boolean (.-added changed?) (inc cnt) cnt) new-root  nil))))
+
+  (-contains-key? [coll k]
+    #_(cond (nil? k)    has-nil?
+          (nil? root) false
+          :else       (not (identical? (.inode-lookup root 0 (hash k) k lookup-sentinel)
+                                       lookup-sentinel))))
+
+
+
+  IEditableCollection
+  (-as-transient [coll]
+    (TransientHashMap. (js-obj) root cnt)))
+
+(set! (.-EMPTY PersistentHashMap) (PersistentHashMap. nil 0 nil empty-unordered-hash))
+
+(deftype TransientHashMap [^:mutable ^boolean edit
+                           ^:mutable root
+                           ^:mutable count]
+  Object
+  #_(conj! [tcoll o]
+    (if edit
+      (if (satisfies? IMapEntry o)
+        (.assoc! tcoll (key o) (val o))
+        (loop [es (seq o) tcoll tcoll]
+          (if-let [e (first es)]
+            (recur (next es)
+                   (.assoc! tcoll (key e) (val e)))
+            tcoll)))
+      (throw (js/Error. "conj! after persistent"))))
+
+  (assoc! [tcoll k v]
+    (if edit
+      (let [changed? (Box. false false)
+            node        (-> (if (nil? root)
+                              (.-EMPTY BitmapIndexedNode)
+                              root)
+                            (.inode-assoc nil edit 0 (hash k) k v changed?))]
+        (if (identical? node root)
+          nil
+          (set! root node))
+        (if ^boolean (.-added changed?)
+          (set! count (inc count)))
+        tcoll)
+      (throw (js/Error. "assoc! after persistent!"))))
+
+  (persistent! [tcoll]
+    (if edit
+      (do (set! edit nil)
+          (PersistentHashMap. nil count root nil))
+      (throw (js/Error. "persistent! called twice"))))
+
+  ICounted
+  (-count [coll]
+    (if edit
+      count
+      (throw (js/Error. "count after persistent!"))))
+
+  ITransientCollection
+  (-conj! [tcoll val] #_(.conj! tcoll val))
+
+  (-persistent! [tcoll] (.persistent! tcoll))
+
+  ITransientAssociative
+  (-assoc! [tcoll key val] (.assoc! tcoll key val)))
+
+(deftype NodeSeq [meta nodes dlen nlen i s ^:mutable __hash]
+  Object
+  (toString [coll]
+    (pr-str* coll))
+  (equiv [this other]
+    (-equiv this other))
+
+  IMeta
+  (-meta [coll] meta)
+
+  IWithMeta
+  (-with-meta [coll meta] (NodeSeq. meta nodes dlen nlen i s __hash))
+
+  ICollection
+  (-conj [coll o] (cons o coll))
+
+  IEmptyableCollection
+  (-empty [coll] (with-meta (.-EMPTY List) meta))
+
+  ISequential
+  ISeq
+  (-first [coll]
+    (if (nil? s)
+      [(aget nodes i) (aget nodes (inc i))]
+      (first s)))
+
+  (-rest [coll]
+    (if (nil? s)
+      (let [len (alength nodes)]
+        (cond
+          (< i dlen)
+          (NodeSeq. meta nodes dlen nlen (+ i 2) nil nil)
+          (and (== i dlen) (not (zero? nlen)))
+          (NodeSeq. meta nodes dlen nlen len (aget nodes len) nil)
+          :else
+          (NodeSeq. meta nodes dlen nlen (dec i) (aget nodes (dec i)) nil)))
+      (NodeSeq. meta nodes dlen nlen i (next s) nil)))
+
+  ISeqable
+  (-seq [this] this)
+
+  IEquiv
+  (-equiv [coll other] (equiv-sequential coll other))
+
+  IHash
+  (-hash [coll] (caching-hash coll hash-ordered-coll __hash))
+
+  IReduce
+  (-reduce [coll f] (seq-reduce f coll))
+  (-reduce [coll f start] (seq-reduce f start coll)))
+
+(extend-protocol IPrintWithWriter
+  PersistentHashMap
+  (-pr-writer [coll writer opts]
+    (print-map coll pr-writer writer opts)))
+
 (comment
-    (let [em (.-EMPTY BitmapIndexedNode)
-          sent (js-obj)]
-      (let [bn1 (.inode-assoc em nil 0 (hash :foo1) :foo1 :bar  (Box. false false))
-            bn2 (.inode-assoc bn1 nil 0 (hash :foo1) :foo1 :not-bar  (Box. false false))
-            bn3 (.inode-assoc bn1 nil 0 (hash :foo2) :foo2 :bar2  (Box. false false))
-            nn1 (.inode-assoc bn3 nil 0 (hash :foo2) :foo3 :split-bar  (Box. false false))]
-        (println "Pesistent Assoc")
-        (println [(.-arr em) (.-arr bn1) (.-arr bn2) (.-arr bn3) (.-arr nn1)
-                  (.-arr (aget (.-arr nn1) 2))]))
-      (let [bn1 (.inode-assoc em nil 0 (hash :foo1) :foo1 :bar  (Box. false false))
-            tbn1 (.inode-assoc bn1 sent 0 (hash :foo1) :foo1 :my-bar  (Box. false false))
-            tbn2 (.inode-assoc tbn1 sent 0 (hash :foo1) :foo1 :another-bar  (Box. false false))
-            tbn3 (.inode-assoc tbn2 sent 0 (hash :foo1) :foo1 :changed  (Box. false false))]
-        (println "Transient Assoc")
-        (println [(.-arr em) (.-arr bn1) (.-arr tbn1) (.-arr tbn2) (.-arr tbn3)])) ))+    (let [em (.-EMPTY PersistentHashMap)
+          hm1 (loop [m em i 0]
+                (if (< i 50)
+                  (recur (assoc m (str "key" i) i) (inc i))
+                  m))]
+      (println hm1)))


(maint) fix max-framesize in import-export-rt-test

this was left as a string after a rollup -- needs to be an int.

--- test/puppetlabs/puppetdb/cli/import_export_roundtrip_test.clj
+++ test/puppetlabs/puppetdb/cli/import_export_roundtrip_test.clj
@@ -93,7 +93,7 @@
 (deftest test-max-frame-size
   (svc-utils/call-with-single-quiet-pdb-instance
    (-> (svc-utils/create-config)
-       (assoc-in [:command-processing :max-frame-size] "1024"))
+       (assoc-in [:command-processing :max-frame-size] 1024))
    (fn []
      (is (empty? (get-nodes)))


Revert "(SERVER-2532) Work around non-reloadable transport schemas"

This reverts commit ba356a85d31ee4027bf8b5a413f886c984ec5056.

--- test/integration/puppetlabs/services/master/environment_transports_int_test.clj
+++ test/integration/puppetlabs/services/master/environment_transports_int_test.clj
@@ -46,6 +46,7 @@
 (def schema1-serialized
   {:name "test_device"
    :desc "Connects to a device"
+   :connection_info_order ["username" "variant_secret"]
    :connection_info
    {:username
     {:type "String"
@@ -77,6 +78,7 @@
 (def schema2-serialized
   {:name "another_device"
    :desc "Connects to a network device"
+   :connection_info_order ["username" "secret"]
    :connection_info
    {:username
     {:type "String"
@@ -86,36 +88,6 @@
      :desc "A secret to protect."
      :sensitive true}}})

-(defn create-jruby-instance-with-mock-transports-info
-  ([transports-info-atom config]
-   (create-jruby-instance-with-mock-transports-info
-     (atom {:wait-promise (promise)
-            :continue-promise (-> (promise) (deliver true))})
-     transports-info-atom
-     config))
-  ([wait-atom transports-info-atom config]
-   (let [puppet-config (jruby-testutils/mock-puppet-config-settings
-                        (:jruby-puppet config))]
-     (reify JRubyPuppet
-       (getSetting [_ setting]
-         (get puppet-config setting))
-       (getClassInfoForEnvironment [_ _]
-         (let [class-info {"/some/file" {"classes" "foo"}}]
-           class-info))
-       (getTransportInfoForEnvironment [_ _]
-         (let [a (ArrayList.)]
-           (doseq [t @transports-info-atom]
-             (.add a t))
-           (when-let [promises @wait-atom]
-             (deliver (:wait-promise promises) true)
-             @(:continue-promise promises))
-           a))
-       (handleRequest [_ _]
-         (JRubyPuppetResponse. 0 nil nil nil))
-       (puppetVersion [_]
-         "1.2.3")
-       (terminate [_]
-         (log/info "Terminating Master"))))))

 (defn make-module
   ([] (make-module "production"))
@@ -205,369 +177,313 @@

 (deftest ^:integration environment-transports-integration-cache-disabled-test
   (testing "when environment cache is disabled for a transport request"
-    (let [transports-info-atom (atom [(walk/stringify-keys schema1-serialized)])
-          config (bootstrap/load-dev-config-with-overrides
-                  {:jruby-puppet {:gem-path gem-path
-                                  :max-active-instances 1
-                                  :environment-class-cache-enabled false}})
-          mock-jruby-fn (partial create-jruby-instance-with-mock-transports-info
-                                 transports-info-atom)
-          expected-response {:name "production" :transports [schema1-serialized]}]
-      (tk-bootstrap-testutils/with-app-with-config
-       app
-       (bootstrap/services-from-dev-bootstrap-plus-mock-jruby-pool-manager-service
-        config
-        mock-jruby-fn)
-       config
-       (let [response (get-env-transports "production")]
-         (testing "a successful status code is returned"
-           (is (= 200 (:status response))
-               (str
-                "unexpected status code for response, response: "
-                (ks/pprint-to-string response))))
-         (testing "no etag is returned"
-           (is (false? (contains? (:headers response) "etag"))))
-         (testing "the expected response body is returned"
-           (is (= expected-response
-                  (response->map response)))))))))
+    (bootstrap/with-puppetserver-running-with-config
+     app
+     (-> {:jruby-puppet {:gem-path gem-path
+                         :max-active-instances 1}}
+         (bootstrap/load-dev-config-with-overrides)
+         (ks/dissoc-in [:jruby-puppet
+                        :environment-class-cache-enabled]))
+     (let [_ (make-module)
+           expected-response {:name "production" :transports [schema1-serialized]}
+           response (get-env-transports "production")]
+       (testing "a successful status code is returned"
+         (is (= 200 (:status response))
+             (str
+              "unexpected status code for response, response: "
+              (ks/pprint-to-string response))))
+       (testing "no etag is returned"
+         (is (false? (contains? (:headers response) "etag"))))
+       (testing "the expected response body is returned"
+         (is (= expected-response
+                (response->map response))))))))

 (deftest ^:integration environment-transports-integration-cache-enabled-test1
-  (let [transports-info-atom (atom [(walk/stringify-keys schema1-serialized)])
-        config (bootstrap/load-dev-config-with-overrides
-                {:jruby-puppet {:gem-path gem-path
-                                :max-active-instances 1
-                                :environment-class-cache-enabled true}})
-        mock-jruby-fn (partial create-jruby-instance-with-mock-transports-info
-                               transports-info-atom)]
-    (tk-bootstrap-testutils/with-app-with-config
-     app
-     (bootstrap/services-from-dev-bootstrap-plus-mock-jruby-pool-manager-service
-      config
-      mock-jruby-fn)
-     config
-     (testing "environment transport cache invalidation for one environment"
-       ;; This test is about ensuring that when the environment-cache
-       ;; endpoint is hit for a single environment that only that the
-       ;; environment class info cached for that environment - but not the
-       ;; info cached for other environments - is invalidated, meaning that
-       ;; the next request for class info for that environment will get fresh
-       ;; data.
-       ;;
-       ;; The test has the following basic steps:
-       ;;
-       ;; 1) Purge the current environment files on disk and hit the
-       ;;    environment-cache endpoint to flush the cache for all
-       ;;    environments, basically to ensure nothing is left around from
-       ;;    other tests.
-       ;; 2) Populate code for the 'test' and 'production' environments and
-       ;;    see that environment_transports queries return the right info for
-       ;;    them.
-       ;; 3) Do one more environment_transports query for each environment,
-       ;;    using the etag from the initial queries, to ensure that a 304
-       ;;    (Not Modified) is returned.
-       ;; 4) Change code on disk for both the 'test' and 'production'
-       ;;    environments.
-       ;; 5) Hit the environment-cache endpoint for the 'production'
-       ;;    environment (but not for the 'test' environment).
-       ;; 6) Do two more environment_transports queries for the 'test' and
-       ;;    'production' environments using the etags from the initial
-       ;;    queries.  Confirm that the information reflects the latest data on
-       ;;    disk for the 'production' environment but still reflects the old
-       ;;    data for the 'test' environment - expected, in this case, because
-       ;;    the 'test' environment was not flushed.
-       (purge-env-dir)
-       (purge-all-env-caches)
-       (let [;; prod-schema-dir (make-module)
-             ;; test-schema-dir (make-module "test")
-             production-response-initial (get-env-transports "production")
-             production-etag-initial (response-etag production-response-initial)
-             production-etag-initial-without-gzip-suffix (etag-without-gzip-suffix production-etag-initial)
-             test-response-initial (get-env-transports "test")
-             test-etag-initial (response-etag test-response-initial)
-             test-etag-initial-without-gzip-suffix (etag-without-gzip-suffix
-                                                     (response-etag test-response-initial))]
-         (is (= 200 (:status production-response-initial))
-             (str
-              "unexpected status code for initial production response"
-              "response: "
-              (ks/pprint-to-string production-response-initial)))
-         (is (not (nil? production-etag-initial))
-             "no etag returned for production response")
-         (is (= {:name "production" :transports [schema1-serialized]}
-                (response->map production-response-initial))
+  (bootstrap/with-puppetserver-running app
+   {:jruby-puppet {:gem-path gem-path
+                   :max-active-instances 1
+                   :environment-class-cache-enabled true}}
+   (testing "environment transport cache invalidation for one environment"
+     ;; This test is about ensuring that when the environment-cache
+     ;; endpoint is hit for a single environment that only that the
+     ;; environment class info cached for that environment - but not the
+     ;; info cached for other environments - is invalidated, meaning that
+     ;; the next request for class info for that environment will get fresh
+     ;; data.
+     ;;
+     ;; The test has the following basic steps:
+     ;;
+     ;; 1) Purge the current environment files on disk and hit the
+     ;;    environment-cache endpoint to flush the cache for all
+     ;;    environments, basically to ensure nothing is left around from
+     ;;    other tests.
+     ;; 2) Populate code for the 'test' and 'production' environments and
+     ;;    see that environment_transports queries return the right info for
+     ;;    them.
+     ;; 3) Do one more environment_transports query for each environment,
+     ;;    using the etag from the initial queries, to ensure that a 304
+     ;;    (Not Modified) is returned.
+     ;; 4) Change code on disk for both the 'test' and 'production'
+     ;;    environments.
+     ;; 5) Hit the environment-cache endpoint for the 'production'
+     ;;    environment (but not for the 'test' environment).
+     ;; 6) Do two more environment_transports queries for the 'test' and
+     ;;    'production' environments using the etags from the initial
+     ;;    queries.  Confirm that the information reflects the latest data on
+     ;;    disk for the 'production' environment but still reflects the old
+     ;;    data for the 'test' environment - expected, in this case, because
+     ;;    the 'test' environment was not flushed.
+     (purge-env-dir)
+     (purge-all-env-caches)
+     (let [prod-schema-dir (make-module) ;; should this have different content then above?
+           test-schema-dir (make-module "test")
+           production-response-initial (get-env-transports "production")
+           production-etag-initial (response-etag production-response-initial)
+           production-etag-initial-without-gzip-suffix (etag-without-gzip-suffix production-etag-initial)
+           test-response-initial (get-env-transports "test")
+           test-etag-initial (response-etag test-response-initial)
+           test-etag-initial-without-gzip-suffix (etag-without-gzip-suffix
+                                                   (response-etag test-response-initial))]
+       (is (= 200 (:status production-response-initial))
+           (str
+            "unexpected status code for initial production response"
+            "response: "
+            (ks/pprint-to-string production-response-initial)))
+       (is (not (nil? production-etag-initial))
+           "no etag returned for production response")
+       (is (= {:name "production" :transports [schema1-serialized]}
+              (response->map production-response-initial))
+           "unexpected body for production response")
+       (is (= 200 (:status test-response-initial))
+           (str
+            "unexpected status code for initial test response"
+            "response: "
+            (ks/pprint-to-string test-response-initial)))
+       (is (not (nil? test-etag-initial))
+           "no etag returned for test response")
+       (is (= {:name "test" :transports [schema1-serialized]}
+              (response->map test-response-initial))
+           "unexpected body for test response")
+
+       (spit (str prod-schema-dir "/test_device.rb") schema2)
+       (spit (str test-schema-dir "/test_device.rb") schema2)
+
+       (let [production-response-before-flush (get-env-transports
+                                               "production"
+                                               production-etag-initial)
+             test-response-before-flush (get-env-transports
+                                         "test"
+                                         test-etag-initial)]
+         (is (= 304 (:status production-response-before-flush))
+             (str
+              "unexpected status code for prod response after code change "
+              "but before flush"))
+         (is (= production-etag-initial-without-gzip-suffix (response-etag
+                                                              production-response-before-flush))
+             "unexpected etag change when no production environment change")
+         (is (empty? (:body production-response-before-flush))
              "unexpected body for production response")
-         (is (= 200 (:status test-response-initial))
-             (str
-              "unexpected status code for initial test response"
-              "response: "
-              (ks/pprint-to-string test-response-initial)))
-         (is (not (nil? test-etag-initial))
-             "no etag returned for test response")
-         (is (= {:name "test" :transports [schema1-serialized]}
-                (response->map test-response-initial))
-             "unexpected body for test response")
-
-         ;; (spit (str prod-schema-dir "/test_device.rb") schema2)
-         ;; (spit (str test-schema-dir "/test_device.rb") schema2)
-         (reset! transports-info-atom [(walk/stringify-keys schema2-serialized)])
-
-         (let [production-response-before-flush (get-env-transports
-                                                 "production"
-                                                 production-etag-initial)
-               test-response-before-flush (get-env-transports
-                                           "test"
-                                           test-etag-initial)]
-           (is (= 304 (:status production-response-before-flush))
+         (is (= 304 (:status test-response-before-flush))
+             (str
+              "unexpected status code for test response after code change "
+              "but before flush"))
+         (is (= test-etag-initial-without-gzip-suffix (response-etag
+                                                        test-response-before-flush))
+             "unexpected etag change when no test environment change")
+         (is (empty? (:body test-response-before-flush))
+             "unexpected body for test response"))
+
+         (purge-env-cache "production")
+         (let [production-response-after-prod-flush (get-env-transports
+                                                     "production"
+                                                     production-etag-initial)
+               production-etag-after-prod-flush (response-etag
+                                                 production-response-after-prod-flush)
+               test-response-after-prod-flush (get-env-transports
+                                               "test"
+                                               test-etag-initial)]
+           (is (= 200 (:status production-response-after-prod-flush))
                (str
                 "unexpected status code for prod response after code change "
-                "but before flush"))
-           (is (= production-etag-initial-without-gzip-suffix (response-etag
-                                                                production-response-before-flush))
-               "unexpected etag change when no production environment change")
-           (is (empty? (:body production-response-before-flush))
-               "unexpected body for production response")
-           (is (= 304 (:status test-response-before-flush))
-               (str
-                "unexpected status code for test response after code change "
-                "but before flush"))
-           (is (= test-etag-initial-without-gzip-suffix (response-etag
-                                                          test-response-before-flush))
-               "unexpected etag change when no test environment change")
-           (is (empty? (:body test-response-before-flush))
-               "unexpected body for test response"))
-
-           (purge-env-cache "production")
-           (let [production-response-after-prod-flush (get-env-transports
-                                                       "production"
-                                                       production-etag-initial)
-                 production-etag-after-prod-flush (response-etag
-                                                   production-response-after-prod-flush)
-                 test-response-after-prod-flush (get-env-transports
-                                                 "test"
-                                                 test-etag-initial)]
-             (is (= 200 (:status production-response-after-prod-flush))
-                 (str
-                  "unexpected status code for prod response after code change "
-                  "and prod flush"))
-             (is (not (nil? production-etag-after-prod-flush))
-                 "no etag returned for production response")
-             (is (not= production-etag-initial
-                       production-etag-after-prod-flush)
-                 (str
-                  "etag unexpectedly stayed the same even though "
-                  "the production environment changed"))
-             (is (= {:name "production" :transports [schema2-serialized]}
-                    (response->map
-                     production-response-after-prod-flush))
-                 "unexpected body for production response")
-             (is (= 304 (:status test-response-after-prod-flush)))
-             (is (= test-etag-initial-without-gzip-suffix (response-etag
-                                                            test-response-after-prod-flush))
-                 "unexpected etag change when test environment not invalidated")
-             (is (empty? (:body test-response-after-prod-flush))
-                 "unexpected body for test response")))))))
-
-
-(deftest ^:integration environment-transports-integration-cache-enabled-test2
-  (let [transports-info-atom (atom [(walk/stringify-keys schema1-serialized)])
-        config (bootstrap/load-dev-config-with-overrides
-                {:jruby-puppet {:gem-path gem-path
-                                :max-active-instances 1
-                                :environment-class-cache-enabled true}})
-        mock-jruby-fn (partial create-jruby-instance-with-mock-transports-info
-                               transports-info-atom)]
-    (tk-bootstrap-testutils/with-app-with-config
-     app
-     (bootstrap/services-from-dev-bootstrap-plus-mock-jruby-pool-manager-service
-      config
-      mock-jruby-fn)
-     config
-     (let [;; schema-dir (make-module)
-           expected-initial-response {:name "production" :transports [schema1-serialized]}
-           initial-response (get-env-transports "production")
-           initial-etag (response-etag initial-response)
-           initial-etag-with-gzip-suffix (etag-with-gzip-suffix initial-etag)
-           initial-etag-without-gzip-suffix (etag-without-gzip-suffix initial-etag)]
-       (testing "initial fetch of environment_transports info is good"
-         (is (= 200 (:status initial-response))
-             (str
-              "unexpected status code for initial response, response: "
-              (ks/pprint-to-string initial-response)))
-         (is (not (nil? initial-etag))
-             "no etag found for initial response")
-         (is (= expected-initial-response
-                (response->map initial-response))
-             "unexpected body for initial response"))
-       (testing "etag not updated when code has not changed"
-         (let [response (get-env-transports "production")]
-           (is (= 200 (:status response))
-               "unexpected status code for response following no code change")
-           (is (= initial-etag (response-etag response))
-               "etag changed even though code did not")
-           (is (= expected-initial-response
-                  (response->map response))
-               "unexpected body for response")))
-       (testing (str "HTTP 304 (not modified) returned when request "
-                     "roundtrips last etag and code has not changed")
-         (let [response (get-env-transports "production" initial-etag)]
-           (is (= 304 (:status response))
-               (str
-                "unexpected status code for response for no code change and "
-                "original etag roundtripped"))
-           (is (= initial-etag-without-gzip-suffix (response-etag response))
-               "etag changed even though code did not")
-           (is (empty? (:body response))
-               "unexpected body for response")))
-       (testing (str "SERVER-1153 - HTTP 304 (not modified) returned when "
-                     "request roundtrips last etag with '--gzip' suffix and "
-                     "code has not changed")
-         (let [response (get-env-transports "production"
-                                            initial-etag-with-gzip-suffix)]
-           (is (= 304 (:status response))
-               (str
-                "unexpected status code for response for no code change and "
-                "etag with '--gzip' suffix roundtripped"))
-           (is (= initial-etag-without-gzip-suffix (response-etag response))
-               "etag changed even though code did not")
-           (is (empty? (:body response))
-               "unexpected body for response")))
-       (testing (str "environment_transport fetch without if-none-match "
-                     "header includes latest info after code update")
-         (let [;; _ (spit (str schema-dir "/test_device.rb") schema2)
-               _ (reset! transports-info-atom [(walk/stringify-keys schema2-serialized)])
-               _ (purge-all-env-caches)
-               response (get-env-transports "production")]
-           (is (= 200 (:status response))
-               (str
-                "unexpected status code for response following code change,"
-                "response: "
-                (ks/pprint-to-string response)))
-           (is (not= initial-etag (response-etag response))
-               "etag did not change even though code did")
-           (is (= {:name "production" :transports [schema2-serialized]}
-                  (response->map response))
-               "unexpected body following code change")))))))
-
-
-(deftest ^:integration environment-transports-integration-cache-enabled-test3
-  (let [transports-info-atom (atom [(walk/stringify-keys schema1-serialized)])
-        config (bootstrap/load-dev-config-with-overrides
-                {:jruby-puppet {:gem-path gem-path
-                                :max-active-instances 1
-                                :environment-class-cache-enabled true}})
-        mock-jruby-fn (partial create-jruby-instance-with-mock-transports-info
-                               transports-info-atom)]
-    (tk-bootstrap-testutils/with-app-with-config
-     app
-     (bootstrap/services-from-dev-bootstrap-plus-mock-jruby-pool-manager-service
-      config
-      mock-jruby-fn)
-     config
-     (testing "environment transports cache invalidation for all environments"
-       ;; This test is about ensuring that when the environment-cache
-       ;; endpoint is hit with no environment parameter that any previously
-       ;; cached environment class info is invalidated, meaning that
-       ;; the next request for class info for all environments will get fresh
-       ;; data.
-       ;;
-       ;; To eliminate some of the redundancy between tests, this test doesn't
-       ;; repeat the intermediate step of checking to see that the first two
-       ;; environment queries were cached - 304 (Not Modified) returns -
-       ;; between the first set of environment_transports queries and the second
-       ;; set, done after the code on disk for both environments has changed.
-       ;;
-       ;; The test has the following basic steps:
-       ;;
-       ;; 1) Purge the current environment files on disk and hit the
-       ;;    environment-cache endpoint to flush the cache for all
-       ;;    environments, basically to ensure nothing is left around from
-       ;;    other tests.
-       ;; 2) Populate code for the 'test' and 'production' environments and
-       ;;    see that environment_transports queries return the right info for
-       ;;    them.
-       ;; 3) Change code on disk for both the 'test' and 'production'
-       ;;    environments.
-       ;; 4) Hit the environment-cache endpoint with no environment
-       ;;    parameter, expected to have the effect of flushing the cache for
-       ;;    all environments.
-       ;; 5) Do two more environment_transports queries for the 'test' and
-       ;;    'production' environments with the corresponding etags returned
-       ;;    from the first two queries.  Confirm that the information
-       ;;    reflects the latest data on disk for both environments.
-       (purge-env-dir)
-       (purge-all-env-caches)
-       (let [;; prod-schema-dir (make-module)
-             ;; test-schema-dir (make-module "test")
-             production-response-initial (get-env-transports "production")
-             production-etag-initial (response-etag production-response-initial)
-             test-response-initial (get-env-transports "test")
-             test-etag-initial (response-etag test-response-initial)]
-         (is (= 200 (:status production-response-initial))
-             (str
-              "unexpected status code for initial production response"
-              "response: "
-              (ks/pprint-to-string production-response-initial)))
-         (is (not (nil? production-etag-initial))
-             "no etag returned for production response")
-         (is (= {:name "production" :transports [schema1-serialized]}
-                (response->map production-response-initial))
-             "unexpected body for production response")
-         (is (= 200 (:status test-response-initial))
-             (str
-              "unexpected status code for initial test response"
-              "response: "
-              (ks/pprint-to-string test-response-initial)))
-         (is (not (nil? test-etag-initial))
-             "no etag returned for test response")
-         (is (= {:name "test" :transports [schema1-serialized]}
-                (response->map test-response-initial))
-             "unexpected body for test response")
-
-         ;; (spit (str prod-schema-dir "/test_device.rb") schema2)
-         ;; (spit (str test-schema-dir "/test_device.rb") schema2)
-         (reset! transports-info-atom [(walk/stringify-keys schema2-serialized)])
-         (purge-all-env-caches)
-
-         (let [production-response-after-all-flush (get-env-transports
-                                                    "production"
-                                                    production-etag-initial)
-               production-etag-after-all-flush (response-etag
-                                                production-response-after-all-flush)]
-           (is (= 200 (:status production-response-after-all-flush))
-               (str
-                "unexpected status code for prod response after code change "
-                "and all environment flush"))
-           (is (not (nil? production-etag-after-all-flush))
+                "and prod flush"))
+           (is (not (nil? production-etag-after-prod-flush))
                "no etag returned for production response")
-           (is (not= production-etag-initial production-etag-after-all-flush)
+           (is (not= production-etag-initial
+                     production-etag-after-prod-flush)
                (str
                 "etag unexpectedly stayed the same even though "
-                "the production environment changed"))
-           (is (= {:name "production" :transports [schema2-serialized]}
-                  (response->map
-                   production-response-after-all-flush))
-               "unexpected body for production response"))
-
-         (let [test-response-after-all-flush (get-env-transports
-                                              "test"
-                                              test-etag-initial)
-               test-etag-after-all-flush (response-etag
-                                          test-response-after-all-flush)]
-           (is (= 200 (:status test-response-after-all-flush))
-               (str
-                "unexpected status code for test response after code change "
-                "and all environment flush"))
-           (is (not (nil? test-etag-after-all-flush))
-               "no etag returned for test response")
-           (is (not= test-etag-initial test-etag-after-all-flush)
-               (str
-                "etag unexpectedly stayed the same even though "
-                "the test environment changed"))
-           (is (= {:name "test" :transports [schema2-serialized]}
-                  (response->map
-                   test-response-after-all-flush))
-               "unexpected body for test response")))))))
+                "the production environment changed")))))))
+
+
+(deftest ^:integration environment-transports-integration-cache-enabled-test2
+  (bootstrap/with-puppetserver-running app
+   {:jruby-puppet {:gem-path gem-path
+                   :max-active-instances 1
+                   :environment-class-cache-enabled true}}
+   (let [schema-dir (make-module)
+         expected-initial-response {:name "production" :transports [schema1-serialized]}
+         initial-response (get-env-transports "production")
+         initial-etag (response-etag initial-response)
+         initial-etag-with-gzip-suffix (etag-with-gzip-suffix initial-etag)
+         initial-etag-without-gzip-suffix (etag-without-gzip-suffix initial-etag)]
+     (testing "initial fetch of environment_transports info is good"
+       (is (= 200 (:status initial-response))
+           (str
+            "unexpected status code for initial response, response: "
+            (ks/pprint-to-string initial-response)))
+       (is (not (nil? initial-etag))
+           "no etag found for initial response")
+       (is (= expected-initial-response
+              (response->map initial-response))
+           "unexpected body for initial response"))
+     (testing "etag not updated when code has not changed"
+       (let [response (get-env-transports "production")]
+         (is (= 200 (:status response))
+             "unexpected status code for response following no code change")
+         (is (= initial-etag (response-etag response))
+             "etag changed even though code did not")
+         (is (= expected-initial-response
+                (response->map response))
+             "unexpected body for response")))
+     (testing (str "HTTP 304 (not modified) returned when request "
+                   "roundtrips last etag and code has not changed")
+       (let [response (get-env-transports "production" initial-etag)]
+         (is (= 304 (:status response))
+             (str
+              "unexpected status code for response for no code change and "
+              "original etag roundtripped"))
+         (is (= initial-etag-without-gzip-suffix (response-etag response))
+             "etag changed even though code did not")
+         (is (empty? (:body response))
+             "unexpected body for response")))
+     (testing (str "SERVER-1153 - HTTP 304 (not modified) returned when "
+                   "request roundtrips last etag with '--gzip' suffix and "
+                   "code has not changed")
+       (let [response (get-env-transports "production"
+                                       initial-etag-with-gzip-suffix)]
+         (is (= 304 (:status response))
+             (str
+              "unexpected status code for response for no code change and "
+              "etag with '--gzip' suffix roundtripped"))
+         (is (= initial-etag-without-gzip-suffix (response-etag response))
+             "etag changed even though code did not")
+         (is (empty? (:body response))
+             "unexpected body for response")))
+     (testing (str "environment_transport fetch without if-none-match "
+                   "header includes latest info after code update")
+       (let [_ (spit (str schema-dir "/test_device.rb") schema2)
+             _ (purge-all-env-caches)
+             response (get-env-transports "production")]
+         (is (= 200 (:status response))
+             (str
+              "unexpected status code for response following code change,"
+              "response: "
+              (ks/pprint-to-string response)))
+         (is (not= initial-etag (response-etag response))
+             "etag did not change even though code did"))))))
+
+
+(deftest ^:integration environment-transports-integration-cache-enabled-test3
+  (bootstrap/with-puppetserver-running app
+   {:jruby-puppet {:gem-path gem-path
+                   :max-active-instances 1
+                   :environment-class-cache-enabled true}}
+   (testing "environment transports cache invalidation for all environments"
+     ;; This test is about ensuring that when the environment-cache
+     ;; endpoint is hit with no environment parameter that any previously
+     ;; cached environment class info is invalidated, meaning that
+     ;; the next request for class info for all environments will get fresh
+     ;; data.
+     ;;
+     ;; To eliminate some of the redundancy between tests, this test doesn't
+     ;; repeat the intermediate step of checking to see that the first two
+     ;; environment queries were cached - 304 (Not Modified) returns -
+     ;; between the first set of environment_transports queries and the second
+     ;; set, done after the code on disk for both environments has changed.
+     ;;
+     ;; The test has the following basic steps:
+     ;;
+     ;; 1) Purge the current environment files on disk and hit the
+     ;;    environment-cache endpoint to flush the cache for all
+     ;;    environments, basically to ensure nothing is left around from
+     ;;    other tests.
+     ;; 2) Populate code for the 'test' and 'production' environments and
+     ;;    see that environment_transports queries return the right info for
+     ;;    them.
+     ;; 3) Change code on disk for both the 'test' and 'production'
+     ;;    environments.
+     ;; 4) Hit the environment-cache endpoint with no environment
+     ;;    parameter, expected to have the effect of flushing the cache for
+     ;;    all environments.
+     ;; 5) Do two more environment_transports queries for the 'test' and
+     ;;    'production' environments with the corresponding etags returned
+     ;;    from the first two queries.  Confirm that the information
+     ;;    reflects the latest data on disk for both environments.
+     (purge-env-dir)
+     (purge-all-env-caches)
+     (let [prod-schema-dir (make-module)
+           test-schema-dir (make-module "test")
+           production-response-initial (get-env-transports "production")
+           production-etag-initial (response-etag production-response-initial)
+           test-response-initial (get-env-transports "test")
+           test-etag-initial (response-etag test-response-initial)]
+       (is (= 200 (:status production-response-initial))
+           (str
+            "unexpected status code for initial production response"
+            "response: "
+            (ks/pprint-to-string production-response-initial)))
+       (is (not (nil? production-etag-initial))
+           "no etag returned for production response")
+       (is (= {:name "production" :transports [schema1-serialized]}
+              (response->map production-response-initial))
+           "unexpected body for production response")
+       (is (= 200 (:status test-response-initial))
+           (str
+            "unexpected status code for initial test response"
+            "response: "
+            (ks/pprint-to-string test-response-initial)))
+       (is (not (nil? test-etag-initial))
+           "no etag returned for test response")
+       (is (= {:name "test" :transports [schema1-serialized]}
+              (response->map test-response-initial))
+           "unexpected body for test response")
+
+       (spit (str prod-schema-dir "/test_device.rb") schema2)
+       (spit (str test-schema-dir "/test_device.rb") schema2)
+       (purge-all-env-caches)
+
+       (let [production-response-after-all-flush (get-env-transports
+                                                  "production"
+                                                  production-etag-initial)
+             production-etag-after-all-flush (response-etag
+                                              production-response-after-all-flush)]
+         (is (= 200 (:status production-response-after-all-flush))
+             (str
+              "unexpected status code for prod response after code change "
+              "and all environment flush"))
+         (is (not (nil? production-etag-after-all-flush))
+             "no etag returned for production response")
+         (is (not= production-etag-initial production-etag-after-all-flush)
+             (str
+              "etag unexpectedly stayed the same even though "
+              "the production environment changed")))
+
+       (let [test-response-after-all-flush (get-env-transports
+                                            "test"
+                                            test-etag-initial)
+             test-etag-after-all-flush (response-etag
+                                        test-response-after-all-flush)]
+         (is (= 200 (:status test-response-after-all-flush))
+             (str
+              "unexpected status code for test response after code change "
+              "and all environment flush"))
+         (is (not (nil? test-etag-after-all-flush))
+             "no etag returned for test response")
+         (is (not= test-etag-initial test-etag-after-all-flush)
+             (str
+              "etag unexpectedly stayed the same even though "
+              "the test environment changed")))))))

 (deftest ^:integration
          not-modified-returned-for-environment-transports-info-request-with-gzip-tag
@@ -611,8 +527,32 @@
          (is (= expected-etag (response-etag response-with-tag))
              "unexpected etag returned for request with prior etag"))))))

+(defn create-jruby-instance-with-mock-transports-info
+  [wait-atom transports-info-atom config]
+  (let [puppet-config (jruby-testutils/mock-puppet-config-settings
+                       (:jruby-puppet config))]
+    (reify JRubyPuppet
+      (getSetting [_ setting]
+        (get puppet-config setting))
+      (getClassInfoForEnvironment [_ _]
+        (let [class-info {"/some/file" {"classes" "foo"}}]
+          class-info))
+      (getTransportInfoForEnvironment [_ _]
+        (let [a (ArrayList.)]
+          (.add a @transports-info-atom)
+          (when-let [promises @wait-atom]
+            (deliver (:wait-promise promises) true)
+            @(:continue-promise promises))
+          a))
+      (handleRequest [_ _]
+        (JRubyPuppetResponse. 0 nil nil nil))
+      (puppetVersion [_]
+        "1.2.3")
+      (terminate [_]
+        (log/info "Terminating Master")))))
+
 (deftest ^:integration transports-info-updated-after-cache-flush-during-prior-request
-  (let [transports-info-atom (atom [{:name "transport1"}])
+  (let [transports-info-atom (atom {:name "transport1"})
         wait-atom (atom nil)
         config (bootstrap/load-dev-config-with-overrides
                 {:jruby-puppet {:gem-path gem-path
@@ -638,7 +578,7 @@
        (is (true? (deref wait-promise 10000 :timed-out))
            (str "timed out waiting for get transports info call to be reached "
                 "in mock jrubypuppet instance"))
-       (reset! transports-info-atom [{:name "transport2"}])
+       (reset! transports-info-atom {:name "transport2"})
        (purge-env-cache "production")
        (deliver continue-promise true)
        (let [initial-response @initial-response-future


lein-release plugin: bumped version from 0.4.10 to 0.4.11-SNAPSHOT for next development cycle

--- re_view/project.clj
+++ re_view/project.clj
@@ -1,4 +1,4 @@
-(defproject re-view "0.4.10"
+(defproject re-view "0.4.11-SNAPSHOT"
   :description "ClojureScript React Library"
   :url "https://www.github.com/braintripping/re-view/tree/master/re_view"
   :license {:name "Eclipse Public License"


Update docs to reflect predict is returning score not probability.

--- project/analyze-data/src/analyze_data/naive_bayes/predict.clj
+++ project/analyze-data/src/analyze_data/naive_bayes/predict.clj
@@ -6,8 +6,8 @@
    x: vector of term weights representing a document

   Return a sequence of the form
-  [[most-likely-label        probability]
-   [second-most-likely-label probability]
+  [[most-likely-label        score]
+   [second-most-likely-label score]
    ...]"
   [model x]
   (let [{:keys [log-phi log-phi-y]} model


SimpleDateFormat is not thread safe (WHAT?!?) so don't def it globally

--- src/subrosa/plugins/logging.clj
+++ src/subrosa/plugins/logging.clj
@@ -8,14 +8,11 @@

 (def io-agent (agent nil))

-(def time-formatter (SimpleDateFormat. "HH:mm:ss"))
-(def date-formatter (SimpleDateFormat. "yyyy-MM-dd"))
-
 (defn format-date []
-  (.format date-formatter (Date.)))
+  (.format (SimpleDateFormat. "yyyy-MM-dd") (Date.)))

 (defn format-time []
-  (.format time-formatter (Date.)))
+  (.format (SimpleDateFormat. "HH:mm:ss") (Date.)))

 (defn get-log-name [room-name]
   (let [log-dir (File. (System/getProperty "user.dir")


define  spec of extract

define  spec of extract

--- src/synthesis_crawlers/core.clj
+++ src/synthesis_crawlers/core.clj
@@ -26,10 +26,12 @@
   (:body @(http/get url)))

 (s/def ::text string?)
-(s/def ::extractors (s/coll-of seq?))
+(s/def ::container-extractor string?)
+(s/def ::attr-extractor (s/map-of keyword? string?))
+(s/def ::extractors (s/map-of ::container-extractor ::attr-extractor))
 (s/fdef extract
-       :args (s/cat :text ::text :extractors ::extractors))
-
+  :args (s/cat :text ::text :extractors ::extractors)
+  :ret (s/map-of keyword? set?))
 (defn extract
   [text extractors]
   (let [root (Jsoup/parse text)


make closure warnings/errors a tiny bit prettier

--- src/main/shadow/cljs/closure.clj
+++ src/main/shadow/cljs/closure.clj
@@ -162,7 +162,7 @@
   (when-some [data (read-variable-map state "closure.variable.map")]
     (.setInputVariableMap co data)))

-(defn js-error-xf [state ^com.google.javascript.jscomp.Compiler cc]
+(defn js-error-xf [{:keys [public-dir] :as state} ^com.google.javascript.jscomp.Compiler cc]
   (comp
     ;; remove some annoying UNDECLARED_VARIABLES in cljs/core.cljs
     ;; these are only used in self-hosted but I don't want to provide externs for them in browser builds
@@ -187,17 +187,38 @@
               (.getCharno err)

               mapping
-              (.getSourceMapping cc source-name line column)]
+              (.getSourceMapping cc source-name line column)
+
+              src
+              (when mapping
+                (let [src-name (.getOriginalFile mapping)]
+                  (get-in state [:sources src-name])))]
+
+          (doto sb
+            (.append (.-description err))
+            (.append "\n"))
+
+          (.append sb "Original: ")

           (when mapping
-            (doto sb
-              (.append (.getOriginalFile mapping))
-              (.append "[")
-              (.append (.getLineNumber mapping))
-              (.append ":")
-              (.append (.getColumnPosition mapping))
-              (.append "]")
-              (.append " (compiled to ")))
+            (let [{:keys [file url]} src
+
+                  src-loc
+                  (or (when file (.getAbsolutePath file))
+                      (let [x (str url)]
+                        (if-let [idx (str/index-of x ".m2")]
+                          (str "~/" (subs x idx))
+                          x))
+                      (.getOriginalFile mapping))]
+
+              (doto sb
+                (.append src-loc)
+                (.append " [")
+                (.append (.getLineNumber mapping))
+                (.append ":")
+                (.append (.getColumnPosition mapping))
+                (.append "]\n")
+                (.append "Compiled to: "))))

           (doto sb
             (.append source-name)
@@ -205,14 +226,7 @@
             (.append line)
             (.append ":")
             (.append column)
-            (.append "]"))
-
-          (when mapping
-            (.append sb ")"))
-
-          (doto sb
-            (.append "\n\t")
-            (.append (.-description err)))
+            (.append "]\n"))

           (-> {:line line
                :column column


make --serve work

make --serve work

--- figwheel-main/src/figwheel/main.clj
+++ figwheel-main/src/figwheel/main.clj
@@ -14,28 +14,6 @@
    [hawk.core :as hawk])
   (:import
    [java.io StringReader]))
-
-
-;; TODO
-;; builds
-;; build config
-
-;; isolate a build by ID for each repl
-;; identify a notion of identity(i.e. build-id) at the connection level perhaps a fn
-
-;; better watcher build connection
-;; load changed clj files
-
-;; bind connections and verify that it works
-
-;; opening files in editor
-;; CSS watching
-
-;; project generation?
-
-;; Watching we want to allow the specification of multiple directories to watch
-
-;; repl-env is assumed to be figwheel

 ;; ------------------------------------------------------------
 ;; Watching
@@ -178,8 +156,6 @@

         opts     (as->
                    (merge
-                     #_(select-keys env-opts
-                                    (cond-> [:target] repl? (conj :browser-repl)))
                      options
                      (when main-ns
                        {:main main-ns})) opts
@@ -234,12 +210,12 @@
             ;; I don't think so
             (when figwheel-mode?
               (cljs.repl/evaluate-form renv
-                                       "<cljs repl>"
                                        (assoc (ana/empty-env)
                                               :ns (ana/get-namespace ana/*cljs-ns*))
+                                       "<cljs repl>"
                                        ;; todo allow opts to be added here
-                                       (ana-api/forms-seq (StringReader. "(figwheel.core/start-from-repl)"))))
-            (when-let [server @(:server repl-env)]
+                                       (first (ana-api/forms-seq (StringReader. "(figwheel.core/start-from-repl)")))))
+            (when-let [server @(:server renv)]
               (.join server))))))))

 (def server (atom nil))


Small code cleanup

Small code cleanup

--- src/braid/client/core/subs.cljs
+++ src/braid/client/core/subs.cljs
@@ -143,12 +143,12 @@
 (reg-sub-raw
   :recent-threads
   (fn [state _ [group-id]]
-    (let [open-thread-ids (reaction (get-in @state [:user :open-thread-ids]))
+    (let [not-open? (reaction
+                      (complement (get-in @state [:user :open-thread-ids])))
           threads (reaction (@state :threads))]
       (reaction
-        (doall (filter (fn [thread] (and
-                                      (= (thread :group-id) group-id)
-                                      (not (contains? @open-thread-ids (thread :id)))))
+        (doall (filter (fn [{grp :group-id id :id}]
+                         (and (= grp group-id) (@not-open? id)))
                        (vals @threads)))))))

 (reg-sub


serverless-cljs template 0.1.3

serverless-cljs template 0.1.3

--- templates/serverless/project.clj
+++ templates/serverless/project.clj
@@ -1,4 +1,4 @@
-(defproject serverless-cljs/lein-template "0.1.2"
+(defproject serverless-cljs/lein-template "0.1.3"
   :description "Clojurescript on AWS Lambda via Serverless"
   :url         "https://github.com/nervous-systems/cljs-lambda"
   :license     {:name "Unlicense" :url "http://unlicense.org/UNLICENSE"}


add test for Valley Grid

add test for Valley Grid

--- src/clj/test/cards-upgrades.clj
+++ src/clj/test/cards-upgrades.clj
@@ -238,4 +238,24 @@
       (prompt-select :runner hok)
       (prompt-choice :runner "Yes")
       (is (= 2 (:click (get-runner))) "Runner was charged 1click")
-      (is (= 1 (count (:scored (get-runner)))) "1 scored agenda"))))+      (is (= 1 (count (:scored (get-runner)))) "1 scored agenda"))))
+
+(deftest valley-grid-trash
+  "Valley Grid - Reduce Runner max hand size and restore it even if trashed"
+  (do-game
+    (new-game (default-corp [(qty "Valley Grid" 3) (qty "Ice Wall" 3)])
+              (default-runner))
+    (play-from-hand state :corp "Valley Grid" "New remote")
+    (take-credits state :corp 2)
+    (core/click-run state :runner {:server "Server 1"})
+    (let [vg (find-card "Valley Grid" (get-in @state [:corp :servers :remote1 :content]))]
+      (core/rez state :corp vg)
+      (card-ability state :corp vg 0)
+      (card-ability state :corp vg 0) ; only need the run to exist for test, just pretending the Runner has broken all subs on 2 ice
+      (is (= 3 (:max-hand-size (get-runner))) "Runner max hand size reduced by 2")
+      (is (= 2 (get-in (refresh vg) [:times-used])) "Saved number of times Valley Grid used")
+      (core/no-action state :corp nil)
+      (core/successful-run state :runner nil)
+      (prompt-choice :runner "Yes") ; pay to trash
+      (take-credits state :runner 3)
+      (is (= 5 (:max-hand-size (get-runner))) "Runner max hand size increased by 2 at start of Corp turn"))))