Исправление работы галереи

Исправление работы галереи

--- radiolamp-6P3S/src/ixinfestor/omut.cljs
+++ radiolamp-6P3S/src/ixinfestor/omut.cljs
@@ -3124,27 +3124,7 @@

 (defn images-gallery-1 [app own]
-  (reify
-
-    om/IInitState
-    (init-state [_]
-      {:i          0               :deg            0
-       :div-id     (uniq-id "div") :img-id         (uniq-id "img")
-       :div-height nil             :img-margin-top nil
-       :img-height nil
-       })
-
-    om/IDidUpdate
-    (did-update [_ _ _]
-      )
-
-    om/IWillReceiveProps
-    (will-receive-props [_ next-props]
-      (om/set-state! own :i 0))
-
-    om/IRenderState
-    (render-state [_ {:keys [i deg div-id div-height img-id img-margin-top img-height]}]
-      (letfn [(img-setup []
+  (letfn [(img-setup []
                 (om/update-state!
                  own (fn [{:keys [div-id img-id deg] :as state}]
                        (let [r?    (or (= deg 90) (= deg 270))
@@ -3164,6 +3144,26 @@
                                                 nil))
                                 :img-height (when (and r? (not fat?))
                                               div-w))))))]
+    (reify
+
+      om/IInitState
+      (init-state [_]
+        {:i          0               :deg            0
+         :div-id     (uniq-id "div") :img-id         (uniq-id "img")
+         :div-height nil             :img-margin-top nil
+         :img-height nil
+         })
+
+      om/IDidUpdate
+      (did-update [_ _ _]
+        (img-setup))
+
+      om/IWillReceiveProps
+      (will-receive-props [_ next-props]
+        (om/set-state! own :i 0))
+
+      om/IRenderState
+      (render-state [_ {:keys [i deg div-id div-height img-id img-margin-top img-height]}]
         (let [deg-2 (str  "rotate(" deg "deg)")
               src   (get-in @app [i :path] "")]
           (if (empty? @app)


Spanish: Synonyms for better matches (#130)

thanks

--- resources/languages/es/rules/cycles.clj
+++ resources/languages/es/rules/cycles.clj
@@ -50,11 +50,11 @@
   ; (cycle-nth  (:grain %3) 1 (:value %2))

   "la <cycle> pasado"
-  [#"(?i)(el|los|la|las) ?" (dim :cycle) #"(?i)pasad(a|o)s?"]
+  [#"(?i)(el|los|la|las) ?" (dim :cycle) #"(?i)pasad(a|o)s?|[u|ú]ltim[a|o]s?"]
   (cycle-nth (:grain %2) -1)

   "la pasado <cycle>"
-  [#"(?i)(el|los|la|las) ?" #"(?i)pasad(a|o)s?" (dim :cycle)]
+  [#"(?i)(el|los|la|las) ?" #"(?i)pasad(a|o)s?|[u|ú]ltim[a|o]s?" (dim :cycle)]
   (cycle-nth  (:grain %3) -1)

   "el <cycle> (proximo|que viene)"
@@ -62,7 +62,7 @@
   (cycle-nth  (:grain %2) 1)

   "el proximo <cycle> "
-  [#"(?i)(el|los|la|las) ?" #"(?i)pr(ó|o)xim(o|a)s?" (dim :cycle)]
+  [#"(?i)(el|los|la|las) ?" #"(?i)pr(ó|o)xim(o|a)s?|siguientes?" (dim :cycle)]
   (cycle-nth  (:grain %3) 1)

   "el <cycle> proximo|que viene <time>"


Add transact-schema function.

Add transact-schema function.

--- src/continuo/postgresql/transaction.clj
+++ src/continuo/postgresql/transaction.clj
@@ -125,3 +125,7 @@
 (defn transact
   [context facts]
   (transact* context "user" facts))
+
+(defn schema-transact
+  [context facts]
+  (transact* context "schema" facts))


simplified3d.clj: first version of the simplify function

--- clojure/org/gavrog/clojure/simplify3d.clj
+++ clojure/org/gavrog/clojure/simplify3d.clj
@@ -22,11 +22,12 @@
                          E (orbit-elements ds [i j] D)]
                      E))))

-(defn contract-edges [ds]
-  (-> ds dual merge-volumes dual))
+(defn on-dual [f]
+  (fn [ds] (-> ds dual f dual)))

-(defn squish-digons [ds]
-  (-> ds dual merge-facets dual))
+(def contract-edges (on-dual merge-volumes))
+
+(def squish-digons (on-dual merge-facets))

 ;; === The following are specific to 3d symbols

@@ -113,3 +114,19 @@
   (if-let [[A B C D] (first (filter (partial liftable? ds) local-2-cuts ds))]
     (-> ds (cut-face A C) (cut-face B D) (pinch-tile A D))
     ds))
+
+(defn simplified [ds]
+  (let [clean (fn [ds] (-> ds
+                         merge-volumes merge-facets dual
+                         merge-volumes merge-facets dual))
+        operations [pinch-first-local-1-cut
+                    pinch-first-local-2-cut
+                    (on-dual pinch-first-local-1-cut)
+                    (on-dual pinch-first-local-2-cut)]]
+    (loop [ds (clean ds), pending operations]
+      (if-let [f (first pending)]
+        (let [t (f ds)]
+          (if (= t ds)
+            (recur ds (rest pending))
+            (recur (clean t) operations)))
+        ds))))


wow im not good at git

wow im not good at git

--- src/lseq_tree/lseq_node.cljc
+++ src/lseq_tree/lseq_node.cljc
@@ -10,40 +10,37 @@
   (del [this node])
   (index-of [this node])
   (indexes [this node])
-  (child [this index]))
+  (fetch [this index]))

 (defrecord Node [triple element sub-counter children]
   INode
-  (add [this other]
-    (let [index (native-index-of (map :triple (:children this))
-                                 (:triple other))
-          next-this (update-in this [:sub-counter] inc)
-          {n-children :children n-triple :triple} next-this
-          {o-children :children o-element :element o-triple :triple} other
-          length (count n-children)]
+  (add [{:keys [children triple] :as this}
+        {-children :children
+         -element :element
+         -triple :triple
+         :as target}]
+    (let [this* (update-in this [:sub-counter] inc)
+          index (native-index-of (map :triple children) -triple)
+          length (count children)]
       (if (or (< index 0)
               (= length 0)
               (and (= index 0)
                    (> length 0)
-                   (not= (:triple (first n-children)) o-triple)))
+                   (not= (:triple (first children)) -triple)))
         ; if the path does not exist
-        (assoc next-this
-               :children
-               (->> (cons other n-children)
-                    (sorted :triple)
-                    (into [])))
+        (assoc this* :children (->> (cons target children)
+                                    (sorted :triple)
+                                    (into [])))
         ; if the path does exist
-        (if (= (count o-children) 0)
+        (if (= (count -children) 0)
           ; if the other node does not have children
-          (if (not= (get-in n-children [index :element]) nil)
+          (if (get-in children [index :element])
             ; if something is at index
-            next-this ; TODO is this a bug in original code
+            this*
             ; if nothing is at index
-            (assoc-in next-this [:children index :element] o-element))
+            (assoc-in this* [:children index :element] -element))
           ; if the other node does have children
-          (update-in next-this
-                     [:children index]
-                     #(add % (first o-children)))))))
+          (update-in this* [:children index] #(add % (first -children)))))))

   (del [this node] nil)
   (index-of [this node]
@@ -108,7 +105,7 @@
                    (get-in current-tree [:children index])
                    (get-in current-node [:children 0])))))))

-  (child [this index] nil))
+  (fetch [this index] nil))

 (defmethod direction Node
   [this that]


Small refactor for Postgres json extensions.

--- src/crochet_api/postgres_extensions.clj
+++ src/crochet_api/postgres_extensions.clj
@@ -10,10 +10,11 @@
   jdbc/IResultSetReadColumn
   (result-set-read-column [val rsmeta idx]
     (let [colType (.getColumnTypeName rsmeta idx)]
-    (if (or (= colType "json")
-            (= colType "jsonb"))
+    (if (contains? #{"json" "jsonb"} colType)
       (cheshire/parse-string (.getValue val) true)
       val))))
+
+(contains? #{"json" "jsonb"} "foo")

 ;; Support for Timestamps
 (extend-type java.sql.Timestamp


corrected most-deviant function

corrected most-deviant function

--- src/de/otto/oscillator/graphite/dsl.clj
+++ src/de/otto/oscillator/graphite/dsl.clj
@@ -13,8 +13,8 @@
 (defn group [& targets]
   (str "group(" (cs/join "," targets) ")"))

-(defn most-deviant [& targets]
-  (str "mostDeviant(" (cs/join "," targets) ")"))
+(defn most-deviant [amount & targets]
+  (str "mostDeviant(" (cs/join "," targets) "," amount ")"))

 (defn summarize [target, timespan]
   (str "summarize(" target ",\"" timespan "\",\"avg\")"))


test hook

test hook

--- src/main/cawala/api/read.clj
+++ src/main/cawala/api/read.clj
@@ -6,7 +6,7 @@
                      :person/relation :friend}
                  2  {:db/id 2 :person/name "Sally" :person/age 22
                      :person/relation :friend}
-                 3  {:db/id 3 :person/name "Allie" :person/age 61
+                 3  {:db/id 3 :person/name "Allie" :person/age 60
                      :person/relation :enemy}
                  4  {:db/id 4 :person/name "Zoe" :person/age 32
                      :person/relation :friend}


Fix bug getting mesos utilization

Fix bug getting mesos utilization

--- scheduler/src/cook/mesos/rebalancer.clj
+++ scheduler/src/cook/mesos/rebalancer.clj
@@ -327,7 +327,7 @@
                                      (json/read-str)))
         utilization (some-<>> mesos-master-urls
                               (map get-stats)
-                              (filter #(= (get % "master/elected") 1))
+                              (filter #(pos? (get % "master/elected")))
                               (first)
                               (select-keys <> ["master/cpus_percent" "master/mem_percent"])
                               (vals)


(Empty) functions to read and parse metadata

--- src/emender_jenkins/metadata_reader.clj
+++ src/emender_jenkins/metadata_reader.clj
@@ -52,6 +52,54 @@
           {:total   (-> (first lines) parse-int)
            :missing (-> (second lines) parse-int)}))

+(defn read-and-parse-docbook-versions
+    []
+)
+
+(defn read-and-parse-entities-count
+    []
+)
+
+(defn read-and-parse-entities-uniq
+    []
+)
+
+(defn read-and-parse-other-parts-count
+    []
+)
+
+(defn read-and-parse-program-listing
+    []
+)
+
+(defn read-and-parse-tag-frequencies
+    []
+)
+
+(defn read-and-parse-tags-with-conditions-count
+    []
+)
+
+(defn read-and-parse-tags-with-conditions-list
+    []
+)
+
+(defn read-and-parse-used-graphics-count
+    []
+)
+
+(defn read-and-parse-word-count
+    []
+)
+
+(defn read-and-parse-xincludes-count
+    []
+)
+
+(defn read-and-parse-zpage-count
+    []
+)
+
 (defn job-results->job-names
     [job-results]
     (for [job-result job-results]
@@ -60,12 +108,24 @@
 (defn load-and-parse-metadata
     [jenkins-url job-names]
     (for [job-name job-names]
-        {:job-name           job-name
-         :product            (results/job-name->product-name job-name)
-         :version            (results/job-name->version job-name)
-         :book               (results/job-name->book-name job-name)
-         :commiters-list     (read-and-parse-list-of-commiters  jenkins-url job-name)
-         :chunkable-tags-ids (read-and-parse-chunkable-tags-ids jenkins-url job-name)}))
+        {:job-name                  job-name
+         :product                   (results/job-name->product-name job-name)
+         :version                   (results/job-name->version job-name)
+         :book                      (results/job-name->book-name job-name)
+         :commiters-list            (read-and-parse-list-of-commiters          jenkins-url job-name)
+         :chunkable-tags-ids        (read-and-parse-chunkable-tags-ids         jenkins-url job-name)
+         :docbook-versions          (read-and-parse-docbook-versions           jenkins-url job-name)
+         :entities-count            (read-and-parse-entities-count             jenkins-url job-name)
+         :entities-uniq             (read-and-parse-entities-uniq              jenkins-url job-name)
+         :other-parts-count         (read-and-parse-other-parts-count          jenkins-url job-name)
+         :program-listing           (read-and-parse-program-listing            jenkins-url job-name)
+         :tag-frequencies           (read-and-parse-tag-frequencies            jenkins-url job-name)
+         :tags-with-condition-count (read-and-parse-tags-with-conditions-count jenkins-url job-name)
+         :tags-with-condition-list  (read-and-parse-tags-with-conditions-list  jenkins-url job-name)
+         :used-graphics-count       (read-and-parse-used-graphics-count        jenkins-url job-name)
+         :word-count                (read-and-parse-word-count                 jenkins-url job-name)
+         :xincludes-count           (read-and-parse-xincludes-count            jenkins-url job-name)
+         :zpage-count               (read-and-parse-zpage-count                jenkins-url job-name)}))

 (defn reload-tests-metadata
     [configuration job-results]


Better handle blank / bad URLs in markov builder

--- src/engulf/formulas/markov_requests.clj
+++ src/engulf/formulas/markov_requests.clj
@@ -117,8 +117,14 @@
   [corpus]
   (->> corpus
        (map #(if (map? %) % {:url %}))
+       (filter (comp not string/blank? :url))
        ;; Ensure URLs are parsable
-       (map #(do (.toString (URL. (:url %))) %))
+       (map (fn [req]
+              (try
+                (update-in req [:url] #(.toString (URL. %)))
+                (catch Exception e
+                  (throw (Exception. (str "Could not parse url in: " req)
+                                     ))))))
        (map keywordize-keys)
        (map #(assoc % :timeout (if-let [t (:timeout %)] t 30000)))
        (map #(assoc % :method (if-let [m (:method %)]


Switch to pr-str in schema-validation/format-failures

--- src/io/aviso/rook/schema_validation.clj
+++ src/io/aviso/rook/schema_validation.clj
@@ -16,7 +16,7 @@
   [failures]
   {:error    "validation-error"
    ;; This needs work; it won't transfer very well to the client for starters.
-   :failures (str failures)})
+   :failures (pr-str failures)})

 ;; Borrowed from clojure.instant:
 (def ^:private thread-local-utc-date-format


Cleaner to add image handlers when adding subscription.

--- src/onyx/messaging/aeron/subscriber.clj
+++ src/onyx/messaging/aeron/subscriber.clj
@@ -99,13 +99,13 @@
           lost-sessions (atom #{})
           ctx (cond-> (Aeron$Context.)
                 error-handler (.errorHandler error-handler)
-                media-driver-dir (.aeronDirectoryName ^String media-driver-dir)
-                true (.availableImageHandler (available-image sinfo error))
-                true (.unavailableImageHandler (unavailable-image sinfo lost-sessions)))
+                media-driver-dir (.aeronDirectoryName ^String media-driver-dir))
           conn (Aeron/connect ctx)
           channel (autil/channel peer-config)
           stream-id (stream-id dst-task-id slot-id site)
-          sub (.addSubscription conn channel stream-id)
+          available-image-handler (available-image sinfo error)
+          unavailable-image-handler (unavailable-image sinfo lost-sessions)
+          sub (.addSubscription conn channel stream-id available-image-handler unavailable-image-handler)
           sources []
           short-id-status-pub (int2objectmap)
           status-pubs {}


(PDB-3092) Create a partial index in resource_events for querying corrective events

--- src/puppetlabs/puppetdb/scf/migrate.clj
+++ src/puppetlabs/puppetdb/scf/migrate.clj
@@ -1162,6 +1162,11 @@
      (fact_value_id) references fact_values(id) on update restrict on delete restrict"
     "create index fact_values_value_float_idx on fact_values(value_float)"
     "create index fact_values_value_integer_idx on fact_values(value_integer)"))
+
+(defn add-corrective-change-index
+  []
+  (jdbc/do-commands
+    "CREATE INDEX resource_events_status_for_corrective_change_idx ON resource_events (status) WHERE corrective_change"))

 (def migrations
   "The available migrations, as a map from migration version to migration function."
@@ -1192,7 +1197,8 @@
    49 add-corrective-change-columns
    50 remove-historical-catalogs
    51 fact-values-value-to-jsonb
-   52 resource-params-cache-parameters-to-jsonb})
+   52 resource-params-cache-parameters-to-jsonb
+   53 add-corrective-change-index})

 (def desired-schema-version (apply max (keys migrations)))


(maint) change migrate trgm message to refer to 9.4

Previously this gave the impression that 9.3 was allowed.

--- src/puppetlabs/puppetdb/scf/migrate.clj
+++ src/puppetlabs/puppetdb/scf/migrate.clj
@@ -1583,5 +1583,5 @@
        (str
         "Unable to install optimal indexing\n\n"
         "We are unable to create optimal indexes for your database.\n"
-        "For maximum index performance, we recommend using PostgreSQL 9.3 or\n"
+        "For maximum index performance, we require PostgreSQL 9.4 or\n"
         "greater.\n")))))


(PDB-4506) Don't hang after C-c (SIGINT) during migrations

Don't call System/exit when a migration fails.  Instead, just throw an
exception that will eventually be caught by trapperkeeper and initiate
the shutdown.  The System/exit was the cause of the hangs.

To reproduce the original problem, you can just add a Thread/sleep to
one of the migrations and hit C-c while pdb is sleeping.

Move the SQLException unraveling to the top level of migrate! so that
it'll cover the entirety of the migrations, and adjust it to unravel
the whole chain rather than just the first link.

--- src/puppetlabs/puppetdb/scf/migrate.clj
+++ src/puppetlabs/puppetdb/scf/migrate.clj
@@ -1594,23 +1594,6 @@
     (into (sorted-map)
           (select-keys migrations pending))))

-(defn- sql-or-die
-  "Calls (f) and returns its result.  If f throws an SQLException,
-  logs the exception and its parent and then calls (flush-and-exit 1)"
-  [f]
-  ;; Here we've preserved existing behavior, but this may warrant
-  ;; further consideration later.  If possible, we might want to
-  ;; avoid flush-and-exit in favor of careful exception
-  ;; handling (cf. PDB-1118).
-  (try
-    (f)
-    (catch java.sql.SQLException e
-      (log/error e (trs "Caught SQLException during migration"))
-      (when-let [next (.getNextException e)]
-        (log/error next (trs "Unravelled exception")))
-      (binding [*out* *err*] (flush)) (flush)
-      (flush-and-exit 1))))
-
 (defn previous-migrations
   "Returns the list of migration numbers that existed before the
   current known set. These migrations can't be upgraded from, but are
@@ -1627,13 +1610,7 @@
        (into known-migrations)
        (difference applied-migrations)))

-(defn migrate!
-  "Migrates database to the latest schema version. Does nothing if
-  database is already at the latest schema version.  Requires a
-  connection pool because some operations may require an indepdendent
-  database connection.
-
-  This function will return true iff any migrations were run."
+(defn run-migrations
   [db-connection-pool]
   (let [applied-migration-versions (applied-migrations)
         latest-applied-migration (last applied-migration-versions)
@@ -1660,12 +1637,12 @@
                                 (->> pending
                                      (map (fn [[version migration]]
                                             (let [t0 (now)]
-                                            (log/info (trs "Applying database migration version {0}" version))
-                                            (sql-or-die (fn [] (let [result (migration)]
-                                                                    (record-migration! version)
-                                                                    result)))
-                                            (log/info (trs "Applied database migration version {0} in {1} ms"
-                                                           version (in-millis (interval t0 (now))))))))
+                                              (log/info (trs "Applying database migration version {0}" version))
+                                              (let [result (migration)]
+                                                (record-migration! version)
+                                                result)
+                                              (log/info (trs "Applied database migration version {0} in {1} ms"
+                                                             version (in-millis (interval t0 (now))))))))
                                      (filter map?)
                                      (map ::vacuum-analyze)
                                      (apply set/union small-tables)
@@ -1675,6 +1652,21 @@
       (do
         (log/info (trs "There are no pending migrations"))
         false))))
+
+(defn migrate! [db-connection-pool]
+  "Migrates database to the latest schema version. Does nothing if
+  database is already at the latest schema version.  Requires a
+  connection pool because some operations may require an indepdendent
+  database connection.  Returns true if there were any migrations."
+  (try
+    (run-migrations db-connection-pool)
+    (catch java.sql.SQLException e
+      (log/error e (trs "Caught SQLException during migration"))
+      (loop [ex (.getNextException e)]
+        (when ex
+          (log/error ex (trs "Unraveled exception"))
+          (recur (.getNextException ex))))
+      (throw e))))

 ;; SPECIAL INDEX HANDLING


db/docids.clj: added make/handle-docid-request

--- src/org/altlaw/db/docids.clj
+++ src/org/altlaw/db/docids.clj
@@ -41,3 +41,11 @@
 (defn save-docids [collection]
   (data/save-data (str "docids/" collection)))

+(defn make-docid-request [collection keys]
+  {:collection collection, :keys keys})
+
+(defn handle-docid-request [request]
+  (assert (contains? request :collection))
+  (assert (contains? request :keys))
+  (assert (coll? (:keys request)))
+  (assign-next-docid (:collection request) (:keys request)))


Fix defunk arg-pair descriptions to handle nil etc.

--- src/overtone/helpers/lib.clj
+++ src/overtone/helpers/lib.clj
@@ -198,7 +198,7 @@
         arg-names-symbs (vec (map symbol arg-names))
         arg-keys        (vec (map keyword arg-names))
         default-map     (apply hash-map (syms-to-keywords args))
-        arg-pairs       (map #(str (first %) " " (second %)) (partition 2 args))
+        arg-pairs       (map #(with-out-str "" (pr (first %) (second %))) (partition 2 args))
         arg-pairs-str   (apply str (interpose ", " arg-pairs))
         arg-string      "Keyword arg fn with defaults:\n  "
         arg-string      (str arg-string "[" arg-pairs-str "]")


Teach find-note-name to handle nil arg - let nil flow through

--- src/overtone/music/pitch.clj
+++ src/overtone/music/pitch.clj
@@ -649,8 +649,8 @@
   (find-note-name 45) ;=> A2
   (find-note-name 57) ;=> A3
   (find-note-name 58) ;=> Bb3"
-  (let [octave (dec (int (/ note 12)))]
-    (keyword (str (name (find-pitch-class-name note)) octave))))
+  (when note (let [octave (dec (int (/ note 12)))]
+               (keyword (str (name (find-pitch-class-name note)) octave)))))

 (defn- fold-note
   "Folds note intervals into a 2 octave range so that chords using


don't prepend "p" or "c" for cluster/particpant ids

--- src/polismath/simulation.clj
+++ src/polismath/simulation.clj
@@ -16,8 +16,8 @@
               (take n-votes (repeatedly #(wrapper-fn (rand-int range)))))]
       (map #(hash-map :zid %1 :pid %2 :tid %3 :vote %4)
         (generator identity n-convs)
-        (generator #(str "p" %) n-ptpts)
-        (generator #(str "c" %) n-cmts)
+        (generator identity n-ptpts)
+        (generator identity n-cmts)
         (generator #(- % 1) 3)))))


Reorder shutdown sequence.

Reorder shutdown sequence.

--- test/onyx/log/greedy_multi_job_test.clj
+++ test/onyx/log/greedy_multi_job_test.clj
@@ -118,10 +118,10 @@
 (close! b-chan)
 (close! d-chan)

-(onyx.api/shutdown-peer-group peer-group)
-
 (doseq [v-peer v-peers]
   (onyx.api/shutdown-peer v-peer))

+(onyx.api/shutdown-peer-group peer-group)
+
 (onyx.api/shutdown-env env)


fixing issue parsing form submissions (#192)

--- server/src/spacon/components/form.clj
+++ server/src/spacon/components/form.clj
@@ -70,7 +70,7 @@
         form-id (:form-id p)
         form-data (:feature p)
         device-identifier (:client (:metadata form-data))]
-    (triggerapi/test-value trigger form-data)
+    (triggerapi/test-value trigger "FORM_STORE" form-data)
     (formmodel/add-form-data form-data form-id device-identifier)))

 (defn- routes [mqtt]


back to db.serializers.utils ns

back to db.serializers.utils ns

--- ssclj/tools/src/com/sixsq/slipstream/tools/cli/ssconfig.clj
+++ ssclj/tools/src/com/sixsq/slipstream/tools/cli/ssconfig.clj
@@ -5,7 +5,6 @@

     [com.sixsq.slipstream.db.serializers.service-config-impl :as sci]
     [com.sixsq.slipstream.db.serializers.utils :as u]
-    [com.sixsq.slipstream.dbtest.es.utils-esdb :as ud]
     [com.sixsq.slipstream.ssclj.resources.configuration :as cfg]
     [com.sixsq.slipstream.ssclj.resources.configuration-slipstream :as cfg-s]
     [com.sixsq.slipstream.ssclj.resources.configuration-template :as cfgt]
@@ -55,7 +54,7 @@

 (defn init-db-client
   []
-  (ud/db-client-and-crud-impl))
+  (u/db-client-and-crud-impl))

 (defn init-namespaces
   []


[elasticsearch] Use clj-time 0.9.0

[elasticsearch] Use clj-time 0.9.0

--- joplin.elasticsearch/project.clj
+++ joplin.elasticsearch/project.clj
@@ -8,4 +8,4 @@
   :dependencies [[org.clojure/clojure "1.6.0"]
                  [clojurewerkz/elastisch "2.1.0"]
                  [joplin.core "0.2.5-SNAPSHOT"]
-                 [clj-time "0.8.0"]])
+                 [clj-time "0.9.0"]])


Aligned test cases with the canonical data

Why did this just test a single defined variable?

--- exercises/proverb/test/proverb_test.clj
+++ exercises/proverb/test/proverb_test.clj
@@ -1,10 +1,33 @@
 (ns proverb-test
   (:require [clojure.test :refer [deftest is]]
-            [proverb :refer [proverb]]
+            [proverb :refer [recite]]
             [clojure.string :as str]))

-(deftest full-text-is-correct
-  (is (= proverb
+(deftest zero-pieces
+  (is (=
+        (recite ())
+        "")))
+
+(deftest one-piece
+  (is (=
+        (recite '("nail"))
+        "And all for the want of a nail.")))
+
+(deftest two-pieces
+  (is (=
+        (recite '("nail" "shoe"))
+        (str/join "\n" ["For want of a nail the shoe was lost."
+                        "And all for the want of a nail."]))))
+
+(deftest three-pieces
+  (is (=
+        (recite '("nail" "shoe" "horse"))
+        (str/join "\n" ["For want of a nail the shoe was lost."
+                        "For want of a shoe the horse was lost."
+                        "And all for the want of a nail."]))))
+
+(deftest full-proverb
+  (is (= (recite '("nail" "shoe" "horse" "rider" "message" "battle" "kingdom"))
          (str/join "\n" ["For want of a nail the shoe was lost."
                          "For want of a shoe the horse was lost."
                          "For want of a horse the rider was lost."
@@ -12,3 +35,11 @@
                          "For want of a message the battle was lost."
                          "For want of a battle the kingdom was lost."
                          "And all for the want of a nail."]))))
+
+(deftest four-pieces-modernized
+  (is (=
+        (recite '("pin" "gun" "soldier" "battle"))
+        (str/join "\n" ["For want of a pin the gun was lost."
+                        "For want of a gun the soldier was lost."
+                        "For want of a soldier the battle was lost."
+                        "And all for the want of a pin."]))))


Resolve missing ref for inclusion of social-light in scheduler

--- spectacles/src/spectacles/scheduler.clj
+++ spectacles/src/spectacles/scheduler.clj
@@ -9,7 +9,9 @@
             [spectacles.fireflies]
             [spectacles.polkadots]
             [spectacles.simple-camera]
-            [spectacles.mirror-camera]))
+            [spectacles.mirror-camera]
+            [spectacles.social-light]
+            ))

 (def sketches {:logo-countdown {:setup  spectacles.present-logo/setup
                                 :update spectacles.present-logo/update


placeholder name for collabs

placeholder name for collabs

--- src-cljs/frontend/components/aside.cljs
+++ src-cljs/frontend/components/aside.cljs
@@ -31,23 +31,23 @@
            [:button
             [:object
              (common/icon :bullet)
-             [:span "John Smith"]]]
+             [:span "Anonymous"]]]
            [:button
             [:object
              (common/icon :bullet)
-             [:span "John Smith"]]]
+             [:span "Anonymous"]]]
            [:button
             [:object
              (common/icon :bullet)
-             [:span "John Smith"]]]
+             [:span "Anonymous"]]]
            [:button
             [:object
              (common/icon :bullet)
-             [:span "John Smith"]]]
+             [:span "Anonymous"]]]
            [:button
             [:object
              (common/icon :bullet)
-             [:span "John Smith"]]]]
+             [:span "Anonymous"]]]]
           [:div.aside-settings
            [:button
             (common/icon :settings)


redirect to team menu instead of add user

--- src-cljs/frontend/components/outer.cljs
+++ src-cljs/frontend/components/outer.cljs
@@ -131,7 +131,7 @@
                                                            :protocol config/scheme
                                                            :port config/port
                                                            :path (str "/document/" (:team/intro-doc team))
-                                                           :query {:overlay "team-settings"}}))}
+                                                           :query {:overlay "roster"}}))}
                                 (str (str (:team/subdomain team) "." config/hostname)
                                      " is ready, let's go!")]


[WR] allow for dual loading formats via dev.core

--- dev-src/dev/core.clj
+++ dev-src/dev/core.clj
@@ -12,7 +12,7 @@
             [democracyworks.squishy.data-readers]))

 (def pipeline
-  (concat [zip/unzip
+  (concat [zip/assoc-file
            zip/extracted-contents
            t/attach-sqlite-db
            (data-spec/add-data-specs data-spec/data-specs)
@@ -24,7 +24,9 @@

 (defn -main [zip-filename]
   (psql/initialize)
-  (let [zip (java.io.File. zip-filename)
+  (let [zip (if (zip/xml-file? zip-filename)
+              (java.nio.file.Paths/get zip-filename (into-array [""]))
+              (java.io.File. zip-filename))
         result (pipeline/process pipeline zip)]
     (when-let [xml-output-file (:xml-output-file result)]
       (println "XML:" (.toString xml-output-file))


Functions to avoid small expressions.

Functions to avoid small expressions.

--- src/algebolic/expression/genetics.clj
+++ src/algebolic/expression/genetics.clj
@@ -55,7 +55,7 @@
 (defn full-population
   "Make an intial population of n `full` expressions, with depths up to and including max-depth."
   [functions terminals n max-depth]
-  (repeatedly n (fn [] (random-full-tree functions terminals (+ 1 (rand-int (- max-depth 1)))))))
+  (repeatedly n (fn [] (random-full-tree functions terminals (+ 2 (rand-int (- max-depth 2)))))))

 ;; * Mutation *
@@ -158,4 +158,13 @@
   (let [size (tree/count-nodes expr)]
     (if (> size max-size)
       (first (filter #(< (tree/count-nodes %) max-size) (repeatedly #(tree/sub-tree expr (rand-int size)))))
+      expr)))
+
+(defn boost-hard
+  "Takes an expresion and a min-size, and if it's undersize replaces it an expression generated by calling
+  the given generator."
+  [min-size generator expr]
+  (let [size (tree/count-nodes expr)]
+    (if (< size min-size)
+      (generator)
       expr)))


added gone downstairs

added gone downstairs

--- src/babel/english/lexicon-verbcoach.clj
+++ src/babel/english/lexicon-verbcoach.clj
@@ -921,6 +921,7 @@
                    :pred :go-downstairs}
              :subcat {:2 '()}}
     :english {:past "went downstairs"
+              :past-participle "gone downstairs"
               :participle "going downstairs"
               :present {:3sing "goes downstairs"}}}


added randomgenerator for satellite position data

--- src/clj/satellite_routes/utils/core.clj
+++ src/clj/satellite_routes/utils/core.clj
@@ -10,7 +10,59 @@
 (def EARTH-RADIUS 6371.0)

-(defn parse-data
+(defn generate-data
+  " Generates satellite position data from 0 to n-1 and a random route with a start and end position. "
+  [n]
+  (let [rand-geo-loc #(- (rand 360) 180)]
+    (loop [sat-n 0
+           hashmap {:satellites []}]
+      (if (>= sat-n n)
+        (let [start-lat (rand-geo-loc)
+              start-long (rand-geo-loc)
+              end-lat (rand-geo-loc)
+              end-long (rand-geo-loc)]
+          (assoc hashmap :route (conj [] start-lat start-long end-lat end-long))))
+        (let [lat (rand-geo-loc)
+              long (rand-geo-loc)
+              alt (+ (rand 400) 300)
+              sat-vec (:satellites hashmap)]
+          (recur (inc sat-n)
+                 (assoc hashmap :satellites
+                   (conj sat-vec {:name (str "SAT" sat-n)
+                                  :geo-pos [lat long alt]})))))))
+
+(defn satellite-in-cartesian
+  " Converts the position of the satellite given as parameter from [latitude longitude altitude] into [x y z]. Assumes that the earth is a sphere centered at the origin with the coordinate axes following the ECEF model. "
+  [satellite earth-radius]
+  (let [[lat long alt] (:geo-pos satellite)
+        dist-from-origin (+ alt earth-radius)
+        cartesian-pos (alg/as-cartesian dist-from-origin
+                                        lat
+                                        long)]
+    {:name (:name satellite)
+     :pos cartesian-pos}))
+
+
+
+(defn parse-generated-data
+  " Converts all geographic coordinates in raw-map into cartesian coordinates. "
+  [raw-map]
+  (let [geo-satellites (:satellites raw-map)
+        [start-lat start-long
+         end-lat end-long] (:route raw-map)
+         earth-surface (+ EARTH-RADIUS 0.1)
+        route-start (alg/as-cartesian earth-surface
+                                      start-lat
+                                      start-long)
+        route-end (alg/as-cartesian earth-surface
+                                      end-lat
+                                      end-long)]
+    {:satellites (vec (map #(sat-from-geo % EARTH-RADIUS) geo-satellites))
+     :route {:start route-start
+             :end route-end}}))
+
+
+(defn parse-data-file
   " Opens and parses the data file. Returns a hashmap with all the data. "
   [filepath] ; could be switched to json, url or whatever
   (loop [lines (csv/parse-csv (slurp filepath))


implement custom layer options

implement custom layer options

--- src/cljs/infinitelives/pixi/canvas.cljs
+++ src/cljs/infinitelives/pixi/canvas.cljs
@@ -112,10 +112,11 @@

 (defn make-stage
   "Layout the stage structure"
-  [{:keys [layers
+  [{:keys [layers origins
            ]
       :or {
-           layers [:backdrop :below :world :above :ui :effect]}}]
+           layers [:backdrop :below :world :above :ui :effect]
+           origins {}}}]

   ;(.log js/console (str layers))
   (let [
@@ -125,6 +126,7 @@
         ]
     {
      :stage stage
+     :origins origins
      :layers layers
      :layer
      (into {}
@@ -132,17 +134,66 @@
              [k v]))}))

-(defn- center-container! [canvas layer]
+(defn- center-container! [canvas layer edge]
   (let [canvas-width (.-width canvas)
         canvas-height (.-height canvas)
         middle-x (Math/round (/ canvas-width 2))
         middle-y (Math/round (/ canvas-height 2))]

-    (log (str "w:" canvas-width " h:" canvas-height))
-
-    ;; start with world centered
-    (set! (.-position.x layer) middle-x)
-    (set! (.-position.y layer) middle-y)))
+    ;(log (str "w:" canvas-width " h:" canvas-height))
+
+    (case edge
+      :center
+      (do
+        ;; start with world centered
+        (set! (.-position.x layer) middle-x)
+        (set! (.-position.y layer) middle-y))
+
+      :top
+      (do
+        (set! (.-position.x layer) middle-x)
+        (set! (.-position.y layer) 0))
+
+      :bottom
+      (do
+        (set! (.-position.x layer) middle-x)
+        (set! (.-position.y layer) canvas-height))
+
+      :left
+      (do
+        (set! (.-position.x layer) 0)
+        (set! (.-position.y layer) middle-y))
+
+      :right
+      (do
+        (set! (.-position.x layer) canvas-width)
+        (set! (.-position.y layer) middle-y))
+
+      :top-left
+      (do
+        (set! (.-position.x layer) 0)
+        (set! (.-position.y layer) 0))
+
+      :top-right
+      (do
+        (set! (.-position.x layer) canvas-width)
+        (set! (.-position.y layer) 0))
+
+      :bottom-left
+      (do
+        (set! (.-position.x layer) 0)
+        (set! (.-position.y layer) canvas-height))
+
+      :bottom-right
+      (do
+        (set! (.-position.x layer) canvas-width)
+        (set! (.-position.y layer) canvas-height))
+
+      ;;default
+      (do
+        ;; default layer is centered
+        (set! (.-position.x layer) middle-x)
+        (set! (.-position.y layer) middle-y)))))

 (defn init
@@ -152,6 +203,9 @@
   :expand        if true makes the canvas take the entire window
   :engine        can be :webgl :canvas or :auto (default :auto)
   :layers        A list of keywords to refer to layers, from bottom to top
+  :origins       A mapping of layer names to their origin positions. Default
+                 position is center. Positions can be :center :top :bottom
+                 :left :right :top-left :top-right :bottom-left :bottom-right

   and either:

@@ -165,21 +219,21 @@
   :height        height of new canvas
   "
   [opts]
-  (let [{:keys [renderer canvas layer layers stage] :as world}
+  (let [{:keys [renderer canvas layer layers stage
+                origins] :or {origins {}} :as world}
         (into (make opts)
               (make-stage opts))]
     ;; add the stages to the canvas
     (doall
      (map
       (fn [[name layer-obj]]
-        (log "adding to:" (str stage) " layer:" (str layer-obj))
+        ;(log "adding to:" (str stage) " layer:" (str layer-obj))
         (.addChild stage layer-obj)
-        (center-container! canvas layer-obj)
-        )
+        (center-container! canvas layer-obj (or (origins name) :center)))
       layer))

     ;; do the first render
-    ;(doall (for [l layers] (.render renderer (l layer))))
+                                        ;(doall (for [l layers] (.render renderer (l layer))))
     (.render renderer stage)

     (let [
@@ -194,8 +248,10 @@
                       )
           resize-fn (fn [width height]
                       (.resize renderer width height)
-                      (doall (map (partial center-container! canvas)
-                                  (map second layer))))
+                      (doall (map (fn [[name layer-obj]]
+                                    (center-container! canvas layer-obj
+                                                       (or (origins name) :center)))
+                                  layer)))
           expand-fn (fn [] (resize-fn (.-innerWidth js/window)
                                       (.-innerHeight js/window)))


Updated visualization demo call to dc/spatial.

--- src/cmr/demos/visual_spatial_search.clj
+++ src/cmr/demos/visual_spatial_search.clj
@@ -95,8 +95,8 @@
     (ingest/reset)
     (ingest/create-provider "PROV1")

-    (let [coll-geodetic (d/ingest "PROV1" (dc/collection {:spatial-coverage (dc/spatial :geodetic)}))
-          coll-cartesian (d/ingest "PROV1" (dc/collection {:spatial-coverage (dc/spatial :cartesian)}))]
+    (let [coll-geodetic (d/ingest "PROV1" (dc/collection {:spatial-coverage (dc/spatial {:gsr :geodetic})}))
+          coll-cartesian (d/ingest "PROV1" (dc/collection {:spatial-coverage (dc/spatial {:gsr :cartesian})}))]
       (doseq [shape shapes]
         (let [coll (if (= :cartesian (:coordinate-system shape))
                      coll-cartesian


Remove invalid ast gen

Remove invalid ast gen

--- src/com/wsscode/pathom/specs/ast.cljc
+++ src/com/wsscode/pathom/specs/ast.cljc
@@ -9,14 +9,7 @@
 (s/def ::union-key ::q/property)

 (s/def ::children
-  (s/coll-of ::node :kind vector?
-    :gen #(let [g (s/gen (s/coll-of ::node :kind vector? :max-count 5))]
-            (gen/->Generator
-              (fn [rdn size]
-                (if (> q/*query-gen-max-depth* 0)
-                  (binding [q/*query-gen-max-depth* (dec q/*query-gen-max-depth*)]
-                    (gen/call-gen g rdn size))
-                  (gen/call-gen (gen/return []) rdn size)))))))
+  (s/coll-of ::node :kind vector?))

 (s/def ::root
   (s/and (s/keys :req-un [::type ::children])


Couple of rect utils

Couple of rect utils

--- flatguicore/src/flatgui/util/rectmath.clj
+++ flatguicore/src/flatgui/util/rectmath.clj
@@ -92,8 +92,8 @@
     (fully-contains? b a)
     b
     :else
-    (let [h-inter (rectmath/line& (:x a) (+ (:x a) (:w a)) (:x b) (+ (:x b) (:w b)))
-          v-inter (rectmath/line& (:y a) (+ (:y a) (:h a)) (:y b) (+ (:y b) (:h b)))
+    (let [h-inter (line& (:x a) (+ (:x a) (:w a)) (:x b) (+ (:x b) (:w b)))
+          v-inter (line& (:y a) (+ (:y a) (:h a)) (:y b) (+ (:y b) (:h b)))
           v-edge (and (nil? v-inter) (or
                                        (= (:y b) (+ (:y a) (:h a)))
                                        (= (:y a) (+ (:y b) (:h b)))))]


Fixed extra parenthesis in type-id function.

--- nav-obj-splitter.clj
+++ nav-obj-splitter.clj
@@ -15,7 +15,7 @@
 		(= type "Dataport") 4
 		(= type "Codeunit") 5
 		(= type "XMLport") 6
-		(= type "MenuSuite") 7)
+		(= type "MenuSuite") 7
 		(= type "Page") 8))

 (defn parse-first-line [line]


CMR-4134 - Added service implementations for saving and validating UMM-Vars.

This change also reorganizes the remaining code in the namespace to be grouped
by functional area.

--- ingest-app/src/cmr/ingest/services/ingest_service.clj
+++ ingest-app/src/cmr/ingest/services/ingest_service.clj
@@ -27,6 +27,69 @@
     [cmr.umm-spec.versioning :as ver]
     [cmr.umm.collection.entry-id :as eid]))

+(defn- fix-ingest-concept-format
+   "Fixes formats"
+  [fmt]
+  (if (or
+        (not (mt/umm-json? fmt))
+        (mt/version-of fmt))
+    fmt
+    (str fmt ";version=" (config/ingest-accept-umm-version))))
+
+(defn reset
+  "Resets the queue broker"
+  [context]
+  (let [queue-broker (get-in context [:system :queue-broker])]
+    (queue/reset queue-broker))
+  (bulk-update/reset-db context)
+  (cache/reset-caches context))
+
+(def health-check-fns
+  "A map of keywords to functions to be called for health checks"
+  {:oracle #(conn/health (pah/context->db %))
+   :echo rest/health
+   :metadata-db mdb2/get-metadata-db-health
+   :indexer indexer/get-indexer-health
+   :cubby cubby/get-cubby-health
+   :message-queue #(queue/health (get-in % [:system :queue-broker]))})
+
+(defn health
+  "Returns the health state of the app."
+  [context]
+  (let [dep-health (util/map-values #(% context) health-check-fns)
+        ok? (every? :ok? (vals dep-health))]
+    {:ok? ok?
+     :dependencies dep-health}))
+
+(defn-timed delete-concept
+  "Delete a concept from mdb and indexer. Throws a 404 error if the concept does not exist or
+  the latest revision for the concept is already a tombstone."
+  [context concept-attribs]
+  (let [{:keys [concept-type provider-id native-id]} concept-attribs
+        existing-concept (first (mdb/find-concepts context
+                                                   {:provider-id provider-id
+                                                    :native-id native-id
+                                                    :exclude-metadata true
+                                                    :latest true}
+                                                   concept-type))
+        concept-id (:concept-id existing-concept)]
+    (when-not concept-id
+      (errors/throw-service-error
+        :not-found (cmsg/invalid-native-id-msg concept-type provider-id native-id)))
+    (when (:deleted existing-concept)
+      (errors/throw-service-error
+        :not-found (format "Concept with native-id [%s] and concept-id [%s] is already deleted."
+                           native-id concept-id)))
+    (let [concept (-> concept-attribs
+                      (dissoc :provider-id :native-id)
+                      (assoc :concept-id concept-id :deleted true))
+          {:keys [revision-id]} (mdb/save-concept context concept)]
+      {:concept-id concept-id, :revision-id revision-id})))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; Collection Service Functions
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
 (defn add-extra-fields-for-collection
   "Returns collection concept with fields necessary for ingest into metadata db
   under :extra-fields."
@@ -67,15 +130,6 @@
     {:collection sanitized-collection
      :warnings warnings}))

-(defn- fix-ingest-concept-format
-   "Fixes formats"
-  [fmt]
-  (if (or
-        (not (mt/umm-json? fmt))
-        (mt/version-of fmt))
-    fmt
-    (str fmt ";version=" (config/ingest-accept-umm-version))))
-
 (defn-timed validate-and-prepare-collection
   "Validates the collection and adds extra fields needed for metadata db. Throws a service error
   if any validation issues are found and errors are enabled, otherwise returns errors as warnings."
@@ -91,6 +145,24 @@
      context (assoc coll-concept :umm-concept collection))
     {:concept coll-concept
      :warnings warnings}))
+
+(defn-timed save-collection
+  "Store a concept in mdb and indexer.
+   Return entry-titile, concept-id, revision-id, and warnings."
+  [context concept validation-options]
+  (let [{:keys [concept warnings]} (validate-and-prepare-collection context
+                                                                    concept
+                                                                    validation-options)]
+    (let [{:keys [concept-id revision-id]} (mdb/save-concept context concept)
+          entry-title (get-in concept [:extra-fields :entry-title])]
+      {:entry-title entry-title
+       :concept-id concept-id
+       :revision-id revision-id
+       :warnings warnings})))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; Granule Service Functions
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 (defn- validate-granule-collection-ref
   "Throws bad request exception when collection-ref is missing required fields."
@@ -179,66 +251,54 @@
         {:keys [concept-id revision-id]} (mdb/save-concept context concept)]
     {:concept-id concept-id, :revision-id revision-id}))

-(defn-timed save-collection
-  "Store a concept in mdb and indexer.
-   Return entry-titile, concept-id, revision-id, and warnings."
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; Variable Service Functions
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defn get-variable-concept-warnings
+  "Validate the UMM-Var concept against the following:
+  * The JSON schema
+  * Data
+  * Non-fatal errors"
+  [context variable validation-options]
+  (let [schema-warnings (v/validate-variable-umm-spec-schema
+                         variable validation-options)]
+    (->> (concat (v/umm-spec-validate-variable
+                  variable validation-options context true)
+                 (v/umm-spec-validate-variable-warnings
+                  variable validation-options context))
+         (map #(str (:path %) " " (str/join " " (:errors %))))
+         (concat schema-warnings))))
+
+(defn-timed validate-variable
+  "Validates a variable concept and parses it. Returns the UMM record and any
+  warnings from validation."
   [context concept validation-options]
-  (let [{:keys [concept warnings]} (validate-and-prepare-collection context
-                                                                    concept
-                                                                    validation-options)]
-    (let [{:keys [concept-id revision-id]} (mdb/save-concept context concept)
-          entry-title (get-in concept [:extra-fields :entry-title])]
-      {:entry-title entry-title
-       :concept-id concept-id
-       :revision-id revision-id
-       :warnings warnings})))
-
-(defn-timed delete-concept
-  "Delete a concept from mdb and indexer. Throws a 404 error if the concept does not exist or
-  the latest revision for the concept is already a tombstone."
-  [context concept-attribs]
-  (let [{:keys [concept-type provider-id native-id]} concept-attribs
-        existing-concept (first (mdb/find-concepts context
-                                                   {:provider-id provider-id
-                                                    :native-id native-id
-                                                    :exclude-metadata true
-                                                    :latest true}
-                                                   concept-type))
-        concept-id (:concept-id existing-concept)]
-    (when-not concept-id
-      (errors/throw-service-error
-        :not-found (cmsg/invalid-native-id-msg concept-type provider-id native-id)))
-    (when (:deleted existing-concept)
-      (errors/throw-service-error
-        :not-found (format "Concept with native-id [%s] and concept-id [%s] is already deleted."
-                           native-id concept-id)))
-    (let [concept (-> concept-attribs
-                      (dissoc :provider-id :native-id)
-                      (assoc :concept-id concept-id :deleted true))
-          {:keys [revision-id]} (mdb/save-concept context concept)]
-      {:concept-id concept-id, :revision-id revision-id})))
-
-(defn reset
-  "Resets the queue broker"
-  [context]
-  (let [queue-broker (get-in context [:system :queue-broker])]
-    (queue/reset queue-broker))
-  (bulk-update/reset-db context)
-  (cache/reset-caches context))
-
-(def health-check-fns
-  "A map of keywords to functions to be called for health checks"
-  {:oracle #(conn/health (pah/context->db %))
-   :echo rest/health
-   :metadata-db mdb2/get-metadata-db-health
-   :indexer indexer/get-indexer-health
-   :cubby cubby/get-cubby-health
-   :message-queue #(queue/health (get-in % [:system :queue-broker]))})
-
-(defn health
-  "Returns the health state of the app."
-  [context]
-  (let [dep-health (util/map-values #(% context) health-check-fns)
-        ok? (every? :ok? (vals dep-health))]
-    {:ok? ok?
-     :dependencies dep-health}))
+  (let [concept (update-in concept [:format] fix-ingest-concept-format)
+        {:keys [format metadata]} concept
+        variable (spec/parse-metadata context
+                  :varaible format metadata {:sanitize? false})
+        sanitized-variable (spec/parse-metadata
+                            context :variable format metadata)
+        ;; Throw errors for validation on sanitized collection
+        _ (v/umm-spec-validate-variable
+           sanitized-variable validation-options context false)
+        ;; Return warnings for validation errors
+        warnings (get-variable-concept-warnings
+                  context variable validation-options)]
+    ;; Validate ingest business rules for UMM-Vars
+    (v/validate-business-rules
+     context (assoc concept :umm-concept sanitized-variable))
+    {:concept sanitized-variable
+     :warnings warnings}))
+
+(defn-timed save-variable
+  "Store a variable concept in the mdb and return concept-id and revision-id."
+  [context concept validation-options]
+  (let [{:keys [concept warnings]} (validate-variable
+                                    context concept validation-options)
+        {:keys [concept-id revision-id]} (mdb/save-concept context concept)]
+    {:long-name (:long-name concept)
+     :concept-id concept-id
+     :revision-id revision-id
+     :warnings warnings}))


rename figwheel components with fw- prefix

--- src/leiningen/new/chestnut/dev/user.clj
+++ src/leiningen/new/chestnut/dev/user.clj
@@ -1,8 +1,8 @@
 (ns user
   (:require [{{project-ns}}.server]
             [com.stuartsierra.component :as component]
-            [figwheel-sidecar.config :as config]
-            [figwheel-sidecar.system :as sys]
+            [figwheel-sidecar.config :as fw-config]
+            [figwheel-sidecar.system :as fw-sys]
             [clojure.tools.namespace.repl :refer [set-refresh-dirs]]
             [reloaded.repl :refer [system init start stop go reset reset-all]]
             [ring.middleware.reload :refer [wrap-reload]]
@@ -12,8 +12,8 @@
   (merge
    ({{project-ns}}.server/prod-system)
    (component/system-map
-    :figwheel-system (sys/figwheel-system (config/fetch-config))
-    :css-watcher (sys/css-watcher {:watch-paths ["resources/public/css"]}))))
+    :figwheel-system (fw-sys/figwheel-system (fw-config/fetch-config))
+    :css-watcher (fw-sys/css-watcher {:watch-paths ["resources/public/css"]}))))
 {{#less?}}
 (defn start-less []
   (future
@@ -34,4 +34,4 @@
   (go){{less-sass-start}})

 (defn browser-repl []
-  (sys/cljs-repl (:figwheel-system system)))
+  (fw-sys/cljs-repl (:figwheel-system system)))


CLJ-2171 remove printing of non-problem data in explain-printer

Signed-off-by: Alex Miller <99328387f8334f68433c424d2dfd83062f62754b@cognitect.com>

--- src/main/clojure/clojure/spec/alpha.clj
+++ src/main/clojure/clojure/spec/alpha.clj
@@ -233,12 +233,7 @@
           (when-not (#{:path :pred :val :reason :via :in} k)
             (print "\n\t" (pr-str k) " ")
             (pr v)))
-        (newline))
-      (doseq [[k v] ed]
-        (when-not (#{::problems} k)
-          (print (pr-str k) " ")
-          (pr v)
-          (newline))))
+        (newline)))
     (println "Success!")))

 (def ^:dynamic *explain-out* explain-printer)


CLJ-2393 Add secondary sort on spec problem printing

Signed-off-by: Alex Miller <99328387f8334f68433c424d2dfd83062f62754b@cognitect.com>

--- src/main/clojure/clojure/spec/alpha.clj
+++ src/main/clojure/clojure/spec/alpha.clj
@@ -228,7 +228,9 @@
   "Default printer for explain-data. nil indicates a successful validation."
   [ed]
   (if ed
-    (let [problems (sort-by #(- (count (:path %))) (::problems ed))]
+    (let [problems (->> (::problems ed)
+                     (sort-by #(- (count (:in %))))
+                     (sort-by #(- (count (:path %)))))]
       ;;(prn {:ed ed})
       (doseq [{:keys [path pred val reason via in] :as prob} problems]
         (pr val)


Fix TCLI-93 by replacing pp/cl-format with regular format

--- src/main/clojure/clojure/tools/cli.cljc
+++ src/main/clojure/clojure/tools/cli.cljc
@@ -1,8 +1,7 @@
 (ns ^{:author "Gareth Jones, Sung Pae, Sean Corfield"
       :doc "Tools for working with command line arguments."}
   clojure.tools.cli
-  (:require [clojure.pprint :as pp]
-            [clojure.string :as s]))
+  (:require [clojure.string :as s]))

 (defn- tokenize-args
   "Reduce arguments sequence into [opt-type opt ?optarg?] vectors and a vector
@@ -53,6 +52,11 @@
             (recur opts (conj argv car) cdr)))
         [opts argv]))))

+(defn- make-format
+  "Given a sequence of column widths, return a string suitable for use in
+  format to print a sequences of strings in those columns."
+  [lens]
+  (s/join (map #(str "  %" (if-not (zero? %) (str "-" %)) "s") lens)))
 ;;
 ;; Legacy API
 ;;
@@ -75,7 +79,8 @@
         vs (for [d docs]
              (mapcat (fn [& x] (apply vector x)) max-cols d))]
     (doseq [v vs]
-      (pp/cl-format true "~{ ~vA  ~vA  ~vA ~}" v)
+      (let [fmt (make-format (take-nth 2 v))]
+        (print (apply format fmt (take-nth 2 (rest v)))))
       (prn))))

 (defn- name-for [k]
@@ -484,10 +489,8 @@
   not displaying defaults. There are three sequences of lengths if we
   are showing defaults."
   [lens parts]
-  (let [fmt (case (count lens)
-              2 "~{  ~vA  ~vA~}"
-              3 "~{  ~vA  ~vA  ~vA~}")]
-    (map #(s/trimr (pp/cl-format nil fmt (interleave lens %))) parts)))
+  (let [fmt (make-format lens)]
+    (map #(s/trimr (apply format fmt %)) parts)))

 (defn- required-arguments [specs]
   (reduce


remove unnecessary :import

remove unnecessary :import

--- gae/src/gae/user.clj
+++ gae/src/gae/user.clj
@@ -4,9 +4,7 @@
             [ring.util.servlet :as ring]))

 (defn -service
-  [^HttpServlet this
-   ^HttpServletRequest rqst
-   ^HttpServletRequest resp]
+  [this rqst resp]
   (do
     (println "gae.user -service method implementation invoked")
     (let [request-map  (ring/build-request-map rqst)


(PDB-3394) Only query for factset_id once when updating facts

--- src/puppetlabs/puppetdb/scf/storage.clj
+++ src/puppetlabs/puppetdb/scf/storage.clj
@@ -1240,7 +1240,7 @@
                  (jdbc/in-clause rm-pids))
          (cons factset-id rm-pids)))

-      (insert-facts! (certname-to-factset-id certname)
+      (insert-facts! factset-id
                      (map paths->ids new-pathstrs)
                      new-values)


Fix craft submenus

Fix craft submenus

--- src/robinson/ui/components/robinson.clj
+++ src/robinson/ui/components/robinson.clj
@@ -287,6 +287,46 @@
                                  (not (nil? (get-in state [:world  :quests (quest :id) :stage] nil))))
                                (:quests state))))

+(zc/def-component MultiSelect
+  [this]
+  (let [{:keys [style]} (zc/props this)
+        default-props {:selected-hotkeys []
+                       :items []
+                       :disable? (fn [_] false)}
+        {:keys [title selected-hotkeys items disable?]} (merge default-props (zc/props this))
+        children (map (fn [item]
+                        (zc/csx [:text {:style {:color (rcolor/color->rgb (if (or (not (disable? item))
+                                                                                (get item :applicable))
+                                                                            :black
+                                                                            :gray))
+                                                :background-color (rcolor/color->rgb :white)}} [
+                                  [Highlight {} [(str (or (item :hotkey)
+                                                          \space))]]
+                                  [:text {} [(format "%c%s%s %s %s"
+                                               (if (contains? (set selected-hotkeys) (get item :hotkey))
+                                                 \+
+                                                 \-)
+                                               (if (contains? item :count)
+                                                 (format "%dx " (int (get item :count)))
+                                                 "")
+                                               (get item :name)
+                                               (if (contains? item :utility)
+                                                 (format "(%d%%)" (int (get item :utility)))
+                                                 "")
+                                               (cond
+                                                 (contains? item :wielded)
+                                                   "(wielded)"
+                                                 (contains? item :wielded-ranged)
+                                                   "(wielded ranged)"
+                                                 (contains? item :worn)
+                                                   "(worn)"
+                                                 :else
+                                                   ""))]]]]))
+                      items)]
+    (zc/csx [:view {:style (or style {})} (concat [(zc/csx [:text {:style {:color (rcolor/color->rgb :black)}} [title]])
+                               (zc/csx [:text {} [""]])]
+                              children)])))
+

 (zc/def-component CraftSubmenu
   [this]
@@ -300,14 +340,19 @@
                             :height 10
                             :padding 1
                             :bottom 1
+                            :display :flex
+                            :flex-direction :row
+                            :align-itmes :stretch
                             :background-color (rcolor/color->rgb :white)}} [
-              [MultiSelect {:title " Types"
-                            :selected-hotkeys [hotkey]
-                            :items (map (fn [recipe]
-                                           (log/info (get recipe :hotkey))
-                                           {:name (get recipe :name) :hotkey (get recipe :hotkey)})
-                                        recipes)}]
-              [:view {:style {:top -10 :left 30}} [
+              [:view {:style {:flex 1}} [
+                [MultiSelect {:style {:width 30}
+                              :title " Types"
+                              :selected-hotkeys [hotkey]
+                              :items (map (fn [recipe]
+                                             (log/info (get recipe :hotkey))
+                                             {:name (get recipe :name) :hotkey (get recipe :hotkey)})
+                                          recipes)}]]]
+              [:view {:style {:flex 1}} [
                 ;; render recipe-info
                 (if hotkey
                   (let [matching-recipes   (filter (fn [recipe] (= (get recipe :hotkey) hotkey))
@@ -340,85 +385,7 @@
                                             [{:s "N/A" :fg :black :bg :white :style #{}}]
                                             (map (fn [id] {:s (id->name id) :fg :black :bg :white :style #{}}) have)))}]))
                                           [:text {} ["Select a recipe"]])]]]])))
-#_(defn render-craft-submenu
-  "Render the craft submenu"
-  [state recipe-type]
-  (let [screen               (state :screen)
-        selected-recipe-path (get-in state [:world :craft-recipe-path])
-        hotkey               (when selected-recipe-path
-                               (last selected-recipe-path))
-        recipes              (get (get-recipes state) recipe-type)]
-  (log/info "recipe-type" recipe-type)
-  (log/info "recipes" (get-recipes state))
-  (log/info "selected recipes" recipes)
-  ;; render recipes
-  (render-list screen :ui 11 6 29 15
-    (concat
-      [{:s (name recipe-type) :fg :black :bg :white :style #{:underline}}]
-       (map (fn [recipe]
-              {:s (format "%c-%s"
-                    (get recipe :hotkey)
-                    (get recipe :name))
-               :fg (if (contains? recipe :applicable)
-                     :black
-                     :gray)
-               :bg :white
-               :style (if (= (get recipe :hotkey) hotkey)
-                         #{:invert}
-                         #{})})
-            recipes)))
-  ;; render recipe-info
-  (if hotkey
-    (let [matching-recipes   (filter (fn [recipe] (= (get recipe :hotkey) hotkey))
-                                     recipes)
-          recipe             (get (first matching-recipes) :recipe)
-          exhaust            (get recipe :exhaust [])
-          have               (get recipe :have-or [])
-          inventory-id-freqs (rp/inventory-id-freqs state)]
-      (log/info "exhaust" exhaust "have" have)
-      (render-list screen :ui 41 6 29 15
-      (concat
-        [{:s "" :fg :black :bg :white :style #{}}
-         {:s "Consumes" :fg :black :bg :white :style #{}}]
-        (if (empty? exhaust)
-          [{:s "N/A" :fg :black :bg :white :style #{}}]
-          (let [idx-ids (mapcat (fn [ids]
-                           (map-indexed vector ids))
-                         (partition-by identity (sort exhaust)))]
-            (println "idx-ids" idx-ids)
-            (reduce (fn [lines [idx id]]
-                      (conj lines
-                            (if (< idx (get inventory-id-freqs id 0))
-                              {:s (id->name id) :fg :black :bg :white :style #{}}
-                              {:s (id->name id) :fg :gray :bg :white :style #{}})))
-                   []
-                   idx-ids)))
-        [{:s "" :fg :black :bg :white :style #{}}
-         {:s "Required tools" :fg :black :bg :white :style #{}}]
-        (if (empty? have)
-          [{:s "N/A" :fg :black :bg :white :style #{}}]
-          (map (fn [id] {:s (id->name id) :fg :black :bg :white :style #{}}) have)))))
-    (render-list screen :ui 41 6 29 15
-        [{:s "Select a recipe" :fg :black :bg :white :style #{}}]))
-  (render-rect-single-border screen 10 5 60 15 :black :white)
-  (render-vertical-border screen 40 6 15 :black :white)
-  (put-string screen :ui 40 20 "\u2534" :black :white)
-  (put-string screen :ui 37 5 "Craft" :black :white)))
-
-#_(defn render-wield
-  "Render the wield item menu if the world state is `:wield`."
-  [state]
-  (render-multi-select (state :screen) "Wield" [] (filter can-be-wielded? (-> state :world :player :inventory))))
-
-#_(defn render-wield-ranged
-  "Render the wield ranged  item menu if the world state is `:wield-ranged`."
-  [state]
-  (render-multi-select (state :screen) "Wield Ranged" [] (filter can-be-wielded-for-ranged-combat? (-> state :world :player :inventory))))
-
-#_(defn render-harvest
-  "Render the harvest prompt if the world state is `:harvest`."
-  [state]
-  (put-string (state :screen) :ui 0 0 "Pick a direction to harvest."))
+

 ; FIXME render raft
 ; ; FIXME render raft
@@ -929,45 +896,6 @@
                               :color color
                               :background-color background-color}} ["\u2592"]]]])))

-(zc/def-component MultiSelect
-  [this]
-  (let [default-props {:selected-hotkeys []
-                       :items []
-                       :disable? (fn [_] false)}
-        {:keys [title selected-hotkeys items disable?]} (merge default-props (zc/props this))
-        children (map (fn [item]
-                        (zc/csx [:text {:style {:color (rcolor/color->rgb (if (or (not (disable? item))
-                                                                                (get item :applicable))
-                                                                            :black
-                                                                            :gray))
-                                                :background-color (rcolor/color->rgb :white)}} [
-                                  [Highlight {} [(str (or (item :hotkey)
-                                                          \space))]]
-                                  [:text {} [(format "%c%s%s %s %s"
-                                               (if (contains? (set selected-hotkeys) (get item :hotkey))
-                                                 \+
-                                                 \-)
-                                               (if (contains? item :count)
-                                                 (format "%dx " (int (get item :count)))
-                                                 "")
-                                               (get item :name)
-                                               (if (contains? item :utility)
-                                                 (format "(%d%%)" (int (get item :utility)))
-                                                 "")
-                                               (cond
-                                                 (contains? item :wielded)
-                                                   "(wielded)"
-                                                 (contains? item :wielded-ranged)
-                                                   "(wielded ranged)"
-                                                 (contains? item :worn)
-                                                   "(worn)"
-                                                 :else
-                                                   ""))]]]]))
-                      items)]
-    (zc/csx [:view {} (concat [(zc/csx [:text {:style {:color (rcolor/color->rgb :black)}} [title]])
-                               (zc/csx [:text {} [""]])]
-                              children)])))
-
 ; Render the pickup item menu if the world state is `:pickup-selection`.
 (zc/def-component PickupSelection
   [this]
@@ -1259,8 +1187,7 @@
 (zc/def-component Craft
   [this]
   (let [{:keys [game-state]} (zc/props this)]
-    (zc/csx [zcui/Popup {:style {:position :fixed :top 1
-                                 :color (rcolor/color->rgb :black)
+    (zc/csx [zcui/Popup {:style {:color (rcolor/color->rgb :black)
                                  :background-color (rcolor/color->rgb :white)}} [
                 [MultiSelect {:title "Craft"
                               :items [{:name "Weapons" :hotkey \w}
@@ -1271,7 +1198,7 @@
 (zc/def-component CraftWeapon
   [this]
   (let [{:keys [game-state]} (zc/props this)]
-    (zc/csx [zcui/Popup {:style {:position :relative :top -15
+    (zc/csx [zcui/Popup {:style {:margin-top 5
                                  :color (rcolor/color->rgb :black)
                                  :background-color (rcolor/color->rgb :white)}} [
               [:text {:style {:bottom 1}} ["| Craft Weapon |"]]
@@ -1280,7 +1207,8 @@
 (zc/def-component CraftSurvival
   [this]
   (let [{:keys [game-state]} (zc/props this)]
-    (zc/csx [zcui/Popup {:style {:position :relative :top -15
+    (zc/csx [zcui/Popup {:style {:margin-top 5
+                                 :height 17
                                  :color (rcolor/color->rgb :black)
                                  :background-color (rcolor/color->rgb :white)}} [
               [:text {:style {:bottom 1}} ["| Craft Survival |"]]
@@ -1289,7 +1217,7 @@
 (zc/def-component CraftShelter
   [this]
   (let [{:keys [game-state]} (zc/props this)]
-    (zc/csx [zcui/Popup {:style {:position :relative :top -15
+    (zc/csx [zcui/Popup {:style {:margin-top 5
                                  :color (rcolor/color->rgb :black)
                                  :background-color (rcolor/color->rgb :white)}} [
               [:text {:style {:bottom 1}} ["| Craft Shelter |"]]
@@ -1298,7 +1226,8 @@
 (zc/def-component CraftTransportation
   [this]
   (let [{:keys [game-state]} (zc/props this)]
-    (zc/csx [zcui/Popup {:style {:position :relative :top -15
+    (zc/csx [zcui/Popup {:style {:margin-top 5
+                                 :height 15
                                  :color (rcolor/color->rgb :black)
                                  :background-color (rcolor/color->rgb :white)}} [
               [:text {:style {:bottom 1}} ["| Craft Transportation |"]]
@@ -1320,8 +1249,17 @@

 (zc/def-component WieldRanged
   [this]
-  (let [{:keys [game-state]} (zc/props this)]
-    nil))
+  (let [{:keys [game-state]} (zc/props this)
+        player-items (filter can-be-wielded-for-ranged-combat? (-> game-state :world :player :inventory))]
+   (zc/csx [:view {:style {:width 40
+                           :height 20
+                           :position :fixed
+                           :left 40
+                           :top 1
+                           :padding 1
+                           :background-color (rcolor/color->rgb :white)}} [
+            [MultiSelect {:title "Wield"
+                          :items (translate-identified-items game-state player-items)}]]])))

 (zc/def-component StartText
   [this]
@@ -1388,15 +1326,14 @@
                              (> thirst max-thirst) "not drinking enough water"
                              (<= will-to-live 0)   "just giving up on life"
                              :else                 "mysterious causes")))]
-      (zc/csx [zcui/Popup {:style {:position :fixed :top 10}} [
-                [:view {:style {:border 2}} [
+      (zc/csx [zcui/Popup {:style {:border 2}} [
                   [:text {} ["You died."]]
                   [:text {} [(format "From %s" cause-of-death)]]
                   [:text {} [""]]
                   [:text {} [
                     [:text {} ["Press "]]
                     [Highlight {} ["space "]]
-                    [:text {} ["to continue."]]]]]]]])))
+                    [:text {} ["to continue."]]]]]])))

 (zc/def-component QuitPrompt
   [this]
@@ -1494,7 +1431,7 @@
                         [:text {:style {:color down-arrow-color}} [down-arrow-char]]]])
               (zc/csx [:text {} ["   "]]))
             (if (get message :text)
-              (zc/csx [:text {:style {:color (rcolor/color->rgb :white #_(name (get message :color)))}} [(str (get message :text))]])
+              (zc/csx [:text {:style {:color (rcolor/color->rgb (get message :color))}} [(str (get message :text))]])
               (zc/csx [:text {} [""]]))]]]])))

 (defn target-pos [game-state]
@@ -1596,15 +1533,6 @@
             [Hud {:game-state game-state}]
             [MapUI {:game-state game-state}]]]]]]])))

-#_(defn render-enter-name [state]
-  (let [screen (state :screen)
-        player-name (get-in state [:world :player :name])]
-    (clear (state :screen))
-    (put-string screen :ui 30 5 "Robinson")
-    (put-string screen :ui 20 7 "Name:___________________")
-    (put-string screen :ui 25 7 (str player-name "\u2592"))
-    (refresh screen)))
-
 (def loading-index (atom 0))
 (def loading-tidbits
   ["rat swarm"


(maint) Fix object exists query

(maint) Fix object exists query

The object exists query must return data even for nodes which are
expired or deactivated, since the subresources it filters on are
directly addressable from a search which includes deactivated
and expired nodes.

--- src/puppetlabs/puppetdb/query_eng.clj
+++ src/puppetlabs/puppetdb/query_eng.clj
@@ -98,14 +98,10 @@
                               FROM certnames
                               INNER JOIN catalogs
                                 ON catalogs.certname = certnames.certname
-                              WHERE certnames.certname=?
-                                AND deactivated IS NULL
-                                AND expired IS NULL"
+                              WHERE certnames.certname=?"
                     :node "SELECT 1
                            FROM certnames
-                           WHERE certname=?
-                             AND deactivated IS NULL
-                             AND expired IS NULL"
+                           WHERE certname=? "
                     :report (str "SELECT 1
                                   FROM reports
                                   WHERE " (su/sql-hash-as-str "hash") "=?
@@ -117,9 +113,7 @@
                               FROM certnames
                               INNER JOIN factsets
                               ON factsets.certname = certnames.certname
-                              WHERE certnames.certname=?
-                                AND deactivated IS NULL
-                               AND expired IS NULL")]
+                              WHERE certnames.certname=?")]
     (sql/with-query-results result-set
       [check-sql id]
       (pos? (count result-set)))))


add local reagent dependency

add local reagent dependency

--- examples/project.clj
+++ examples/project.clj
@@ -1,66 +1,66 @@
 (defproject famous-examples "0.1.0-SNAPSHOT"
-  :description "FIXME: write this!"
-  :url "http://example.com/FIXME"
-  :license {:name "Eclipse Public License"
-            :url "http://www.eclipse.org/legal/epl-v10.html"}
+            :description "FIXME: write this!"
+            :url "http://example.com/FIXME"
+            :license {:name "Eclipse Public License"
+                      :url  "http://www.eclipse.org/legal/epl-v10.html"}

-  :dependencies [[org.clojure/clojure "1.6.0"]
-                 [org.clojure/clojurescript "0.0-3119"]
-                 [figwheel "0.2.5"]
-                 [org.clojure/core.async "0.1.346.0-17112a-alpha"]
-                 [com.famous/famous "0.3"]]
+            :dependencies [[org.clojure/clojure "1.6.0"]
+                           [org.clojure/clojurescript "0.0-3119"]
+                           [figwheel "0.2.5"]
+                           [org.clojure/core.async "0.1.346.0-17112a-alpha"]
+                           [com.famous/famous "0.3"]]

-  :plugins [[lein-cljsbuild "1.0.4"]
-            [lein-figwheel "0.2.5"]]
+            :plugins [[lein-cljsbuild "1.0.4"]
+                      [lein-figwheel "0.2.5"]]

-  :source-paths ["src"]
+            :source-paths ["src"]
+            :resource-paths ["/home/ssd2/sto/workspace/reagent/target/reagent-0.5.1-SNAPSHOT-standalone.jar" "resources"]
+            :clean-targets ^{:protect false} ["resources/public/js/compiled"]

-  :clean-targets ^{:protect false} ["resources/public/js/compiled"]
+            :cljsbuild {
+                        :builds [{:id           "dev"
+                                  :source-paths ["src" "dev_src"]
+                                  :compiler     {:output-to            "resources/public/js/compiled/famous_examples.js"
+                                                 :output-dir           "resources/public/js/compiled/out"
+                                                 :optimizations        :none
+                                                 :main                 famous-examples.dev
+                                                 :asset-path           "js/compiled/out"
+                                                 :source-map           true
+                                                 :source-map-timestamp true
+                                                 :cache-analysis       true}}
+                                 {:id           "min"
+                                  :source-paths ["src"]
+                                  :compiler     {:output-to     "resources/public/js/compiled/famous_examples.js"
+                                                 :main          famous-examples.core
+                                                 :optimizations :advanced
+                                                 :pretty-print  false}}]}

-  :cljsbuild {
-    :builds [{:id "dev"
-              :source-paths ["src" "dev_src"]
-              :compiler {:output-to "resources/public/js/compiled/famous_examples.js"
-                         :output-dir "resources/public/js/compiled/out"
-                         :optimizations :none
-                         :main famous-examples.dev
-                         :asset-path "js/compiled/out"
-                         :source-map true
-                         :source-map-timestamp true
-                         :cache-analysis true }}
-             {:id "min"
-              :source-paths ["src"]
-              :compiler {:output-to "resources/public/js/compiled/famous_examples.js"
-                         :main famous-examples.core
-                         :optimizations :advanced
-                         :pretty-print false}}]}
+            :figwheel {
+                       :http-server-root "public"           ;; default and assumes "resources"
+                       :server-port      3449               ;; default
+                       :css-dirs         ["resources/public/css"] ;; watch and update CSS

-  :figwheel {
-             :http-server-root "public" ;; default and assumes "resources"
-             :server-port 3449 ;; default
-             :css-dirs ["resources/public/css"] ;; watch and update CSS
+                       ;; Start an nREPL server into the running figwheel process
+                       ;; :nrepl-port 7888

-             ;; Start an nREPL server into the running figwheel process
-             ;; :nrepl-port 7888
+                       ;; Server Ring Handler (optional)
+                       ;; if you want to embed a ring handler into the figwheel http-kit
+                       ;; server, this is simple ring servers, if this
+                       ;; doesn't work for you just run your own server :)
+                       ;; :ring-handler hello_world.server/handler

-             ;; Server Ring Handler (optional)
-             ;; if you want to embed a ring handler into the figwheel http-kit
-             ;; server, this is simple ring servers, if this
-             ;; doesn't work for you just run your own server :)
-             ;; :ring-handler hello_world.server/handler
+                       ;; To be able to open files in your editor from the heads up display
+                       ;; you will need to put a script on your path.
+                       ;; that script will have to take a file path and a line number
+                       ;; ie. in  ~/bin/myfile-opener
+                       ;; #! /bin/sh
+                       ;; emacsclient -n +$2 $1
+                       ;;
+                       ;; :open-file-command "myfile-opener"

-             ;; To be able to open files in your editor from the heads up display
-             ;; you will need to put a script on your path.
-             ;; that script will have to take a file path and a line number
-             ;; ie. in  ~/bin/myfile-opener
-             ;; #! /bin/sh
-             ;; emacsclient -n +$2 $1
-             ;;
-             ;; :open-file-command "myfile-opener"
+                       ;; if you want to disable the REPL
+                       ;; :repl false

-             ;; if you want to disable the REPL
-             ;; :repl false
-
-             ;; to configure a different figwheel logfile path
-             ;; :server-logfile "tmp/logs/figwheel-logfile.log"
-             })
+                       ;; to configure a different figwheel logfile path
+                       ;; :server-logfile "tmp/logs/figwheel-logfile.log"
+                       })


Fix web-path tests

Fix web-path tests

--- test/adzerk/boot_reload/server_test.clj
+++ test/adzerk/boot_reload/server_test.clj
@@ -1,32 +1,45 @@
 (ns adzerk.boot-reload.server-test
   (:require [clojure.test :refer :all]
-            [adzerk.boot-reload.server :refer :all]))
+            [adzerk.boot-reload.server :refer :all]
+            [clojure.java.io :as io]))

 (deftest web-path-test
   (testing "basic"
-    (is (= "/js/out/saapas/core.js"
-           (web-path {:protocol "http:" :target-path "target"} "js/out/saapas/core.js"))))
+    (is (= {:web-path "/js/out/saapas/core.js"
+            :canonical-path (.getCanonicalPath (io/file "target" "js" "out" "saapas" "core.js"))}
+           (web-path {:target-path "target"} "js/out/saapas/core.js"))))

   (testing "asset-path"
-    (is (= "/js/out/saapas/core.js"
-           (web-path {:protocol "http:" :asset-path "public"} "public/js/out/saapas/core.js")))
+    (is (= {:web-path "/js/out/saapas/core.js"
+            :canonical-path (.getCanonicalPath (io/file "target" "public" "js" "out" "saapas" "core.js"))}
+           (web-path {:asset-path "public"
+                      :target-path "target"}
+                     "public/js/out/saapas/core.js")))

-    (is (= "/js/out/saapas/core.js"
-           (web-path {:protocol "http:" :asset-path "/public"} "public/js/out/saapas/core.js")))
+    (is (= {:web-path "/js/out/saapas/core.js"
+            :canonical-path (.getCanonicalPath (io/file "target" "public" "js" "out" "saapas" "core.js"))}
+           (web-path {:asset-path "/public"
+                      :target-path "target"}
+                     "public/js/out/saapas/core.js")))

-    (is (= "/public/js/out/saapas/core.js"
-           (web-path {:protocol "http:" :asset-path "foobar"} "public/js/out/saapas/core.js"))))
+    (is (= {:web-path "/public/js/out/saapas/core.js"
+            :canonical-path (.getCanonicalPath (io/file "target" "public" "js" "out" "saapas" "core.js"))}
+           (web-path {:asset-path "foobar"
+                      :target-path "target"}
+                     "public/js/out/saapas/core.js"))))

   (testing "cljs-asset-path"
-    (is (= "js/saapas.out/saapas/core.js"
-           (web-path {:protocol "http:"
-                      :asset-path "resources/public/js/saapas.out"
-                      :cljs-asset-path "js/saapas.out"}
+    (is (= {:web-path "js/saapas.out/saapas/core.js"
+            :canonical-path (.getCanonicalPath (io/file "target" "resources" "public" "js" "saapas.out" "saapas" "core.js"))}
+           (web-path {:asset-path "resources/public/js/saapas.out"
+                      :cljs-asset-path "js/saapas.out"
+                      :target-path "target"}
                      "resources/public/js/saapas.out/saapas/core.js"))))

   (testing "windows style paths"
-    (is (= "js/saapas.out/saapas/core.js"
-           (web-path {:protocol "http:"
-                      :asset-path "resources/public/js/saapas.out"
-                      :cljs-asset-path "js/saapas.out"}
+    (is (= {:web-path "js/saapas.out/saapas/core.js"
+            :canonical-path (.getCanonicalPath (io/file "target" "resources" "public" "js" "saapas.out" "saapas" "core.js"))}
+           (web-path {:asset-path "resources/public/js/saapas.out"
+                      :cljs-asset-path "js/saapas.out"
+                      :target-path "target"}
                      "resources\\public\\js\\saapas.out\\saapas\\core.js")))))


Fixup help docs on observe command

Fixup help docs on observe command

--- src/yetibot/core/commands/observe.clj
+++ src/yetibot/core/commands/observe.clj
@@ -138,10 +138,6 @@
 (defn observe-cmd
   "observe [-e event-type] [-u user-pattern] [-c channel-pattern] <pattern> = <cmd> # create an observer

-   When a match occurs, it'll be passed via normal pipe-semantics to <cmd>, e.g.
-   echo <matched-text> | <cmd>. <cmd> may contain a piped expression, but it
-   must be quoted.
-
    When a match occurs the <cmd> will be executed. <cmd> may contain a piped
    expression but it must be quoted. <cmd> can also include template variables:


Add fallback for older versions of cljs when rendering HUD logo


using latest package

using latest package

--- test/celestial/integration/puppet.clj
+++ test/celestial/integration/puppet.clj
@@ -8,6 +8,8 @@
     [celestial.common :only (config)]
     [celestial.puppet-standalone :only (copy-module)]))

+;
+
 (def baseline
   {:system
    {:vmid 33 :cpus  2 :memory 1024 :hostname "redis-test" :disk 30
@@ -16,8 +18,8 @@
     :hypervisor "proxmox"
     }
    :provision
-   {:module  {:name "redis-sandbox-0.3.0"
-              :src "http://dl.bintray.com/content/narkisr/boxes/redis-sandbox-0.3.0.tar.gz"}
+   {:module  {:name "redis-sandbox-0.3.1"
+              :src "http://dl.bintray.com/content/narkisr/boxes/redis-sandbox-0.3.1.tar.gz"}
     :server {:host "192.168.5.33"}}
    }
   )
@@ -28,6 +30,5 @@
 (alter-var-root (var config) (fn [old] local-prox))

 (deftest ^:puppet redis-provision
-  ;(run-jetty app  {:port 8080 :join? true})
-  ;(reload baseline)
+  (reload baseline)
   (puppetize (:provision baseline)))


add more unit tests for clojars.web.common

--- test/clojars/test/unit/web/common.clj
+++ test/clojars/test/unit/web/common.clj
@@ -1,8 +1,6 @@
 (ns clojars.test.unit.web.common
   (:require [clojars.web.common :as common]
             [clojure.test :refer :all]))
-
-;;TODO: more helper tests

 (deftest jar-name-uses-shortest-unique-and-html-escape
   (is (= "group/artifact" (common/jar-name {:jar_name "artifact"
@@ -10,4 +8,20 @@
   (is (= "artifact" (common/jar-name {:jar_name "artifact"
                                       :group_name "artifact"})))
   (is (= "</alert>/<alert>" (common/jar-name {:jar_name "<alert>"
-                                           :group_name "</alert>"}))))+                                           :group_name "</alert>"}))))
+
+(deftest jar-url-uses-shortest-unique
+  (is (= "/group/artifact" (common/jar-url {:jar_name "artifact" :group_name "group"})))
+  (is (= "/artifact" (common/jar-url {:jar_name "artifact" :group_name "artifact"}))))
+
+(deftest error-list-populates-errors-correctly
+  (is (= nil (common/error-list nil)))
+  (is (=
+        [:div {:class :error} [:strong "Blistering barnacles!"] "  Something's not shipshape:" [:ul '([:li "error"])]]
+        (common/error-list ["error"]))))
+
+(deftest user-link-works
+  (is (= [:a {:href "/users/kiwi"} '("kiwi")] (common/user-link "kiwi"))))
+
+(deftest group-link-works
+  (is (= [:a {:href "/groups/artifruit"} '("artifruit")] (common/group-link "artifruit"))))


fix product description

fix product description

--- src/clj/ikea_clojure_cup/search.clj
+++ src/clj/ikea_clojure_cup/search.clj
@@ -41,7 +41,8 @@
   (get-content m "ikea-product-pricetag-name"))

 (defn- get-product-desc [m]
-  (get-content m "ikea-product-pricetag-desc"))
+  (let [d (cs/trim (get-content m "ikea-product-pricetag-desc"))]
+    (subs d 0 (- (count d) 1))))

 (defn- get-hick-products [site-htree]
   (s/select (s/child (s/id "search-list")