CMR-1867 Refactors generate-and-parse test namespace.

The tests now use the parse/generate functions in core. The example
record is updated to reflect the latest UMM schema in regards to the
TemporalExtent. :require is simplified.

--- umm-spec-lib/test/cmr/umm_spec/test/generate_and_parse.clj
+++ umm-spec-lib/test/cmr/umm_spec/test/generate_and_parse.clj
@@ -2,101 +2,94 @@
   "Tests roundtrip XML generation from a Clojure record and parsing it. Ensures that the same data
   is returned."
   (:require [clojure.test :refer :all]
-            [cmr.umm-spec.umm-to-xml-mappings.xml-generator :as xg]
-            [cmr.umm-spec.umm-to-xml-mappings.echo10 :as xm-echo10]
-            [cmr.umm-spec.xml-to-umm-mappings.echo10 :as um-echo10]
-            [cmr.umm-spec.umm-to-xml-mappings.iso19115-2 :as xm-iso2]
-            [cmr.umm-spec.xml-to-umm-mappings.iso19115-2 :as um-iso2]
-            [cmr.umm-spec.umm-to-xml-mappings.dif9 :as xm-dif9]
-            [cmr.umm-spec.xml-to-umm-mappings.dif9 :as um-dif9]
-            [cmr.umm-spec.umm-to-xml-mappings.dif10 :as xm-dif10]
-            [cmr.umm-spec.xml-to-umm-mappings.dif10 :as um-dif10]
-            [cmr.umm-spec.umm-to-xml-mappings.iso-smap :as xm-smap]
-            [cmr.umm-spec.xml-to-umm-mappings.iso-smap :as um-smap]
-            [cmr.umm-spec.xml-to-umm-mappings.parser :as xp]
             [cmr.umm-spec.test.expected-conversion :as expected-conversion]
+            [cmr.umm-spec.core :as core]
             [cmr.umm-spec.models.collection :as umm-c]
             [cmr.umm-spec.models.common :as umm-cmn]
-            [cmr.umm-spec.json-schema :as js]
-            [cmr.umm-spec.core :as c]
             [clj-time.core :as t]
             [cmr.common.util :refer [are2]]))
-
-(def example-record-echo10-supported
-  "This contains an example record will all the fields supported by ECHO10. It supported
-  more initially for demonstration purposes."
-  (umm-c/map->UMM-C
-    {
-     :EntryId (umm-cmn/map->EntryIdType {:Id "short_V1"})
-     :EntryTitle "The entry title V5"
-     :Abstract "A very abstract collection"
-     :TemporalExtent [(umm-cmn/map->TemporalExtentType
-                        {:TemporalRangeType "temp range"
-                         :PrecisionOfSeconds 3
-                         :EndsAtPresentFlag false
-                         :RangeDateTime (mapv umm-cmn/map->RangeDateTimeType
-                                              [{:BeginningDateTime (t/date-time 2000)
-                                                :EndingDateTime (t/date-time 2001)}
-                                               {:BeginningDateTime (t/date-time 2002)
-                                                :EndingDateTime (t/date-time 2003)}])
-                         :SingleDateTime [(t/date-time 2003) (t/date-time 2004)]
-                         :PeriodicDateTime (mapv umm-cmn/map->PeriodicDateTimeType
-                                                 [{:Name "period1"
-                                                   :StartDate (t/date-time 2000)
-                                                   :EndDate (t/date-time 2001)
-                                                   :DurationUnit "YEAR"
-                                                   :DurationValue 4
-                                                   :PeriodCycleDurationUnit "DAY"
-                                                   :PeriodCycleDurationValue 3}
-                                                  {:Name "period2"
-                                                   :StartDate (t/date-time 2000)
-                                                   :EndDate (t/date-time 2001)
-                                                   :DurationUnit "YEAR"
-                                                   :DurationValue 4
-                                                   :PeriodCycleDurationUnit "DAY"
-                                                   :PeriodCycleDurationValue 3}])})]}))

 (def example-record
   "This contains an example record with fields supported by all formats"
   (umm-c/map->UMM-C
-    {:EntryTitle "The entry title V5"
-     :EntryId (umm-cmn/map->EntryIdType {:Id "short_V1"})
-     :Abstract "Abstract description"}))
+   {:EntryTitle "The entry title V5"
+    :EntryId (umm-cmn/map->EntryIdType {:Id "short_V1"})
+    :Abstract "Abstract description"
+    :TemporalExtent [(umm-cmn/map->TemporalExtentType
+                      {:TemporalRangeType "temp range"
+                       :PrecisionOfSeconds 3
+                       :EndsAtPresentFlag false
+                       :RangeDateTime (mapv umm-cmn/map->RangeDateTimeType
+                                            [{:BeginningDateTime (t/date-time 2000)
+                                              :EndingDateTime (t/date-time 2001)}
+                                             {:BeginningDateTime (t/date-time 2002)
+                                              :EndingDateTime (t/date-time 2003)}])})
+                     (umm-cmn/map->TemporalExtentType
+                      {:TemporalRangeType "temp range"
+                       :PrecisionOfSeconds 3
+                       :EndsAtPresentFlag false
+                       :SingleDateTime [(t/date-time 2003) (t/date-time 2004)]})
+                     (umm-cmn/map->TemporalExtentType
+                      {:TemporalRangeType "temp range"
+                       :PrecisionOfSeconds 3
+                       :EndsAtPresentFlag false
+                       :PeriodicDateTime (mapv umm-cmn/map->PeriodicDateTimeType
+                                               [{:Name "period1"
+                                                 :StartDate (t/date-time 2000)
+                                                 :EndDate (t/date-time 2001)
+                                                 :DurationUnit "YEAR"
+                                                 :DurationValue 4
+                                                 :PeriodCycleDurationUnit "DAY"
+                                                 :PeriodCycleDurationValue 3}
+                                                {:Name "period2"
+                                                 :StartDate (t/date-time 2000)
+                                                 :EndDate (t/date-time 2001)
+                                                 :DurationUnit "YEAR"
+                                                 :DurationValue 4
+                                                 :PeriodCycleDurationUnit "DAY"
+                                                 :PeriodCycleDurationValue 3}])})]}))

+(defn xml-round-trip
+  "Returns record after being converted to XML and back to UMM through
+  the given to-xml and to-umm mappings."
+  [record format]
+  (core/parse-metadata :collection format (core/generate-metadata :collection format record)))
+
+(deftest dif9-round-trip
+  (is (= (expected-conversion/convert example-record :dif)
+         (xml-round-trip example-record :dif))))

 (deftest roundtrip-gen-parse
-  (are2 [metadata-format to-xml to-umm]
+  (are2 [metadata-format]
     (= (expected-conversion/convert example-record metadata-format)
-       (xp/parse-xml to-umm (xg/generate-xml to-xml example-record)))
-
+       (xml-round-trip example-record metadata-format))
     "echo10"
-    :echo10 xm-echo10/umm-c-to-echo10-xml um-echo10/echo10-xml-to-umm-c
+    :echo10

     "dif9"
-    :dif xm-dif9/umm-c-to-dif9-xml um-dif9/dif9-xml-to-umm-c
+    :dif

     "dif10"
-    :dif10 xm-dif10/umm-c-to-dif10-xml um-dif10/dif10-xml-to-umm-c
+    :dif10

     "iso-smap"
-    :iso-smap xm-smap/umm-c-to-iso-smap-xml um-smap/iso-smap-xml-to-umm-c
+    :iso-smap

     "ISO19115-2"
-    :iso19115 xm-iso2/umm-c-to-iso19115-2-xml um-iso2/iso19115-2-xml-to-umm-c)
-
-  ;; This is here because echo10 supported additional fields
-  (testing "echo10 supported fields"
-    (let [xml (xg/generate-xml xm-echo10/umm-c-to-echo10-xml example-record-echo10-supported)
-          parsed (xp/parse-xml um-echo10/echo10-xml-to-umm-c xml)
-          expected (expected-conversion/convert example-record-echo10-supported :echo10)]
-      (is (= expected parsed)))))
+    :iso19115))

 (deftest generate-valid-xml
   (testing "valid XML is generated for each format"
-    (are [fmt generator]
-        (empty? (c/validate-xml :collection fmt (xg/generate-xml generator example-record)))
-      :echo10   xm-echo10/umm-c-to-echo10-xml
-      :dif      xm-dif9/umm-c-to-dif9-xml
-      :dif10    xm-dif10/umm-c-to-dif10-xml
-      :iso-smap xm-smap/umm-c-to-iso-smap-xml
-      :iso19115 xm-iso2/umm-c-to-iso19115-2-xml)))
+    (are [fmt]
+        (empty? (core/validate-xml :collection fmt (core/generate-metadata :collection fmt example-record)))
+      :echo10
+      :dif
+      :dif10
+      :iso-smap
+      :iso19115)))
+
+(comment
+  (->> example-record
+       (core/generate-metadata :collection :dif)
+       (core/parse-metadata :collection :dif))
+  )


code maintenance

code maintenance

--- test/misaki/test/compiler/reader.clj
+++ test/misaki/test/compiler/reader.clj
@@ -1,12 +1,11 @@
 (ns misaki.test.compiler.reader
-  (:use misaki.compiler.default.reader
-        clojure.test)
+  (:use
+    misaki.compiler.default.reader
+    clojure.test)
   (:require
-    [clojure.string :as str]
+    [clojure.string  :as str]
     [clojure.java.io :as io])
-  (:import [java.io StringReader PushbackReader])
-  )
-
+  (:import [java.io StringReader PushbackReader]))

 (deftest create-pushback-reader-with-line-test
   (testing "Normal reader test"


Include 5.0 postgres tables when clearing test db

--- test/vip/data_processor/test_helpers.clj
+++ test/vip/data_processor/test_helpers.clj
@@ -83,13 +83,14 @@
       (psql/initialize)
       ;; these vars will be unbound until after psql/initialize, so
       ;; don't set psql-tables until after that's been run
-      (def psql-tables [psql/v5-0-street-segments
-                        psql/xml-tree-validations
-                        psql/xml-tree-values
-                        psql/election_approvals
-                        psql/statistics
-                        psql/validations
-                        psql/results])
+      (def psql-tables (concat (vals psql/v5-0-tables)
+                               [psql/v5-0-street-segments
+                                psql/xml-tree-validations
+                                psql/xml-tree-values
+                                psql/election_approvals
+                                psql/statistics
+                                psql/validations
+                                psql/results]))
       (reset! setup-postgres-has-run true)))
   (f))


ERror, not validation

ERror, not validation

--- src/icecap/api.clj
+++ src/icecap/api.clj
@@ -13,18 +13,17 @@
 (defn create-cap
   "Creates a capability."
   [plan & {store :store kdf :kdf scheme :scheme}]
-  (let [validation (spy (check-plan plan))]
-    (if (nil? validation)
+  (let [error (spy (check-plan plan))]
+    (if (nil? error)
       (let [cap (crypto/make-cap)
             {index :index cap-key :cap-key} (crypto/derive kdf cap)
             encoded-plan (nippy/freeze plan)
             blob (crypto/encrypt scheme cap-key encoded-plan)
             ch (create! store index blob)]
         (async/into {:cap cap} ch))
-      (let [ch (async/chan)]
-        (>!! ch validation)
-        (async/close! ch)
-        ch))))
+      (do
+        (info "every day im errorin")
+        (async/to-chan [(spy {:error error})])))))

 (defn execute-cap
   "Executes a capability."


Macros: Add some explanatory words.

Macros: Add some explanatory words.

--- test/com/nomistech/clojure_the_language/macros/examples.clj
+++ test/com/nomistech/clojure_the_language/macros/examples.clj
@@ -16,9 +16,13 @@
 ;;;; ___________________________________________________________________________
 ;;;; Simple rearranging of arguments.

+;;;; Define a macro:
+
 (defmacro my-if-not-1
   ([test then else]
    (list 'if test else then)))
+
+;;;; A use of the macro:

 (fact
   (let [x 99]
@@ -27,6 +31,11 @@
                  (do (println "It's small") :small)))
   => :large)

+;;;; What's happening?
+;;;; - Before compilation, macro calls are replaced with their macro expansion.
+
+;;;; What's a macro expansion?
+
 (fact
   (macroexpand-1 '(my-if-not-1 (> x 100)
                                (do (println "It's large") :large)
@@ -34,6 +43,10 @@
   => '(if (> x 100)
         (do (println "It's small") :small)
         (do (println "It's large") :large)))
+
+;;;; Is this a good use of macros?
+;;;; Yes, but...
+;;;; - See syntax-quote below.

 ;;;; ___________________________________________________________________________
 ;;;; Intro to syntax-quote and unquote.
@@ -62,3 +75,10 @@
         (do (println "It's small") :small)
         (do (println "It's large") :large)))

+;;;; Is this a good use of macros?
+;;;; Yes, but...
+;;;; - `if-not` is built in to Clojure.
+;;;;   - `if-not` is a macro.
+;;;;   - `if-not` is better than `my-if-not-1`.
+;;;;   - Note that much of Clojure is implemented using macros.
+;;;;     e.g. `and`, `or`, `let`, `cond`, `while`, `letfn`, `with-redefs`, `->`.


Refactor and abstract rendering with `render-pre-wrap` This is a subset of the changes in #109 that seemed to get the most positive response. It's almost purely a refactor intended to make rendering more pluggable. The only new feature is the addition of tracing to (aka `:io.perun/trace` metadata) `render` and `collection`.

--- src/io/perun.clj
+++ src/io/perun.clj
@@ -419,6 +419,45 @@

 (def render-pod (delay (create-pod' render-deps)))

+(defn render-to-paths
+  "Renders paths in `data`, using `renderer` in `pod`, and writes
+  the result to `tmp`.
+
+  `data` should be a map with keys that are fileset paths, and
+  values that are themselves maps with these keys:
+   - `:render-data` the map argument that `renderer` will be called with
+   - `:entry` the metadata for the item being rendered
+
+  All `:entry`s will be returned, after having their `:content` set to the
+  rendering result"
+  [data renderer tmp tracer]
+  (pod/with-call-in @render-pod
+    (io.perun.render/update!))
+  (doall
+   (trace tracer
+          (for [[path {:keys [render-data entry]}] data]
+            (let [content (render-in-pod @render-pod renderer render-data)]
+              (perun/create-file tmp path content)
+              (assoc entry :content content))))))
+
+(defn render-pre-wrap
+  "Handles common rendering task orchestration
+
+  `render-paths-fn` takes two arguments: a fileset, and a map of task options.
+  `options` is a map that must have a `:renderer` key, and any other keys
+  that are required by `render-paths-fn`.
+
+  Returns a boot `with-pre-wrap` result"
+  [render-paths-fn options tracer]
+  (let [tmp  (boot/tmp-dir!)]
+    (boot/with-pre-wrap fileset
+      (let [new-metadata (-> fileset
+                             (render-paths-fn options)
+                             (render-to-paths (:renderer options) tmp tracer))]
+        (-> fileset
+            (perun/merge-meta new-metadata)
+            (commit tmp))))))
+
 (deftask render
   "Render individual pages for entries in perun data.

@@ -439,36 +478,60 @@
    _ filterer FILTER   code "predicate to use for selecting entries (default: `:content`)"
    r renderer RENDERER sym  "page renderer (fully qualified symbol which resolves to a function)"
    m meta     META     edn  "metadata to set on each entry"]
-  (let [tmp     (boot/tmp-dir!)
-        options (merge +render-defaults+ *opts*)]
-    (boot/with-pre-wrap fileset
-      (pod/with-call-in @render-pod
-        (io.perun.render/update!))
-      (let [files (filter (:filterer options) (perun/get-meta fileset))
-            updated-files (doall
-                           (for [{:keys [path] :as file} files]
-                             (let [entry         (merge meta file)
+  (let [options (merge +render-defaults+ *opts*)]
+    (letfn [(render-paths [fileset options]
+              (let [entries (filter (:filterer options) (perun/get-meta fileset))
+                    paths (reduce
+                           (fn [result {:keys [path] :as entry*}]
+                             (let [entry (merge meta entry*)
                                    render-data   {:meta    (perun/get-global-meta fileset)
-                                                  :entries (vec files)
+                                                  :entries (vec entries)
                                                   :entry   entry}
-                                   html          (render-in-pod @render-pod renderer render-data)
                                    page-filepath (perun/create-filepath
                                                   (:out-dir options)
                                                   ; If permalink ends in slash, append index.html as filename
-                                                  (or (some-> (:permalink file)
+                                                  (or (some-> (:permalink entry)
                                                               (string/replace #"/$" "/index.html")
                                                               perun/url-to-path)
                                                       (string/replace path #"(?i).[a-z]+$" ".html")))]
                                (perun/report-debug "render" "rendered page for path" path)
-                               (perun/create-file tmp page-filepath html)
-                               entry)))]
-        (perun/report-info "render" "rendered %s pages" (count files))
-        (perun/merge-meta (commit fileset tmp) updated-files)))))
+                               (assoc result page-filepath {:render-data render-data
+                                                            :entry       entry})))
+                           {}
+                           entries)]
+                (perun/report-info "render" "rendered %s pages" (count paths))
+                paths))]
+      (render-pre-wrap render-paths options :io.perun/render))))
+
+(defn- grouped-paths
+  "Produces path maps of the shape required by `render-to-paths`, based
+  on the provided `fileset` and `options`."
+  [task-name fileset options]
+  (let [global-meta (perun/get-global-meta fileset)
+        grouper (:grouper options)]
+    (->> fileset
+         perun/get-meta
+         (filter (:filterer options))
+         grouper
+         (reduce
+          (fn [result [path {:keys [entries group-meta]}]]
+            (let [sorted        (sort-by (:sortby options) (:comparator options) entries)
+                  page-filepath (perun/create-filepath (:out-dir options) path)
+                  new-entry     (merge {:path          page-filepath
+                                        :canonical-url (str (:base-url global-meta) path)
+                                        :date-build    (:date-build global-meta)}
+                                       group-meta)
+                  render-data   {:meta    global-meta
+                                 :entry   new-entry
+                                 :entries (vec sorted)}]
+              (perun/report-info task-name (str "rendered " task-name " " path))
+              (assoc result page-filepath {:render-data render-data
+                                           :entry       new-entry})))
+          {}))))

 (def ^:private +collection-defaults+
   {:out-dir "public"
    :filterer :content
-   :groupby (fn [data] "index.html")
    :sortby (fn [file] (:date-published file))
    :comparator (fn [i1 i2] (compare i2 i1))})

@@ -492,50 +555,30 @@
    c comparator COMPARATOR code "sort by comparator function"
    p page       PAGE       str  "collection result page path"
    m meta       META       edn  "metadata to set on each collection entry"]
-  (let [tmp       (boot/tmp-dir!)
-        options   (merge +collection-defaults+ *opts* (if-let [p (:page *opts*)]
-                                                        {:groupby (fn [_] p)}))]
+  (let [options (merge +collection-defaults+
+                       (dissoc *opts* :page)
+                       (if-let [p (:page *opts*)]
+                         {:grouper #(-> {p {:entries %}})}
+                         (if-let [gb (:groupby *opts*)]
+                           {:grouper #(->> %
+                                           (group-by gb)
+                                           (map (fn [[page entries]]
+                                                  [page {:entries entries}]))
+                                           (into {}))}
+                           {:grouper #(-> {"index.html" {:entries %}})})))]
     (cond (not (fn? (:comparator options)))
           (u/fail "collection task :comparator option should implement IFn\n")
           (not (ifn? (:filterer options)))
           (u/fail "collection task :filterer option value should implement IFn\n")
           (and (:page options) (:groupby *opts*))
           (u/fail "using the :page option will render any :groupby option setting effectless\n")
-          (not (ifn? (:groupby options)))
+          (and (:groupby options) (not (ifn? (:groupby options))))
           (u/fail "collection task :groupby option value should implement IFn\n")
           (not (ifn? (:sortby options)))
           (u/fail "collection task :sortby option value should implement IFn\n")
           :else
-            (boot/with-pre-wrap fileset
-              (pod/with-call-in @render-pod
-                (io.perun.render/update!))
-
-              (let [files          (perun/get-meta fileset)
-                    filtered-files (filter (:filterer options) files)
-                    grouped-files  (group-by (:groupby options) filtered-files)
-                    global-meta    (perun/get-global-meta fileset)
-                    new-files      (doall
-                                    (map
-                                      (fn [[page page-files]]
-                                        (do
-                                          (let [sorted        (sort-by (:sortby options) (:comparator options) page-files)
-                                                render-data   {:meta    global-meta
-                                                               :entries (vec sorted)}
-                                                html          (render-in-pod @render-pod renderer render-data)
-                                                page-filepath (perun/create-filepath (:out-dir options) page)
-                                                new-entry     (merge
-                                                               meta
-                                                               {:path page-filepath
-                                                                :canonical-url (str (:base-url global-meta) page)
-                                                                :content html
-                                                                :date-build (:date-build global-meta)})]
-                                            (perun/create-file tmp page-filepath html)
-                                            (perun/report-info "collection" "rendered collection %s" page)
-                                            new-entry)))
-                                      grouped-files))
-                    updated-files    (apply conj files (trace :io.perun/collection new-files))
-                    updated-fileset  (perun/set-meta fileset updated-files)]
-                  (commit updated-fileset tmp))))))
+          (let [collection-paths (partial grouped-paths "collection")]
+            (render-pre-wrap collection-paths options :io.perun/collection)))))

 (deftask inject-scripts
   "Inject JavaScript scripts into html files.


Support testing all namespaces

Support testing all namespaces

--- library/src/doo/runner.clj
+++ library/src/doo/runner.clj
@@ -2,5 +2,9 @@
   (:require [cljs.test]))

 (defmacro doo-tests [& namespaces]
-  `(doo.runner/set-entry-point!
+  `(doo.runner/set-entry-point!
      (fn [] (cljs.test/run-tests ~@namespaces))))
+
+(defmacro doo-all-tests []
+  `(doo.runner/set-entry-point!
+     (fn [] (cljs.test/run-all-tests))))


change count to dimensionality

change count to dimensionality

--- src/neuseg/dbn.clj
+++ src/neuseg/dbn.clj
@@ -1,5 +1,6 @@
 (ns neuseg.dbn
-  (:use [clojure.core.matrix :only [set-current-implementation new-vector]])
+  (:use [clojure.core.matrix :only [set-current-implementation
+                                    new-vector dimensionality]])
   (:import (com.guokr.dbn DBN)
            (mikera.vectorz Vectorz)))

@@ -36,7 +37,7 @@
             (.finetune nn lr (vectorize lndata idm) (vectorize lntest odm))))))))

 (defn predict [nn input dim]
-  (if (> (count input) dim)
+  (if (> (dimensionality input) dim)
     (map #(- (* 2 (Math/round %)) 1) (.pridict nn (vectorize input dim)))
     [Double/NaN Double/NaN]))


1.1.0

1.1.0

Update deps

--- ClojureScript/project.clj
+++ ClojureScript/project.clj
@@ -1,11 +1,11 @@
-(defproject bocko-ios "1.0.0"
+(defproject bocko-ios "1.1.0"
   :description "Use Bocko on iOS"
   :dependencies [[org.clojure/clojure "1.8.0"]
-                 [org.clojure/clojurescript "1.9.293"]
-                 [org.clojure/core.async "0.2.395"]
+                 [org.clojure/clojurescript "1.9.562"]
+                 [org.clojure/core.async "0.3.443"]
                  [bocko "1.0.0"]
-                 [org.omcljs/ambly "0.7.0"]]
-  :plugins [[lein-cljsbuild "1.1.4"]]
+                 [ambly "1.0.0"]]
+  :plugins [[lein-cljsbuild "1.1.6"]]
   :source-paths ["src"]
   :clean-targets ["target" "out"]
   :cljsbuild {:builds {:dev


Reformat tests for -> style

Reformat tests for -> style

--- test/grimoire/api/web_test.clj
+++ test/grimoire/api/web_test.clj
@@ -13,16 +13,14 @@
 ;;------------------------------------------------------------------------------

 (deftest list-groups-test
-  (let [?res (-> test-config
-                 api/list-groups)]
+  (let [?res (api/list-groups test-config)]
     (is (succeed? ?res))
     (doseq [?g (result ?res)]
       (is (t/group? ?g)))))

 (deftest list-artifacts-test
   (let [g    (t/->Group "org.clojure")
-        ?res (-> test-config
-                 (api/list-artifacts g))]
+        ?res (api/list-artifacts test-config g)]
     (is (succeed? ?res))
     (doseq [?a (result ?res)]
       (is (t/artifact? ?a)))))
@@ -30,8 +28,7 @@
 (deftest list-versions-test
   (let [a    (-> (t/->Group "org.clojure")
                  (t/->Artifact "clojure"))
-        ?res (-> test-config
-                 (api/list-versions a))]
+        ?res (api/list-versions test-config a)]
     (is (succeed? ?res))
     (doseq [?v (result ?res)]
       (is (t/version? ?v)))))
@@ -41,8 +38,7 @@
                   (t/->Artifact "clojure")
                   (t/->Version "1.6.0")
                   (t/->Platform "clj"))
-        ?res (-> test-config
-                 (api/list-namespaces v))]
+        ?res (api/list-namespaces test-config v)]
     (is (succeed? ?res))
     (doseq [?ns (result ?res)]
       (is (t/namespace? ?ns)))))
@@ -53,8 +49,7 @@
                  (t/->Version "1.6.0")
                  (t/->Platform "clj")
                  (t/->Ns "clojure.core"))
-        ?res (-> test-config
-                 (api/thing->prior-versions ns))]
+        ?res (api/thing->prior-versions test-config ns)]
     (is (succeed? ?res))
     (is (= #{"1.6.0" "1.5.0" "1.4.0"}
            (->> ?res result (map (comp t/thing->name t/thing->version)) set)))))
@@ -65,11 +60,10 @@
                  (t/->Version "1.6.0")
                  (t/->Platform "clj")
                  (t/->Ns "clojure.core"))
-        ?res (-> test-config
-                 (api/list-defs ns))]
+        ?res (api/list-defs test-config ns)]
     (is (succeed? ?res))
     (let [defs (->> ?res result (map t/thing->name) set)]
-      (doseq [d ["for" "def" "let" "catch"]]
+      (doseq [d ["for" "def" "let" "catch" "io!" "every?" "even?" "->>" "+" "-'"]]
         (is (defs d))))))

 (deftest read-meta-test


Test `:field-key` for select-all condition in `forms/format-answer`

Signed-off-by: Njagi Mwaniki <b6a4ba60ad861b9c9afb6daea7294be4be68f44c@urbanslug.com>

--- test/hatti/ona/forms_test.cljs
+++ test/hatti/ona/forms_test.cljs
@@ -134,7 +134,9 @@
         (is (has-label? first-option
                         (forms/format-answer q-selm (:name first-option))))
         (is (has-label? first-option
-                        (forms/format-answer q-selm (:label first-option))))
+                        (forms/format-answer q-selm
+                                             (:label first-option)
+                                             :field-key :label)))
         (is (has-label? (first two-options)
                         (forms/format-answer q-selm two-answers)))
         (is (has-label? (second two-options)


Use full.async on server side as well.

Use full.async on server side as well.

--- src/topiq/core.clj
+++ src/topiq/core.clj
@@ -1,6 +1,6 @@
 (ns topiq.core
   (:gen-class :main true)
-  (:require [clojure.core.async :refer [timeout sub chan <!! >!! <! >! go go-loop] :as async]
+  (:require [clojure.core.async :refer [timeout sub chan >!! >! go go-loop] :as async]
             [clojure.edn :as edn]
             [clojure.java.io :as io]
             [clojure.tools.logging :refer [info warn error]]
@@ -9,8 +9,6 @@
             [compojure.handler :refer [site api]]
             [compojure.route :refer [resources]]
             [kabel.middleware.block-detector :refer [block-detector]]
-            [kabel.middleware.log :refer [logger]]
-            [kabel.platform :refer [create-http-kit-handler!]]
             [konserve.core :as k]
             [konserve.filestore :refer [new-fs-store]]
             [konserve.memory :refer [new-mem-store]]
@@ -21,7 +19,7 @@
             [replikativ.p2p.hooks :refer [hook]]
             [replikativ.peer :refer [server-peer client-peer]]
             [replikativ.stage :as s]
-            [full.async :refer [<??]]))
+            [full.async :refer [<?? <? go-try go-loop-try]]))

 (def server-state (atom nil))
@@ -41,15 +39,13 @@
 (defn create-store
   "Creates a konserve store"
   [state]
-  (swap! state assoc :store (<!! (new-mem-store) #_(new-fs-store "store")))
+  (swap! state assoc :store (<?? (new-mem-store) #_(new-fs-store "store")))
   state)

 (def hooks (atom {[#".*"
-                   #uuid "26558dfe-59bb-4de4-95c3-4028c56eb5b5"
-                   "master"]
+                   #uuid "26558dfe-59bb-4de4-95c3-4028c56eb5b5"]
                   [["eve@topiq.es"
-                    #uuid "26558dfe-59bb-4de4-95c3-4028c56eb5b5"
-                    "master"]]}))
+                    #uuid "26558dfe-59bb-4de4-95c3-4028c56eb5b5"]]}))

 (def err-ch (chan))

@@ -122,12 +118,16 @@

   (<?? (k/get-in (:store @server-state) [:peer-config]))

-  (def commit-eval {'(fn replace [old params] params) (fn replace [old params] [params])
+  (def commit-eval {'(fn [_ new] new) (fn replace [old params] [params])
                     '(fn [old params] (d/db-with old params)) (fn [old params] (conj old params))})

-  (count (<!! (s/commit-value (:store @server-state) commit-eval
-                              (:causal-order (<!! (k/get-in (:store @server-state) [["eve@topiq.es" #uuid "26558dfe-59bb-4de4-95c3-4028c56eb5b5"]])))
-                              #uuid "05b162ca-b6a6-5106-838f-00e30a1a5b9b")))
+  (require '[replikativ.crdt.cdvcs.realize :refer [commit-value commit-history-values]])
+
+
+  (<?? (commit-history-values (:store @server-state)
+                              (:commit-graph (:state (<?? (k/get-in (:store @server-state) [["eve@topiq.es" #uuid "26558dfe-59bb-4de4-95c3-4028c56eb5b5"]]))))
+                              #uuid "1699bb60-2ba4-5be1-908f-e00a03cfeef4"))
+

   (require '[replikativ.crdt.materialize :refer [key->crdt]])


Updated to store errors during repository collection

--- kuona-api/src/kuona_api/core/scheduler.clj
+++ kuona-api/src/kuona_api/core/scheduler.clj
@@ -87,6 +87,12 @@
         (tfs-org-collector-config? e) (refresh-tfs-org (-> config :org) (-> config :token))
         :else (log/info "collector type not supported")))
     (catch Object _
+      (store/put-document {:id         (util/uuid)
+                           :collector  {:name    (-> e :collector)
+                                        :version (util/get-project-version 'kuona-api)}
+                           :activity   :error
+                           :parameters (select-keys (-> e :config) [:org :username])
+                           :timestamp  (util/timestamp)} stores/collector-activity-store)
       (log/error (:throwable &throw-context) "Unexpected error collecting repository data " e))))

 (defn refresh-repositories


Add test for get-thumb-from-search.

Add test for get-thumb-from-search.

--- test/beebster_clj/core_test.clj
+++ test/beebster_clj/core_test.clj
@@ -2,6 +2,80 @@
   (:require [clojure.test :refer :all]
             [beebster-clj.core :refer :all]))

-(deftest a-test
-  (testing "FIXME, I fail."
-    (is (= 0 1))))
+
+(def test-list-1
+  ["Matches:" "915 b03bncr5 http://www.bbc.co.uk/iplayer/images/episode/b03bncr5_150_84.jpg The Bridge: Series 2 Episode 1" "916 b03bx7kw http://www.bbc.co.uk/iplayer/images/episode/b03bx7kw_150_84.jpg The Bridge: Series 2 Episode 2" "917 b03cd8cz http://www.bbc.co.uk/iplayer/images/episode/b03cd8cz_150_84.jpg The Bridge: Series 2 Episode 3" "918 b03dxccc http://www.bbc.co.uk/iplayer/images/episode/b03dxccc_150_84.jpg The Bridge: Series 2 Episode 4" "919 b03f2bn1 http://www.bbc.co.uk/iplayer/images/episode/b03f2bn1_150_84.jpg The Bridge: Series 2 Episode 5" "920 b03fqbkf http://www.bbc.co.uk/iplayer/images/episode/b03fqbkf_150_84.jpg The Bridge: Series 2 Episode 6" "" "INFO: 6 Matching Programmes"])
+
+
+(def test-info-1
+  "Matches:
+703:	Reading and Leeds Festival - 2013: 15. Don Broco - Reading Festival highlights, BBC Three, Guidance,Music,Rock & Indie,TV, default
+
+INFO: File name prefix = Reading_and_Leeds_Festival_-_2013_15._Don_Broco_-_Reading_Festival_highlights_p01fqbwj_default
+
+available:      Unknown
+categories:     Music,Rock & Indie
+channel:        BBC Three
+desc:           Extended highlights of Don Broco's set at Reading Festival 2013
+descmedium:     Extended highlights of Don Broco's set at Reading Festival 2013
+descshort:      Extended highlights of Don Broco's set at Reading Festival 2013
+dir:            /home/martin/quicklisp/local-projects/beebster
+dldate:         2013-09-07
+dltime:         14:40:45
+duration:       2028
+durations:      default: 2028
+episode:        2013: 15. Don Broco - Reading Festival highlights
+episodenum:     15
+episodeshort:   2013: Don Broco - Reading Festival highlights
+expiry:         2013-09-24T18:01:00Z
+expiryrel:      in 17 days 4 hours
+ext:            EXT
+filename:       /home/martin/quicklisp/local-projects/beebster/Reading_and_Leeds_Festival_-_2013_15._Don_Broco_-_Reading_Festival_highlights_p01fqbwj_default.EXT
+filepart:       /home/martin/quicklisp/local-projects/beebster/Reading_and_Leeds_Festival_-_2013_15._Don_Broco_-_Reading_Festival_highlights_p01fqbwj_default.partial.EXT
+fileprefix:     Reading_and_Leeds_Festival_-_2013_15._Don_Broco_-_Reading_Festival_highlights_p01fqbwj_default
+firstbcast:     default: 2013-08-25T19:01:00+01:00
+firstbcastrel:  default: 12 days 19 hours ago
+guidance:       adult
+index:          703
+lastbcast:      default: 2013-08-25T19:01:00+01:00
+lastbcastrel:   default: 12 days 19 hours ago
+longname:       Reading and Leeds Festival
+modes:          default: flashhigh1,flashhigh2,flashlow1,flashlow2,flashstd1,flashstd2,flashvhigh1,flashvhigh2,rtsphigh1,rtsphigh2,rtsplow1,rtsplow2,rtspstd1,rtspstd2,rtspvhigh1,rtspvhigh2
+modesizes:      default: flashhigh1=197MB,flashhigh2=197MB,flashlow1=98MB,flashlow2=98MB,flashstd1=119MB,flashstd2=119MB,flashvhigh1=371MB,flashvhigh2=371MB,rtsphigh1=197MB,rtsphigh2=197MB,rtsplow1=98MB,rtsplow2=98MB,rtspstd1=119MB,rtspstd2=119MB,rtspvhigh1=371MB,rtspvhigh2=371MB
+name:           Reading and Leeds Festival
+nameshort:      Reading and Leeds Festival
+pid:            p01fqbwj
+player:         http://www.bbc.co.uk/iplayer/episode/p01fqbwj/Reading_and_Leeds_Festival_2013_Don_Broco_Reading_Festival_highlights/
+senum:          s00e15
+thumbfile:      /home/martin/quicklisp/local-projects/beebster/Reading_and_Leeds_Festival_-_2013_15._Don_Broco_-_Reading_Festival_highlights_p01fqbwj_default.jpg
+thumbnail:      http://www.bbc.co.uk/iplayer/images/episode/p01fqbwj_150_84.jpg
+thumbnail1:     http://ichef.bbci.co.uk/programmeimages/p01fqbvz/p01fqbwj_86_48.jpg
+thumbnail2:     http://ichef.bbci.co.uk/programmeimages/p01fqbvz/p01fqbwj_150_84.jpg
+thumbnail3:     http://ichef.bbci.co.uk/programmeimages/p01fqbvz/p01fqbwj_178_100.jpg
+thumbnail4:     http://ichef.bbci.co.uk/programmeimages/p01fqbvz/p01fqbwj_512_288.jpg
+thumbnail5:     http://ichef.bbci.co.uk/programmeimages/p01fqbvz/p01fqbwj_528_297.jpg
+thumbnail6:     http://ichef.bbci.co.uk/programmeimages/p01fqbvz/p01fqbwj_640_360.jpg
+timeadded:      12 days 16 hours ago (1377464262)
+title:          Reading and Leeds Festival: 2013: Don Broco - Reading Festival highlights
+type:           tv
+verpids:        default: p01fqbwn
+version:        default
+versions:       default
+web:            http://www.bbc.co.uk/programmes/p01fqbwj.html
+
+
+INFO: 1 Matching Programmes
+")
+
+
+
+(deftest test-thumbs-from-string
+  (testing "get thumbnail from string"
+    (is (= "http://www.bbc.co.uk/iplayer/images/episode/b03bncr5_150_84.jpg"
+           (first (get-thumb-from-search test-list-1))))
+    (is (= "http://www.bbc.co.uk/iplayer/images/episode/b03bx7kw_150_84.jpg"
+           (second (get-thumb-from-search test-list-1))))
+    (is (= "http://www.bbc.co.uk/iplayer/images/episode/b03fqbkf_150_84.jpg"
+           (last (get-thumb-from-search test-list-1))))))
+
+


remove requires

remove requires

--- src/cljs/meins/electron/renderer/ui/draft.cljs
+++ src/cljs/meins/electron/renderer/ui/draft.cljs
@@ -8,8 +8,6 @@
             [meins.common.utils.misc :as u]
             [draft-js :as Draft]
             [draftjs-md-converter :as md-converter]
-            ["/meins/electron/renderer/ui/EntryTextEditor.js" :as ete]
-            ["/meins/electron/renderer/ui/SearchFieldEditor.js" :as sfe]
             [meins-draft]
             [meins.electron.renderer.ui.entry.utils :as eu]
             [matthiasn.systems-toolbox.component :as st]


Fix docstrings

Fix docstrings

--- src/clojure/clojurewerkz/cassaforte/client.clj
+++ src/clojure/clojurewerkz/cassaforte/client.clj
@@ -237,15 +237,16 @@

   With string statement:

-  (client/bind
-  (client/prepare s \"INSERT INTO users (name, city, age) VALUES (?, ?, ?);\")
-  [\"Alex\" \"Munich\" (int 19)])
-
-  With queries:
-
-  (let [prepared (client/prepare (insert s :users {:name ? :city ? :age  ?}))]
-  (client/execute s
-  (client/bind prepared [\"Alex\" \"Munich\" (int 19)]))"
+    (let [r        {:name \"Alex\" :city \"Munich\" :age (int 19)}
+          prepared (client/prepare session
+                                   (insert :users
+                                           {:name ?
+                                            :city ?
+                                            :age  ?}))]
+      (client/execute session
+                      (client/bind prepared
+                                   {:name \"Alex\" :city \"Munich\" :age (int 19)})))
+  "
   [^PreparedStatement statement values]
   ;; TODO: matching
   (if (map? values)


bump dep versions

bump dep versions

--- src/leiningen/new/reagent_liveedit/project.clj
+++ src/leiningen/new/reagent_liveedit/project.clj
@@ -12,37 +12,36 @@

   :dependencies [[org.clojure/clojure "1.6.0"]
                  [reagent "0.5.0-alpha"]
-                 [reagent-utils "0.1.0"]
+                 [reagent-utils "0.1.2"]
                  [garden "1.2.5"]
                  [secretary "1.2.1"]
-                 [org.clojure/clojurescript "0.0-2371" :scope "provided"]
+                 [org.clojure/clojurescript "0.0-2727" :scope "provided"]
                  [org.clojure/core.async "0.1.346.0-17112a-alpha"]
-                 [com.cemerick/piggieback "0.1.3"]
-                 [weasel "0.4.2"]
+                 [com.cemerick/piggieback "0.1.5"]
+                 [weasel "0.5.0"]
                  [ring "1.3.2"]
-                 [ring/ring-defaults "0.1.2"]
+                 [ring/ring-defaults "0.1.3"]
                  [prone "0.8.0"]
                  [compojure "1.3.1"]
-                 [selmer "0.7.7"]
+                 [selmer "0.8.0"]
                  [environ "1.0.0"]
-                 [leiningen "2.5.0"]
-                 [figwheel "0.1.7-SNAPSHOT"]
+                 [leiningen "2.5.1"]
+                 [figwheel "0.2.2-SNAPSHOT"]
                  [ring-mock "0.1.5"]
                  [ring/ring-devel "1.3.2"]
                  [pjstadig/humane-test-output "0.6.0"]
                  [prismatic/dommy "1.0.0"]]

-  :plugins [[lein-cljsbuild "1.0.3"]
+  :plugins [[lein-cljsbuild "1.0.4"]
             [lein-garden "0.2.5"]
             [lein-environ "1.0.0"]
-            [lein-ring "0.8.13"]
-            [lein-asset-minifier "0.2.0" :exclusions [org.clojure/clojure org.clojure/core.async]]
+            [lein-ring "0.9.1"]
+            [lein-asset-minifier "0.2.2" :exclusions [org.clojure/clojure org.clojure/core.async]]
             [lein-exec "0.3.4"]
             [lein-pdo "0.1.1"]
             [com.cemerick/clojurescript.test "0.3.3"]
-            [lein-figwheel "0.1.7-SNAPSHOT" :exclusions [org.clojure/clojure org.clojure/core.async]]
-            #_[com.cemerick/austin "0.1.5"]
-            [cider/cider-nrepl "0.8.1"]]
+            [lein-figwheel "0.2.2-SNAPSHOT" :exclusions [org.clojure/clojure org.clojure/core.async]]
+            [cider/cider-nrepl "0.9.0"]]

   :ring {:handler {{ns-name}}.server.handler/app}


fix for entries overwritten by late geo-enrich message

--- iwaswhere-web/src/cljc/iwaswhere_web/client_store_entry.cljc
+++ iwaswhere-web/src/cljc/iwaswhere_web/client_store_entry.cljc
@@ -35,12 +35,15 @@
     {:new-state new-state}))

 (defn geo-enrich-fn
-  "Enrich locally stored new entry with geolocation once it becomes available."
+  "Enrich locally stored new entry with geolocation once it becomes available.
+   Does nothing when entry is already saved in backend."
   [{:keys [current-state msg-payload]}]
   (let [ts (:timestamp msg-payload)
+        local-entry (get-in current-state [:new-entries ts])
         new-state (update-in current-state [:new-entries ts] #(merge msg-payload %))]
-    (update-local-storage new-state)
-    {:new-state new-state}))
+    (when local-entry
+      (update-local-storage new-state)
+      {:new-state new-state})))

 (defn entry-saved-fn
   "Remove new entry from local when saving is confirmed by backend."


Fix bug

Fix bug

--- src/antlion_clojure/bot.clj
+++ src/antlion_clojure/bot.clj
@@ -293,8 +293,8 @@
         args (drop 2 txt)]
     (case command
       "help" (help res me)
-      "set-problem" (set-problem res (first args) (second args))
-      "del-problem" (del-problem res (first args))
+      "set-problem" (set-problem slack res (first args) (second args))
+      "del-problem" (del-problem slack res (first args))
       "set-fyi" (set-fyi res (first args) (second args))
       "del-fyi" (del-fyi res (first args))
       "add-allowed-channel" (add-allowed-channel slack res (first args))


use cmdline arg to limit number of versions parsed for quick testing

--- src/core.clj
+++ src/core.clj
@@ -176,11 +176,11 @@
   (System/exit 1))

 (defn verify-docs-repo-sync!
-  [past-versions versions]
+  [past-versions versions-left]
   (doseq [version past-versions]
     (when-not (docs-repo-has-version? version)
       (docs-repo-out-of-sync! (str version " has no tag"))))
-  (doseq [version versions]
+  (doseq [version versions-left]
     (when (docs-repo-has-version? version)
       (docs-repo-out-of-sync! (str version " already has tag")))))

@@ -664,7 +664,7 @@
 ;;------------------------------------------------------------

 (defn -main
-  []
+  [& args]

   ;; HACK: We need to create this so 'tools.reader' doesn't crash on `::ana/numeric`
   ;; which is used by cljs.core. (the ana namespace has to exist)
@@ -676,10 +676,13 @@
   (prepare-docs-repo!)

   (let [[latest history] (get-symbol-history)
-        [past-versions versions] (get-versions-to-parse latest)]
+        [past-versions versions-left] (get-versions-to-parse latest)
+        versions (if-let [number (first args)]
+                   (take (Integer/parseInt number) versions-left)
+                   versions-left)]

     (println "\nVerifying docs-repo is in sync with symbol-history...")
-    (verify-docs-repo-sync! past-versions versions)
+    (verify-docs-repo-sync! past-versions versions-left)

     (doseq [version versions]


fix the overwriting when changing the id in the ui editor

Signed-off-by: Chris Granger <5654cde260ae99bc4d30054171b8bcd902efd19a@gmail.com>

--- src/aurora/editor/core.cljs
+++ src/aurora/editor/core.cljs
@@ -1166,7 +1166,7 @@

        (rule "draw editor id updated"
              (when "ui/onChange" {:elem-id "draw-id-editor" :value 'value})
-             (when "rule is visible" {:rule-id 'rule})
+             (when "rule editor active" {:rule-id 'rule})
              (change "draw editor active elem" {:elem-id 'elem} {:elem-id 'value})
              (change "editor clause fields"
                      {:rule-id 'rule :clause-id 'clause :constant|variable|expression 'cv :val 'elem :key "elem-id"}
@@ -1174,7 +1174,7 @@
               )
        (rule "draw editor id updated, modify root"
              (when "ui/onChange" {:elem-id "draw-id-editor" :value 'value})
-             (when "rule is visible" {:rule-id 'rule})
+             (when "rule editor active" {:rule-id 'rule})
              (when "draw editor active elem" {:elem-id 'elem})
              (change "ui/editor-root"
                      {:rule-id 'rule :clause-id 'rid :root 'elem  :timestamp '_}
@@ -1182,7 +1182,7 @@

        (rule "draw editor id updated, modify parents"
              (when "ui/onChange" {:elem-id "draw-id-editor" :value 'value})
-             (when "rule is visible" {:rule-id 'rule})
+             (when "rule editor active" {:rule-id 'rule})
              (when "draw editor active elem" {:elem-id 'elem})
              (change "editor clause fields"
                      {:rule-id 'rule :clause-id 'clause :constant|variable|expression 'cv :val 'elem :key "parent-id"}
@@ -1190,7 +1190,7 @@

        (rule "draw editor id updated, modify children"
              (when "ui/onChange" {:elem-id "draw-id-editor" :value 'value})
-             (when "rule is visible" {:rule-id 'rule})
+             (when "rule editor active" {:rule-id 'rule})
              (when "draw editor active elem" {:elem-id 'elem})
              (change "editor clause fields"
                      {:rule-id 'rule :clause-id 'clause :constant|variable|expression 'cv :val 'elem :key "child-id"}
@@ -1198,7 +1198,7 @@

        (rule "draw editor tag updated"
              (when "ui/onChange" {:elem-id "draw-tag-editor" :value 'value})
-             (when "rule is visible" {:rule-id 'rule})
+             (when "rule editor active" {:rule-id 'rule})
              (when "editor clause fields" {:rule-id rule :clause-id clause :constant|variable|expression 'cv2 :val 'elem :key "elem-id"})
              (when "draw editor active elem" {:elem-id 'elem})
              (change "editor clause fields"


whitespace

whitespace

--- src/babel/italiano/lab.cljc
+++ src/babel/italiano/lab.cljc
@@ -425,10 +425,10 @@
                  (do
                    (log/warn "using entire model: will be slow.")
                    (:grammar model)))]
-           (morph-ps (binding [babel.generate/println? false
-                               babel.generate/truncate? false
-                               babel.generate/grammar generate-with-grammar]
-                       (time (generate chosen-spec model))))))))))
+           (morph (binding [babel.generate/println? false
+                            babel.generate/truncate? true
+                            babel.generate/grammar generate-with-grammar]
+                    (time (generate chosen-spec model))))))))))

 (defn stampare
   "generate arrabiarsi sentences with a grammar subset."


remove unused store functions

remove unused store functions

they are an artifact of when threads could belong to multiple groups

--- src/braid/client/store.cljs
+++ src/braid/client/store.cljs
@@ -338,23 +338,6 @@
 (defn get-tag [tag-id]
   (get-in @app-state [:tags tag-id]))

-(defn get-ambiguous-tags
-  "Get a set of all ambiguous tag names"
-  []
-  (let [tag-names (->> @app-state :tags vals (map :name))]
-    (set (for [[tag-name freq] (frequencies tag-names)
-               :when (> freq 1)]
-           tag-name))))
-
-(defn ambiguous-tag?
-  "Returns a set of the groups with a tag of the given name if the tag exists
-  in multiple groups, or nil if the tag is only present in one or zero groups"
-  [tag-name]
-  (when (contains? (get-ambiguous-tags) tag-name)
-    (->> @app-state :tags vals
-         (filter #(= (% :name) tag-name))
-         (map #(select-keys % [:group-id :group-name :id])))))
-
 (defn group-for-tag
   "Get the group id for the tag with the given id"
   [tag-id]


apply filesystem filters

apply filesystem filters

--- src/brainbot/nozzle/vfs.clj
+++ src/brainbot/nozzle/vfs.clj
@@ -68,7 +68,20 @@
          :error (str err)}))))

+(defn apply-filters
+  "apply filesystem filters to list of entries"
+  [{remove-filters :remove-filters :as fs} path entries]
+  (reduce
+   (fn [entries filter-fun]
+     (remove filter-fun entries))
+   entries
+   remove-filters))
+
+
 (defn cmd-listdir
   [fs path]
-  (map (make-safe-stat-entry fs path)
-       (listdir-catch-access-denied fs path)))
+  (apply-filters
+   fs
+   path
+   (map (make-safe-stat-entry fs path)
+        (listdir-catch-access-denied fs path))))


Using correct opts in read-edn*, read-text*, and read-json* fns? (#88)

--- src/clj/datasplash/core.clj
+++ src/clj/datasplash/core.clj
@@ -1249,13 +1249,13 @@
    (let [opts (assoc options
                      :coder (or (:coder options) (make-nippy-coder)))]
      (pt->>
-      (or (:name options) (str "read-text-file-from"
-                               (clean-filename from)))
+      (or (:name opts) (str "read-text-file-from"
+                            (clean-filename from)))
       p
-      (read-text-file from (-> options
+      (read-text-file from (-> opts
                                (dissoc :coder)
                                (assoc :name "read-text-file")))
-      (from-edn (assoc options :name "parse-edn")))))
+      (from-edn (assoc opts :name "parse-edn")))))
   ([from p] (read-edn-file from {} p)))

@@ -1275,12 +1275,12 @@
    (let [opts (assoc options
                      :coder (or (:coder options) (make-nippy-coder)))]
      (pt->>
-      (or (:name options) "read-edn-files")
+      (or (:name opts) "read-edn-files")
       from
-      (read-text-files (-> options
+      (read-text-files (-> opts
                            (dissoc :coder)
                            (assoc :name "read-edn-files")))
-      (from-edn (assoc options :name "parse-edn")))))
+      (from-edn (assoc opts :name "parse-edn")))))
   ([from] (read-edn-files {} from)))

@@ -1326,13 +1326,13 @@
                      return-type #(json/decode % nil return-type)
                      :else json/decode)]
      (pt->>
-      (or (:name options) (str "read-json-file-from-" (clean-filename from)))
+      (or (:name opts) (str "read-json-file-from-" (clean-filename from)))
       p
-      (read-text-file from (-> options
+      (read-text-file from (-> opts
                                (dissoc :coder)
                                (assoc :name "read-text-file")))
       (dmap decode-fn
-            (assoc options :name "json-decode")))))
+            (assoc opts :name "json-decode")))))
   ([from p] (read-json-file from {} p)))

@@ -1359,9 +1359,9 @@
                      return-type #(json/decode % nil return-type)
                      :else json/decode)]
      (pt->>
-      (or (:name options) "read-json-files")
+      (or (:name opts) "read-json-files")
       from
-      (read-text-files (-> options
+      (read-text-files (-> opts
                            (dissoc :coder)
                            (assoc :name "read-json-files")))
       (dmap decode-fn


Log the fact that a production could not be deleted

--- src/clj/mdr2/production.clj
+++ src/clj/mdr2/production.clj
@@ -249,9 +249,9 @@
   (if (obi/directory-valid? production)
     ;; only delete if nothing is fishy with the directories
     (doseq [dir (path/all production)] (fs/delete-tree dir))
-    (throw
-     (ex-info (format "Failed to remove invalid Obi directory (%s)" (:id production))
-              {:error-id :invalid-obi-directory}))))
+    (let [message (format "Failed to remove invalid Obi directory (%s)" (:id production))]
+      (log/error message)
+      (throw (ex-info message {:error-id :invalid-obi-directory})))))

 (defn set-state-archived! [production]
   (delete-all-dirs! production)


eliminate commented code

eliminate commented code

--- src/clj/wombat/compiler.clj
+++ src/clj/wombat/compiler.clj
@@ -18,17 +18,6 @@
     (catch ClassNotFoundException e)))

 (def object-array-class (class (object-array 0)))
-
-;; (dotimes [n 21]
-;;   (eval `(gen-interface :name ~(symbol (str "wombat.ILambda" n))
-;;                         :extends [~'wombat.ILambda]
-;;                         :methods [[~'invoke [~@(repeat n Object)] ~'Object]]))
-;;   (eval `(import ~(symbol (str "wombat.ILambda" n)))))
-
-;; (eval
-;;  `(gen-interface :name ~'wombat.ILambda21
-;;                  :extends [~'wombat.ILambda]
-;;                  :methods [[~'invoke [~@(repeat 20 Object) ~(.getName object-array-class)] ~'Object]]))

 (def ^:dynamic *print-debug* true)
 (defn debug [& vals]
@@ -598,14 +587,6 @@
   (. gen swap)
   (. gen invokeVirtual (asmtype java.io.PrintWriter) (Method/getMethod "void println(String)")))

-;; (def invoke-handle
-;;   (Handle. Opcodes/H_INVOKESTATIC
-;;            "wombat/Global"
-;;            "bootstrapInvoke"
-;;            (.toMethodDescriptorString
-;;             (MethodType/methodType CallSite
-;;                                    (into-array Class [MethodHandles$Lookup String MethodType String])))))
-
 (defmethod emit-seq -invoke-
   [env context gen [fun & args :as call]]
   (when (nil? fun)
@@ -613,18 +594,8 @@
   (debug "emitting invoke:" call)
   (debug "context:" context)

-  ;; (let [cname (str "wombat.ILambda" (min (count args) 21))
-  ;;       arg-types (concat (repeat (min (count args) 20) Object)
-  ;;                         (when (> (count args) 20) (list object-array-class)))
-  ;;       invoke-descriptor (.toMethodDescriptorString
-  ;;                          (MethodType/methodType Object (into-array Class (cons ILambda arg-types))))]
-  ;;   (debug "cname:" cname)
-  ;;   (debug "argtypes:" arg-types)
-  ;;   (debug "invoke-descriptor:" invoke-descriptor))
-
   (emit env :context/expression gen fun)

-  ;; Old-style getHandle
   (. gen dup)
   (. gen checkCast ilambda-type)
   (AsmUtil/pushInt gen (count args))
@@ -633,7 +604,6 @@

   (doseq [a args]
     (emit env :context/expression gen a))
-  ;; (. gen invokeDynamic "invoke" invoke-descriptor invoke-handle (into-array Object [cname]))
   (. gen invokeVirtual (asmtype MethodHandle)
      (Method. "invoke" object-type (into-array Type (cons ilambda-type (repeat (count args) object-type)))))


comment top level call

comment top level call

--- src/clj/xl/coin_changes.clj
+++ src/clj/xl/coin_changes.clj
@@ -51,4 +51,4 @@
     )
   )

-(samples)+;(samples)


Reformatted src/clj_flotr/generator.clj by zprint

--- src/clj_flotr/generator.clj
+++ src/clj_flotr/generator.clj
@@ -15,89 +15,91 @@
 (require '[hiccup.page :as page])

 (defn script
-    "Returns Hiccup-compatible vector containing link to JavaScript source."
-    [prefix name]
-    [:script {:type "text/javascript" :src (str prefix name)}])
+  "Returns Hiccup-compatible vector containing link to JavaScript source."
+  [prefix name]
+  [:script {:type "text/javascript", :src (str prefix name)}])

 (defn flotr-scripts
-    "Use this function to get part of HTML header that contains links
+  "Use this function to get part of HTML header that contains links
      to Flotr JavaScript libraries.
      Usage: (flotr-scripts nil \"flotr/lib\" false)
             (flotr-scripts \"http://foo.bar.bz\" \"flotr/lib\" false)
             (flotr-scripts \"http://foo.bar.bz\" \"flotr/lib\" true)"
-    [url path use-debug-variant?]
-    (let [prefix (if url (str url "/" path "/")
-                         (if path (str path "/") ""))]
-          (seq [(script prefix "lib/prototype-1.6.0.2.js")
-                (script prefix "lib/canvas2image.js")
-                (script prefix "lib/canvastext.js")
-                (if use-debug-variant?
-                    (script prefix "flotr.debug-0.2.0-alpha.js")
-                    (script prefix "flotr-0.2.0-alpha.js"))])))
+  [url path use-debug-variant?]
+  (let [prefix (if url (str url "/" path "/")
+                       (if path (str path "/") ""))]
+    (seq [(script prefix "lib/prototype-1.6.0.2.js")
+          (script prefix "lib/canvas2image.js")
+          (script prefix "lib/canvastext.js")
+          (if use-debug-variant?
+                     (script prefix "flotr.debug-0.2.0-alpha.js")
+                     (script prefix "flotr-0.2.0-alpha.js"))])))

 (defn bool->string
-    [value]
-    (if value "true" "false"))
+  [value]
+  (if value "true" "false"))

 (defn data-series-for-pie-chart
-    [data]
-    (for [datum data]
-        (str "{data:[[1," (:values datum) "]], label: '" (:label datum) "'},\n")))
+  [data]
+  (for [datum data]
+    (str "{data:[[1," (:values datum) "]], label: '" (:label datum) "'},\n")))

 (defn vals->js
-    [datum]
-    (for [i (:values datum)]
-        (str "[" (first i) "," (second i) "]")))
+  [datum]
+  (for [i (:values datum)]
+    (str "[" (first i) "," (second i) "]")))

 (defn data-series-for-line-chart
-    [data]
-    (for [datum data]
-        (str "{data:["
-            (clojure.string/join ","
-                (vals->js datum))
-            "],"
-            "label: '" (:label datum) "'},\n")))
+  [data]
+  (for [datum data]
+    (str "{data:["
+         (clojure.string/join ","
+                              (vals->js datum))
+                              "],"
+                              "label: '" (:label datum)
+                              "'},\n")))

 (defn data-series-for-stacked-bars
-    [data]
-    (for [datum data]
-        (str "{data:["
-            (clojure.string/join ","
-                (vals->js datum))
-            "],"
-            "label: '" (:label datum) "'},\n")))
+  [data]
+  (for [datum data]
+    (str "{data:["
+         (clojure.string/join "," (vals->js datum))
+         "],"
+         "label: '"
+         (:label datum)
+         "'},\n")))

 (defn legend-part
-    [show-legend legend-position legend-background]
-    (str "legend:{
-              show: "             (bool->string show-legend) ",
-              position: '"        (or legend-position "ne") "',
-              backgroundColor: '" (or legend-background "#D2E8FF") "',
+  [show-legend legend-position legend-background]
+  (str "legend:{
+          show: "             (bool->string show-legend) ",
+            position: '"        (or legend-position "ne") "',
+            backgroundColor: '" (or legend-background "#D2E8FF") "',
           }"))

 (defn grid-part
-    [horizontal-lines vertical-lines]
-    (str "grid: {
-              verticalLines:   " (bool->string vertical-lines) ",
+  [horizontal-lines vertical-lines]
+  (str "grid: {
+            verticalLines:   " (bool->string vertical-lines) ",
               horizontalLines: " (bool->string horizontal-lines) "
           },"))

 (defn pie-chart
-    "Creates a simple pie chart. Please look at the function named
+  "Creates a simple pie chart. Please look at the function named
      'test-pie-charts' how to use pie-chart."
-    [id width height data & {:keys [horizontal-lines
+  [id width height data & {:keys [horizontal-lines
                                     vertical-lines
                                     show-legend
                                     legend-position
                                     legend-background
                                     title
                                     subtitle]}]
-    [:div {:id id :style (str "width:" width ";height:" height)}
-        [:script {:type "text/javascript"}
-            (str "Flotr.draw($('" id "'), [")
-                  (data-series-for-pie-chart data)
-                  "], {"
-            (str "
+  [:div {:id id, :style (str "width:" width ";height:" height)}
+   [:script {:type "text/javascript"}
+      (str "Flotr.draw($('" id "'), [")
+      (data-series-for-pie-chart data)
+      "], {"
+      (str "
                   HtmlText: false,"
                   (grid-part horizontal-lines vertical-lines)
                   "
@@ -110,44 +112,44 @@
                   "});")]])

 (defn line-chart
-    "Creates a simple bar chart. Please look at the function named
+  "Creates a simple bar chart. Please look at the function named
      'test-line-charts' how to use line-chart."
-    [id width height data & {:keys [horizontal-lines
+  [id width height data & {:keys [horizontal-lines
                                     vertical-lines
                                     show-legend
                                     legend-position
                                     legend-background
                                     title
                                     subtitle]}]
-    [:div {:id id :style (str "width:" width ";height:" height)}
-        [:script {:type "text/javascript"}
-            (str "Flotr.draw($('" id "'), [")
-                  (data-series-for-line-chart data)
-                  "], {"
-            (str "
+  [:div {:id id, :style (str "width:" width ";height:" height)}
+   [:script {:type "text/javascript"}
+      (str "Flotr.draw($('" id "'), [")
+      (data-series-for-line-chart data)
+      "], {"
+      (str "
                   HtmlText: false,"
                   (grid-part horizontal-lines vertical-lines)
                   "
                   xaxis: {showLabels: true},
                   yaxis: {showLabels: true},"
-                  (legend-part show-legend legend-position legend-background)
-                  (if title    (str ", title: '" title "'"))
-                  (if subtitle (str ", subtitle: '" subtitle "'"))
+                (legend-part show-legend legend-position legend-background)
+                (if title    (str ", title: '" title "'"))
+                (if subtitle (str ", subtitle: '" subtitle "'"))
                   "});")]])

 (defn stacked-bars
-    [id width height data & {:keys [horizontal-lines
+  [id width height data & {:keys [horizontal-lines
                                     vertical-lines
                                     show-legend
                                     legend-position
                                     legend-background
                                     bar-width]}]
-    [:div {:id id :style (str "width:" width ";height:" height)}
-        [:script {:type "text/javascript"}
-            (str "Flotr.draw($('" id "'), [")
-                  (data-series-for-stacked-bars data)
-                  "], {"
-            (str "
+  [:div {:id id, :style (str "width:" width ";height:" height)}
+   [:script {:type "text/javascript"}
+      (str "Flotr.draw($('" id "'), [")
+      (data-series-for-stacked-bars data)
+      "], {"
+      (str "
                   HtmlText: false,"
                   (grid-part horizontal-lines vertical-lines)
                   "


Minor cleaning

Minor cleaning

--- src/cljs/triboard/core.cljs
+++ src/cljs/triboard/core.cljs
@@ -2,40 +2,6 @@
   (:require [reagent.core :as reagent :refer [atom]]))

 (enable-console-print!)
-
-
-;; -----------------------------------------
-;; TODO - Performance can be increased by using deftype / defrecord
-;; TODO - Define a point
-;; TODO - Define a move
-;; -----------------------------------------
-
-(defrecord B [x y])
-
-(defn perf-test
-  []
-  (let [r (vec (range 10000))]
-    (time
-      (doall
-        (map #(.-x %) (map #(B. %1 %2) r r))
-        ))
-    (time
-      (doall
-        (map #(:x %) (map #(B. %1 %2) r r))
-        ))
-    (time
-      (doall
-        (map #(first %) (map vector r r))
-        ))
-    (time
-      (doall
-        (map #(:x %) (map (fn [a b] {:x a :y b}) r r))
-        ))
-		;;"Elapsed time: 14.975000 msecs"
-		;;"Elapsed time: 20.245000 msecs"
-		;;"Elapsed time: 21.190000 msecs"
-		;;"Elapsed time: 22.085000 msecs"
-    nil))

 ;; -----------------------------------------
@@ -51,6 +17,8 @@
 ;; -----------------------------------------
 ;; INIT THE BOARD
 ;; -----------------------------------------
+
+;; (defrecord Point [x y])

 (def empty-board
   (let [column (vec (repeat board-height :empty))]
@@ -81,7 +49,7 @@

 (defn new-board []
   (reduce
-    (fn [r [color [x y]]] (assoc-in r [x y] color))
+    (fn [r [color point]] (assoc-in r point color))
     empty-board (init-positions)))

@@ -136,8 +104,8 @@

 (defn available-moves-at
   "Provides the list of moves that can be done from a cell"
-  [board [x y]]
-  (eduction (keep #(available-cells-by-dir board [x y] %)) directions))
+  [board point]
+  (eduction (keep #(available-cells-by-dir board point %)) directions))

 (defn take-empty-cell-move
   "Create a move to take an empty cell"
@@ -198,11 +166,11 @@

 (defn play-move
   "On player playing the move [x y]"
-  [{:keys [player board] :as game} [x y]]
-  (if-let [moves (get-in game [:moves player [x y]])]
+  [{:keys [player board] :as game} point]
+  (if-let [moves (get-in game [:moves player point])]
     (->
       (reduce apply-move game moves)
-      (apply-move (take-empty-cell-move player [x y]))
+      (apply-move (take-empty-cell-move player point))
       (with-available-moves)
       (with-next-player))
     game))
@@ -257,7 +225,7 @@
        (str (name p) ": " (get scores p))])
     ))

-(defn greeting []
+(defn run-game []
   [:h1 "Triboard"
    [show-scores @scores @current-player]
    (into
@@ -274,5 +242,5 @@
        ))
    ])

-(reagent/render [greeting]
+(reagent/render [run-game]
   (js/document.getElementById "app"))


test.keyval.

test.keyval.

--- test/elephantdb/cascading/integration_test.clj
+++ test/elephantdb/cascading/integration_test.clj
@@ -2,7 +2,7 @@
   (:use midje.sweet
         elephantdb.test.common
         [clojure.string :only (join)])
-  (:require [elephantdb.keyval.testing :as t])
+  (:require [elephantdb.test.keyval :as t])
   (:import [cascading.pipe Pipe]
            [cascading.tuple Fields Tuple]
            [cascading.flow FlowConnector]


don't skip messages with empty :text #7

don't skip messages with empty :text #7

--- src/consolelifebot/core.clj
+++ src/consolelifebot/core.clj
@@ -7,7 +7,9 @@
   (:gen-class))

 (defn dispatch [message]
-  (let [text (s/trim (:text message))]
+  (let [text (if (:text message)
+               (s/trim (:text message))
+               "")]
     (letfn [(pattern [command]
               (re-pattern (str "/" command "(@" configuration/telegram-bot-name ")?")))
             (matches [command]
@@ -18,7 +20,7 @@
                     :with-text response
                     :at (-> message :chat :id)))]

-      (when (:new_chat_member message)
+      (when (:new_chat_members message)
         (reply messages/welcome))

       (doseq [[command response]


Add missing runtimes for lambdas as listed in http://docs.aws.amazon.… (#104)

* Add missing runtimes for lambdas as listed in http://docs.aws.amazon.com/lambda/latest/dg/API_CreateFunction.html#SSS-CreateFunction-request-Runtime

* Reformat to not exceed 100 characters

--- src/crucible/aws/lambda.clj
+++ src/crucible/aws/lambda.clj
@@ -10,7 +10,13 @@

 (s/def ::timeout (spec-or-ref (s/and pos-int? #(<= % (* 5 60)))))

-(s/def ::runtime #{"nodejs" "nodejs4.3" "java8" "python2.7"})
+(s/def ::runtime #{"nodejs"
+                   "nodejs4.3"
+                   "nodejs6.10"
+                   "java8"
+                   "python2.7"
+                   "dotnetcore1.0"
+                   "nodejs4.3-edge"})

 (s/def ::role (spec-or-ref string?))


Refactor: Rename record

Refactor: Rename record

--- src/cylon/authorization.clj
+++ src/cylon/authorization.clj
@@ -33,7 +33,7 @@

 ;; Note: this implementation will cause the authenticator to be called twice if calling code wraps an invoke call with a restricted/authorized? check

-(defrecord RestrictedHandler [f authorizer requirement rejectfn]
+(defrecord RestrictedFn [f authorizer requirement rejectfn]
   restricted/Restricted
   (restricted/authorized? [this req]
     (authorized?
@@ -58,7 +58,7 @@
 (defn restrict-fn
   "Restrict a given function, such as a Ring handler, by some classification (which could be a set of roles, or anything that indicates the qualifying credentials a caller must exhibit in order to call the function. A function (or IFn) is returned."
   [f authorizer requirement rejectfn]
-  (->RestrictedHandler f authorizer requirement rejectfn))
+  (->RestrictedFn f authorizer requirement rejectfn))

 (defn restrict-handler
   ([handler authorizer requirement rejectfn]


Improved siblings and text rules

Improved siblings and text rules

--- src/datascript_dom/core.clj
+++ src/datascript_dom/core.clj
@@ -24,7 +24,8 @@
     ;;sibling
     [(siblings ?a ?b)
      [?a :parent ?p]
-     [?b :parent ?p]]
+     [?b :parent ?p]
+     [(!= ?a ?b)]]

     [(next-sibling ?this ?next)
      [?next :prev-sibling ?this]]
@@ -37,6 +38,10 @@
      [?text-node :parent ?container]
      [?text-node :tag :text-node]
      [?text-node :text ?text]]
+
+    [(text ?container ?text)
+     [?container :tag :text-node]
+     [?container :text ?text]]

     [(path2 ?a ?b)
      [?b :parent ?a]]
@@ -342,21 +347,31 @@
        @conn rules)

   (defn tech-spec [conn label]
-    (d/q '[:find ?value-text
-           :in $ % ?label-text
-           :where
-           [?label :tag :h4]
-           [?label :class "inline"]
-           (text ?label ?label-text)
-
-           (next-sibling ?label ?value)
-           (text ?value ?value-text)]
-         @conn rules label))
+    (->>
+     (d/q '[:find ?index ?value-text
+            :in $ % ?label-text
+            :where
+            [?label :tag :h4]
+            [?label :class "inline"]
+            (text ?label ?label-text)
+
+            (siblings ?label ?value)
+            (text ?value ?value-text)
+            [(!= "|" ?value-text)]
+            (?value :dom/index ?index)]
+          @conn rules label)
+     (sort-by first)
+     (map (comp (fn [x] (.trim x)) second))))

   (tech-spec conn "Runtime:")
   (tech-spec conn "Color:")
   (tech-spec conn "Sound Mix:")
-  (tech-spec conn "Aspect Ratio:") ;;fails, because there it's raw text (not in a tag)
+  (tech-spec conn "Aspect Ratio:")
+
+  ;;also works on other labelled fields!
+  (tech-spec conn "Budget:")
+  (tech-spec conn "Gross:")
+  (tech-spec conn "Language:")

   )


Commit accidentally unstaged changes

Commit accidentally unstaged changes

--- src/io/perun.clj
+++ src/io/perun.clj
@@ -463,7 +463,7 @@
                              (render-to-paths (:renderer options) tmp tracer))]
         (-> fileset
             (commit tmp)
-            (perun/merge-meta new-metadata))))))
+            (pm/merge-meta new-metadata))))))

 (deftask render
   "Render individual pages for entries in perun data.
@@ -487,11 +487,11 @@
    m meta     META     edn  "metadata to set on each entry"]
   (let [options (merge +render-defaults+ *opts*)]
     (letfn [(render-paths [fileset options]
-              (let [entries (filter (:filterer options) (perun/get-meta fileset))
+              (let [entries (filter (:filterer options) (pm/get-meta fileset))
                     paths (reduce
                            (fn [result {:keys [path] :as entry*}]
                              (let [entry (merge meta entry*)
-                                   render-data   {:meta    (perun/get-global-meta fileset)
+                                   render-data   {:meta    (pm/get-global-meta fileset)
                                                   :entries (vec entries)
                                                   :entry   entry}
                                    page-filepath (perun/create-filepath
@@ -514,10 +514,10 @@
   "Produces path maps of the shape required by `render-to-paths`, based
   on the provided `fileset` and `options`."
   [task-name fileset options]
-  (let [global-meta (perun/get-global-meta fileset)
+  (let [global-meta (pm/get-global-meta fileset)
         grouper (:grouper options)]
     (->> fileset
-         perun/get-meta
+         pm/get-meta
          (filter (:filterer options))
          grouper
          (reduce


stash

stash

--- src/user.clj
+++ src/user.clj
@@ -2,13 +2,18 @@
   (:require [com.stuartsierra.component :as component]
             [clojure.tools.namespace.repl :as ctnrepl]
             [open-company.app :as app]
+            [open-company.db.pool :as pool]
             [open-company.components :as components]))

 (def system nil)
+(def conn nil)

 (defn init []
   (alter-var-root #'system (constantly (components/oc-system {:handler-fn app/app
                                                               :port 3000}))))
+
+(defn bind-conn! []
+  (alter-var-root #'conn (constantly (pool/claim (get-in system [:db-pool :pool])))))

 (defn start []
   (alter-var-root #'system component/start))
@@ -18,7 +23,8 @@

 (defn go []
   (init)
-  (start))
+  (start)
+  (bind-conn!))

 (defn reset []
   (stop)
@@ -30,7 +36,7 @@

   (go)

-  (do
+  (do
     (clojure.tools.namespace.repl/set-refresh-dirs "src")
     (reset))


Removed test/main - not needed with lein test

--- test/main.clj
+++ test/main.clj
@@ -1,5 +0,0 @@
-(ns main
-  (:use clojure.test)
-  (:use compojure-test))
-
-(run-tests 'compojure-test)


CMR-1600: Remove unused requires

CMR-1600: Remove unused requires

--- search-app/test/cmr/search/test/services/json_parameters.clj
+++ search-app/test/cmr/search/test/services/json_parameters.clj
@@ -1,9 +1,7 @@
 (ns cmr.search.test.services.json-parameters
   (:require [clojure.test :refer :all]
-            [cmr.search.services.parameters.conversion :as p]
             [cmr.search.models.query :as q]
             [cmr.search.models.group-query-conditions :as gc]
-            [cmr.search.services.parameters.legacy-parameters :as lp]
             [cmr.search.services.json-parameters.conversion :as jp]
             [cheshire.core :as json]))


Use built-in sorting function

Use built-in sorting function

--- minicraft/desktop/src-common/minicraft/core.clj
+++ minicraft/desktop/src-common/minicraft/core.clj
@@ -86,7 +86,7 @@
                       (e/prevent-move entities)
                       (e/adjust-times screen))))
          e/attack-player
-         (high->low :y)
+         (sort-by :y #(compare %2 %1))
          play-sounds!
          (render-if-necessary! screen)
          (update-screen! screen)))


Minor edit.

Minor edit.

--- examples/simple.clj
+++ examples/simple.clj
@@ -43,7 +43,7 @@

 (def swing-frame (JFrame. "Processing with Clojure"))
 (doto swing-frame
-	(.setDefaultCloseOperation (JFrame/EXIT_ON_CLOSE))
+	(.setDefaultCloseOperation JFrame/EXIT_ON_CLOSE)
 	(.setSize 200 200)
 	(.add p5-applet)
 	(.pack)


Explicit loop target

Explicit loop target

So we can build on 1.9.655 and later
without emitting warning.

--- planck-cljs/src/planck/core.cljs
+++ planck-cljs/src/planck/core.cljs
@@ -65,28 +65,29 @@
       (raw-read)))
   IBufferedReader
   (-read-line [this]
-    (if-some [buffered @buffer]
-      (if-some [n (string/index-of buffered "\n" @pos)]
-        (let [rv (subs buffered @pos n)]
-          (reset! pos (inc n))
-          rv)
+    (loop []
+      (if-some [buffered @buffer]
+        (if-some [n (string/index-of buffered "\n" @pos)]
+          (let [rv (subs buffered @pos n)]
+            (reset! pos (inc n))
+            rv)
+          (if-some [new-chars (raw-read)]
+            (do
+              (reset! buffer (str (subs buffered @pos) new-chars))
+              (reset! pos 0)
+              (recur))
+            (do
+              (reset! buffer nil)
+              (let [rv (subs buffered @pos)]
+                (if (= rv "")
+                  nil
+                  rv)))))
         (if-some [new-chars (raw-read)]
           (do
-            (reset! buffer (str (subs buffered @pos) new-chars))
+            (reset! buffer new-chars)
             (reset! pos 0)
             (recur))
-          (do
-            (reset! buffer nil)
-            (let [rv (subs buffered @pos)]
-              (if (= rv "")
-                nil
-                rv)))))
-      (if-some [new-chars (raw-read)]
-        (do
-          (reset! buffer new-chars)
-          (reset! pos 0)
-          (recur))
-        nil)))
+          nil))))
   IClosable
   (-close [_]
     (raw-close)))


Filter out private core completions

Filter out private core completions

Former-commit-id: 79c941f1956f287e75c5273493215330ee609ef5

--- planck-cljs/src/planck/core.cljs
+++ planck-cljs/src/planck/core.cljs
@@ -72,9 +72,12 @@
 (defn ^:export get-current-ns []
   (str @current-ns))

-(defn completion-candidates-for-ns [ns-sym]
-  (map (comp str first)
-    (:defs (get (:cljs.analyzer/namespaces @planck.core/st) ns-sym))))
+(defn completion-candidates-for-ns [ns-sym allow-private?]
+  (map (comp str key)
+    (filter (if allow-private?
+              identity
+              #(not (:private (:meta (val %)))))
+      (:defs (get (:cljs.analyzer/namespaces @planck.core/st) ns-sym)))))

 (defn is-completion? [buffer-match-suffix candidate]
   (re-find (js/RegExp. (str "^" buffer-match-suffix)) candidate))
@@ -85,8 +88,8 @@
         all-candidates (into
                          (into
                            (into #{} namespace-candidates)
-                           (completion-candidates-for-ns 'cljs.core))
-                         (completion-candidates-for-ns @current-ns))]
+                           (completion-candidates-for-ns 'cljs.core false))
+                         (completion-candidates-for-ns @current-ns true))]
     (let [buffer-match-suffix (re-find #"[a-zA-Z]*$" buffer)
           buffer-prefix (subs buffer 0 (- (count buffer) (count buffer-match-suffix)))]
       (clj->js (if (= "" buffer-match-suffix)


Don’t warn when setting command line args

--- planck-cljs/src/planck/repl.cljs
+++ planck-cljs/src/planck/repl.cljs
@@ -228,9 +228,8 @@

 (defn- ^:export init
   [repl verbose cache-path checked-arrays static-fns fn-invoke-direct elide-asserts]
-  ;; TODO remove exists? check when we depend on next ClojureScript version
-  (when (exists? cljs.core/*command-line-args*)
-    (set! cljs.core/*command-line-args* (-> js/PLANCK_INITIAL_COMMAND_LINE_ARGS js->clj seq)))
+  (when (exists? *command-line-args*)
+    (set! ^:cljs.analyzer/no-resolve *command-line-args* (-> js/PLANCK_INITIAL_COMMAND_LINE_ARGS js->clj seq)))
   (load-core-analysis-caches repl)
   (let [opts (or (read-opts-from-file "opts.clj")
                  {})]


WIP RESTful API

WIP RESTful API

--- webui/src/webui/routes/api.clj
+++ webui/src/webui/routes/api.clj
@@ -22,11 +22,15 @@
             [compojure.core :refer :all]
             [cheshire.core :as json]
             [clojure.java.io :as io]
-            [clj-yaml.core :as yaml])
+            [clj-yaml.core :as yaml]
+            [webui.db.core :as db]
+            )
   (:use [taoensso.timbre :only [trace debug info warn error fatal]]))

 (def savedir "/tmp")

+;; TODO Read http://www.luminusweb.net/docs/responses.md
+;; for proper encoding reponses
 (defn json-response [data & [status]]
   "Returns a proper application/json response"
   {:status (or status 200)
@@ -62,7 +66,6 @@
   "Run workspace"
   (yaml-response "run-workspace stub"))

-
 ;; API Definition
 ;;
 ;; Everything in the /api context is a workspace
@@ -77,4 +80,10 @@
 (defroutes api-routes
   (context "/api" []
     (POST "/" [__anti-forgery-token workspace] (save-workspace workspace))
-    (GET "/" [] (load-workspace))))
+    (GET "/" [] (load-workspace))
+    (PUT "/:id" [id]
+         (update-workspace id))
+    (DELETE "/:id" [id]
+          (delete-workspace id))
+    (GET "/run/:id" [id]
+         (run-workspace id))))


update main to correspond with changes to instantiate_existing

--- uberjar/src/dda/pallet/dda_user_crate/main.clj
+++ uberjar/src/dda/pallet/dda_user_crate/main.clj
@@ -22,6 +22,18 @@
    [dda.config.commons.styled-output :as styled]
    [dda.pallet.core.app :as core-app]
    [dda.pallet.dda-user-crate.app :as app]))
+
+(defn- get-results-of-session
+  "gets the results of the session in some form"
+  [session]
+  (let [results (:results session)
+        phases (map #(-> % :result) results)
+        exit-codes (map #(-> % :exit) (flatten phases))
+        every-exit-code (every? #(or (= 0 %) (= nil %)) exit-codes)]
+    (spit "phases.edn" (prn-str phases))
+    (spit "results.edn" (prn-str results))
+    (spit "exit-codes.edn" (prn-str exit-codes))
+    (println every-exit-code)))

 (def cli-options
   [["-h" "--help"]
@@ -69,12 +81,14 @@
                                    :verbosity verbose})
                                 (exit 0 (styled/styled "ALL TESTS PASSED" :green))
                                 (exit 2 (styled/styled "SOME TESTS FAILED" :red)))
-      (:configure options) (core-app/existing-configure
-                             app/crate-app
-                             {:domain (first arguments)
-                              :targets (:targets options)})
-      :default (let [session (core-app/existing-install
-                              app/crate-app
-                              {:domain (first arguments)
-                               :targets (:targets options)})]
+      (:configure options) (get-results-of-session
+                             (core-app/existing-configure
+                               app/crate-app
+                               {:domain (first arguments)
+                                :targets (:targets options)}))
+      :default (let [session (get-results-of-session
+                               (core-app/existing-install
+                                 app/crate-app
+                                 {:domain (first arguments)
+                                  :targets (:targets options)}))]
                  (spit "out.edn" (prn-str session))))))


Don't recurse infinitely, ffs.

Don't recurse infinitely, ffs.

--- modules/core/src/main/clojure/immutant/repl.clj
+++ modules/core/src/main/clojure/immutant/repl.clj
@@ -88,7 +88,7 @@
          (util/at-exit (partial stop-nrepl server))
          server))))
   ([port]
-   (start-nrepl port)))
+   (start-nrepl nil port)))

 (defn ^:private spit-nrepl-files
   [port file]


whitespace

whitespace

--- server/src/gratefulplace/controllers/topics.clj
+++ server/src/gratefulplace/controllers/topics.clj
@@ -6,13 +6,19 @@

 (defn query
   [params]
-  (map #(s/serialize % ss/ent->topic {:include {:first-post {}
-                                                :author {:exclude [:email]}}})
+  (map #(s/serialize
+         %
+         ss/ent->topic
+         {:include {:first-post {}
+                    :author {:exclude [:email]}}})
        (db/all :topic/title)))

 (defn show
   [params]
   (let [id (id)]
-    {:body (s/serialize (db/ent id) ss/ent->topic {:include
-                                                   {:posts {:include
-                                                            {:author {:exclude [:email]}}}}})}))+    {:body (s/serialize
+            (db/ent id)
+            ss/ent->topic
+            {:include
+             {:posts {:include
+                      {:author {:exclude [:email]}}}}})}))


clean up unused core.typed annotations

clean up unused core.typed annotations

--- src/otto/web.clj
+++ src/otto/web.clj
@@ -1,21 +1,13 @@
 (ns otto.web
-  (:require ;[clojure.core.typed :as t :refer :all]
-            [compojure.core     :as c]
+  (:require [compojure.core     :as c]
             [ring.util.response :as r]
             [otto.html          :as html]))

-;; (def-alias OrganizationList (clojure.lang.IPersistentVector otto.organization.Organization))
+(defn- make-state
+  [organizations repositories]
+  {:organizations organizations
+   :repositories  repositories})

-;; (def-alias State (HMap :complete? true
-;;                        :mandatory {:organizations OrganizationList}))
-
-;; (ann make-state [OrganizationList -> State])
-(defn- make-state
-  [o r]
-  {:organizations o
-   :repositories  r})
-
-;; (ann show-organization [State -> String])
 (defn- show-organization
   ([state]
    (let [organization-name (:name (first (:organizations state)))]
@@ -26,7 +18,6 @@
                                 first)]
        (html/organization-view (.items (:repositories state) organization))))) ;; TODO else

-;; (ann make-handler-fn [OrganizationList -> [Any -> String]])
 (defn make-handler-fn
   [o r]
   (let [s (make-state o r)]


Avoid null pointer exceptions

Avoid null pointer exceptions

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

--- clojure/acq_engine.clj
+++ clojure/acq_engine.clj
@@ -217,7 +217,7 @@
 		#(await-for 10000 (device-agents (. mmc getCameraDevice)))
 		#(when-let [wait-time-ms (event :wait-time-ms)]
 		  (acq-sleep wait-time-ms))
-		#(when (event :autofocus)
+		#(when (:autofocus event)
 		  (store-z-correction (run-autofocus)))
 		#(snap-image true (:close-shutter event))
 		#(collect-image event out-queue)
@@ -225,7 +225,7 @@

 (defn execute [event-fns]
   (doseq [event-fn event-fns :while (not (:stop @interrupt-requests))]
-    (while (@interrupt-requests :pause) (Thread/sleep 5))
+    (while (:pause @interrupt-requests) (Thread/sleep 5))
     (event-fn)))

 (defn stop-acq []


Remove unused code.

Remove unused code.

--- frontend/src/uxbox/main/ui/shapes/selection.cljs
+++ frontend/src/uxbox/main/ui/shapes/selection.cljs
@@ -245,16 +245,6 @@
    :width width
    :height height})

-(defn- render-path
-  [points]
-  {:pre [(pos? (count points))]}
-  (let [start (first points)
-        close? false
-        init  (str "M " (:x start) " " (:y start))
-        path  (reduce #(str %1 " L" (:x %2) " " (:y %2)) init points)]
-    (cond-> path
-      close? (str " Z"))))
-
 (mx/defc controls
   {:mixins [mx/static]}
   [{:keys [x1 y1 width height] :as shape} zoom on-mouse-down]


Fix image importation from galery to workspace.

--- frontend/src/uxbox/main/ui/workspace/images.cljs
+++ frontend/src/uxbox/main/ui/workspace/images.cljs
@@ -95,6 +95,7 @@
   (letfn [(on-double-click [event]
             (let [shape {:type :image
                          :name name
+                         :id (uuid/random)
                          :metadata {:width width
                                     :height height}
                          :image id}]


improve msg

improve msg

--- src/mermaid_ldjam/core.cljs
+++ src/mermaid_ldjam/core.cljs
@@ -50,7 +50,7 @@
    [:starfish :window-open] {:text "You throw the starfish out the window." :action [unhide :seagull]}
    [:bottle :seagull] {:text "You start drinking with the seagull. The seagull drunkenly points in the corner." :action [unhide :broom]}
    [:bottle :starfish] {:text "You hand the bottle to the starfish. It takes a sip of wine, but it's more of a whiskey person."}
-   [:broom :window-open] {:text "You catapult yourself out of the room. FREEDOM! You won." :action [win-game]}
+   [:broom :window-open] {:text "You catapult yourself out of the room with the broom. FREEDOM! You won." :action [win-game]}
    [:broom :bucket] {:text "You try to put the broom in the bucket. That's where the broom belongs, but you're not here to clean up."}
    })


Improve tailing -- Towards an API

Improve tailing -- Towards an API

--- test/com/nomistech/clojure_the_language/c_920_io/tailing.clj
+++ test/com/nomistech/clojure_the_language/c_920_io/tailing.clj
@@ -6,6 +6,8 @@
   (:import (java.io File)
            (org.apache.commons.io.input TailerListener
                                         Tailer)))
+
+;; Internals

 (defn tailer-listener [c]
   (reify TailerListener
@@ -21,6 +23,8 @@
     (^void handle [this ^Exception i]
      (println (str "exception: " i)))))

+;; API
+
 (defn make-tailer-and-channel [file delay-ms]
   (let [c      (a/chan)
         tailer (Tailer/create file
@@ -33,9 +37,11 @@
 (defn channel [t-and-c]
   (::channel t-and-c))

-(defn stop-tailer-and-channel [{:keys [::channel ::tailer]}]
+(defn stop-tailer-and-channel! [{:keys [::channel ::tailer]}]
   (.stop tailer)
   (a/close! channel))
+
+;; Tests

 (defn spit-lines-s [f lines-s sleep-ms]
   (Thread/sleep sleep-ms)
@@ -73,7 +79,7 @@
             t-and-c   (make-tailer-and-channel file delay-ms)
             result-ch (a/thread (doall (tailer-and-channel->seq t-and-c)))]
         (spit-lines-s file lines-s sleep-ms)
-        (stop-tailer-and-channel t-and-c)
+        (stop-tailer-and-channel! t-and-c)
         (a/<!! result-ch)
         => ["I met" "her" "in a" "pool room" "her name" "I didn't" "catch"
             "she" "looked" "like" "something special"]))


Rollback not needed changes to the org resource for the id-token load.

--- src/oc/storage/api/orgs.clj
+++ src/oc/storage/api/orgs.clj
@@ -25,12 +25,6 @@
             [oc.storage.resources.entry :as entry-res]))

 ;; ----- Utility functions -----
-
-(defn- user-from-context [ctx]
-    (or (:user ctx)
-        (let [decoded-token (:id-token ctx)]
-          {:user-id (get-in decoded-token [:claims :user-id])
-           :teams [(get-in decoded-token [:claims :team-id])]})))

 (defn- board-with-access-level
   "
@@ -219,7 +213,7 @@

 ;; A resource for operations on a particular Org
 (defresource org [conn slug]
-  (api-common/open-company-id-token-resource config/passphrase) ; verify validity of optional JWToken
+  (api-common/open-company-anonymous-resource config/passphrase) ; verify validity of optional JWToken

   :allowed-methods [:options :get :patch]

@@ -236,8 +230,7 @@
   ;; Authorization
   :allowed? (by-method {
     :options true
-    :get (fn [ctx] (let [user (user-from-context ctx)]
-                     (access/access-level-for conn slug user)))
+    :get (fn [ctx] (access/access-level-for conn slug (:user ctx)))
     :patch (fn [ctx] (access/allow-authors conn slug (:user ctx)))})

   ;; Validations
@@ -256,7 +249,7 @@
   :patch! (fn [ctx] (update-org conn ctx slug))

   ;; Responses
-  :handle-ok (fn [ctx] (let [user (user-from-context ctx)
+  :handle-ok (fn [ctx] (let [user (:user ctx)
                              user-id (:user-id user)
                              org (or (:updated-org ctx) (:existing-org ctx))
                              org-id (:uuid org)


require load-local-docs, stub out reaction for :storage-updated event, comment out activity logger awaiting new implementation

--- src/app/cljs/one/sample/model.cljs
+++ src/app/cljs/one/sample/model.cljs
@@ -1,6 +1,7 @@
 (ns ^{:doc "Contains client-side state, validators for input fields
   and functions which react to changes made to the input fields."}
   one.sample.model
+  (:use [one.sample.controller :only [load-local-docs]])
   (:require [one.dispatch :as dispatch]
             [local        :as local]))

@@ -44,7 +45,13 @@
       (condp = command
         :set! (let [[k v] args]
                 (swap! doc-state assoc k v :ts (now))
-                (local/conj-item! "activity" {:id (@state :id) :ts (now)}))
+                (comment
+                  (local/conj-item! "activity" {:id (@state :id) :ts (now)})))
         :get  (let [[key] args]
                 (@doc-state key))))))

+(dispatch/react-to #{:storage-updated}
+                   (fn [_ _]
+                     (.log js/console ":storage-updated")
+                     (comment (load-local-docs)
+                              (dispatch/fire (keyword (:document @state))))))


added input-group-btn

added input-group-btn

--- src/om_bootstrap/input.cljs
+++ src/om_bootstrap/input.cljs
@@ -28,7 +28,8 @@

 (def Addons
   {(s/optional-key :addon-before) (s/either s/Str t/Component)
-   (s/optional-key :addon-after) (s/either s/Str t/Component)})
+   (s/optional-key :addon-after) (s/either s/Str t/Component)
+   (s/optional-key :addon-button) (s/either s/Str t/Component)})

 (def FeedbackIcons
   "Helps render feedback icons."
@@ -91,15 +92,17 @@

 (s/defn render-input-group
   "Items is a vector of render instances."
-  [{:keys [addon-before addon-after]} :- Addons
+  [{:keys [addon-before addon-after addon-button]} :- Addons
    items :- s/Any]
-  (if (or addon-before addon-after)
+  (if (or addon-before addon-after addon-button)
     (d/div {:class "input-group"}
            (when addon-before
              (d/span {:class "input-group-addon"} addon-before))
            items
            (when addon-after
-             (d/span {:class "input-group-addon"} addon-after)))
+             (d/span {:class "input-group-addon"} addon-after))
+           (when addon-button
+             (d/span {:class "input-group-btn"} addon-button)))
     items))

 (s/defn checkbox-or-radio? :- s/Bool
@@ -186,7 +189,7 @@
            (render-form-group input))
       (->> [(render-label input)
             (->> [(render-input-group
-                   (select-keys input [:addon-before :addon-after])
+                   (select-keys input [:addon-before :addon-after :addon-button])
                    (render-input input attrs children))
                   (render-icon (select-keys input [:feedback? :bs-style]))
                   (render-help (:help input))]


Convert latencies to ms.

Convert latencies to ms.

--- src/onyx_benchmark/peer.clj
+++ src/onyx_benchmark/peer.clj
@@ -56,11 +56,11 @@
                 start (System/currentTimeMillis)
                 _ (reset! retry-counter 0)
                 latencies (:latencies latency)
-                latency-00 (get latencies 0.0)
-                latency-05 (get latencies 0.5)
-                latency-095 (get latencies 0.95)
-                latency-099 (get latencies 0.99)
-                latency-0999 (get latencies 0.999)]
+                latency-00 (float (/ (get latencies 0.0) 1000000))
+                latency-05 (float (/ (get latencies 0.5) 1000000))
+                latency-095 (float (/ (get latencies 0.95) 1000000))
+                latency-099 (float (/ (get latencies 0.99) 1000000))
+                latency-0999 (float (/ (get latencies 0.999) 1000000))]
             (info "-> " throughput ", retries: " retry-cnt ", latency " latency " <-")
             (info "-> " latency-00 latency-05 latency-095 latency-099 latency-0999)
             (r/send-event client {:service "onyx-retry" :state "ok" :metric retry-cnt :tags ["benchmark"]})


Updatet docstring for create-child-assoc

--- lambdalf-lib/src/main/clojure/alfresco/nodes.clj
+++ lambdalf-lib/src/main/clojure/alfresco/nodes.clj
@@ -39,7 +39,6 @@
   (aspects [this] "Provides all the aspect QNames of this node")
   (dir? [this] "True if the node is of type or subtype of cm:folder ")
   (create-child-assoc [this propmap] "Creates a new node. Accepts a map containing the following parameters:
-   - parent : parent nodeRef
    - assoc-type : OPTIONAL - the association type. Defaults to cm:contains
    - assoc : OPTIONAL - the association name. Defaults to the new node cm:name
    - props : QName -> Serializable map of initial node metadata.


cosets.clj: renamed a function

cosets.clj: renamed a function

--- clojure/org/gavrog/clojure/cosets.clj
+++ clojure/org/gavrog/clojure/cosets.clj
@@ -139,7 +139,7 @@
                   (nil? nval) 1
                   :else (- nval oval))))))

-(defn- canonical [table gens]
+(defn- canonical-table [table gens]
   (every? (fn [start] (not (neg? (compare-renumbered-from table gens start))))
           (range 1 (count table))))

@@ -172,7 +172,7 @@
                                   [t equiv]
                                   (scan-relations rels [] t pempty k)]
                                   :when (and (empty? equiv)
-                                             (canonical t gens))]
+                                             (canonical-table t gens))]
                              t))))})))

 (defn- induced-table [gens img img0]


for regular patterns, defer unification until after doing (re-matches), since the latter will eliminate many possibilities, reducing amount of unnecessary unification

--- src/babel/francais/morphology.cljc
+++ src/babel/francais/morphology.cljc
@@ -138,7 +138,6 @@
                         (map #(let [{path :path
                                      prefix :prefix
                                      suffix :suffix
-                                     surface-fn :surface-fn
                                      unify-with :unify-with} %]
                                 (if (not (= :fail (unify unify-with lookup-spec)))
                                   (cond (and (not (nil? prefix))
@@ -156,15 +155,16 @@
                         (map
                          (fn [replace-pattern]
                            (let [from (nth (:g replace-pattern) 0)
-                                 to (nth (:g replace-pattern) 1)
-                                 unify-against (if (:u replace-pattern)
-                                                 (:u replace-pattern)
-                                                 :top)
-                                 unified (unify unify-against
-                                                conjugate-with)]
+                                 to (nth (:g replace-pattern) 1)]
                              (if (and from to infinitive
-                                      (not (= :fail unified))
-                                      (re-matches from infinitive))
+                                      (re-matches from infinitive)
+                                      (not (= :fail
+                                              (let [unify-against (if (:u replace-pattern)
+                                                                    (:u replace-pattern)
+                                                                    :top)]
+                                                (unify unify-against
+                                                       conjugate-with)))))
+
                                (string/replace infinitive from to))))
                          regular-patterns))]
             (let [results (concat exceptional-surface-forms regulars [infinitive])]