Single window UI

Single window UI

--- src/brevis/ui/core.clj
+++ src/brevis/ui/core.clj
@@ -19,7 +19,7 @@
     [leiningen.core.main :as lein-main])
   (:use [clojure.java.io :only [file]]
         [clojure.pprint]
-        [seesaw core font color graphics chooser]
+        [seesaw core font color graphics chooser mig]
         [brevis.ui.profile]))

 ;; ## Globals
@@ -42,6 +42,9 @@

 (def repl-outputstream
   (atom nil))
+
+(def ui-window
+  "The complete UI panel." (atom nil))

 ;;

@@ -189,49 +192,94 @@
     (make-project-window proj)
     #_(println "Switching project:" proj)))

+#_(defn make-editor-window
+     "Make an editor window."
+     [params]
+     (let [
+           textArea (RSyntaxTextArea. 42 115)
+           ;textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
+           ;textArea.setCodeFoldingEnabled(true);
+           sp (RTextScrollPane. textArea)
+           a-new (action :handler a-new :name "New" :tip "Create a new file.")
+           a-open (action :handler a-open :name "Open" :tip "Open a file")
+           a-save (action :handler a-save :name "Save" :tip "Save the current file.")
+           a-exit (action :handler a-exit :name "Exit" :tip "Exit the editor.")
+           a-copy (action :handler a-copy :name "Copy" :tip "Copy selected text to the clipboard.")
+           a-paste (action :handler a-paste :name "Paste" :tip "Paste text from the clipboard.")
+           a-cut (action :handler a-cut :name "Cut" :tip "Cut text to the clipboard.")
+           a-save-as (action :handler a-save-as :name "Save As" :tip "Save the current file.")
+           a-eval-file (action :handler a-eval-file :name "Evaluate" :tip "Evaluate the current file.")
+           a-projects (map #(action :handler (make-a-active-project %)
+                                    :name (str (:group %) "/" (:name %))
+                                    :tip (str (:group %) "/" (:name %)))
+                           (:projects @current-profile))
+           menus (menubar
+                   :items [(menu :text "File" :items [a-new a-open a-save a-save-as a-exit])
+                           (menu :text "Edit" :items [a-copy a-cut a-paste])
+                           (menu :text "Run" :items [a-eval-file])
+                           (menu :text "Projects" :items (into [] a-projects))
+                           (menu :text "Git" :items [])
+                           #_(menu :text "My Project" :items [(action :handler (fn [e] nil) :name "Open a project")
+                                                             (action :handler (fn [e] nil) :name "in")
+                                                             (action :handler (fn [e] nil) :name "projects menu")])])
+           f (frame :title "Brevis - Editor Window" :menubar menus)]
+       (.setSyntaxEditingStyle textArea (cond (= (:language params) :java)
+                                              (SyntaxConstants/SYNTAX_STYLE_JAVA)
+                                              :else
+                                              (SyntaxConstants/SYNTAX_STYLE_CLOJURE)))
+       (.setCodeFoldingEnabled textArea true)
+       (display f sp)
+       (-> f pack! show!)
+       (.setLocation f 0 0)
+       {:frame f
+        :text-area textArea
+        :scroll-pane sp
+        :menus menus}))
+
 (defn make-editor-window
-    "Make an editor window."
-    [params]
-    (let [
-          textArea (RSyntaxTextArea. 42 115)
-          ;textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
-          ;textArea.setCodeFoldingEnabled(true);
-          sp (RTextScrollPane. textArea)
-          a-new (action :handler a-new :name "New" :tip "Create a new file.")
-          a-open (action :handler a-open :name "Open" :tip "Open a file")
-          a-save (action :handler a-save :name "Save" :tip "Save the current file.")
-          a-exit (action :handler a-exit :name "Exit" :tip "Exit the editor.")
-          a-copy (action :handler a-copy :name "Copy" :tip "Copy selected text to the clipboard.")
-          a-paste (action :handler a-paste :name "Paste" :tip "Paste text from the clipboard.")
-          a-cut (action :handler a-cut :name "Cut" :tip "Cut text to the clipboard.")
-          a-save-as (action :handler a-save-as :name "Save As" :tip "Save the current file.")
-          a-eval-file (action :handler a-eval-file :name "Evaluate" :tip "Evaluate the current file.")
-          a-projects (map #(action :handler (make-a-active-project %)
-                                   :name (str (:group %) "/" (:name %))
-                                   :tip (str (:group %) "/" (:name %)))
-                          (:projects @current-profile))
-          menus (menubar
-                  :items [(menu :text "File" :items [a-new a-open a-save a-save-as a-exit])
-                          (menu :text "Edit" :items [a-copy a-cut a-paste])
-                          (menu :text "Run" :items [a-eval-file])
-                          (menu :text "Projects" :items (into [] a-projects))
-                          (menu :text "Git" :items [])
-                          #_(menu :text "My Project" :items [(action :handler (fn [e] nil) :name "Open a project")
-                                                            (action :handler (fn [e] nil) :name "in")
-                                                            (action :handler (fn [e] nil) :name "projects menu")])])
-          f (frame :title "Brevis - Editor Window" :menubar menus)]
-      (.setSyntaxEditingStyle textArea (cond (= (:language params) :java)
-                                             (SyntaxConstants/SYNTAX_STYLE_JAVA)
-                                             :else
-                                             (SyntaxConstants/SYNTAX_STYLE_CLOJURE)))
-      (.setCodeFoldingEnabled textArea true)
-      (display f sp)
-      (-> f pack! show!)
-      (.setLocation f 0 0)
-      {:frame f
-       :text-area textArea
-       :scroll-pane sp
-       :menus menus}))
+     "Make an editor window."
+     [params]
+     (let [
+           textArea (RSyntaxTextArea. 42 115)
+           ;textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
+           ;textArea.setCodeFoldingEnabled(true);
+           sp (RTextScrollPane. textArea)
+           a-new (action :handler a-new :name "New" :tip "Create a new file.")
+           a-open (action :handler a-open :name "Open" :tip "Open a file")
+           a-save (action :handler a-save :name "Save" :tip "Save the current file.")
+           a-exit (action :handler a-exit :name "Exit" :tip "Exit the editor.")
+           a-copy (action :handler a-copy :name "Copy" :tip "Copy selected text to the clipboard.")
+           a-paste (action :handler a-paste :name "Paste" :tip "Paste text from the clipboard.")
+           a-cut (action :handler a-cut :name "Cut" :tip "Cut text to the clipboard.")
+           a-save-as (action :handler a-save-as :name "Save As" :tip "Save the current file.")
+           a-eval-file (action :handler a-eval-file :name "Evaluate" :tip "Evaluate the current file.")
+           a-projects (map #(action :handler (make-a-active-project %)
+                                    :name (str (:group %) "/" (:name %))
+                                    :tip (str (:group %) "/" (:name %)))
+                           (:projects @current-profile))
+           menus (menubar
+                   :items [(menu :text "File" :items [a-new a-open a-save a-save-as a-exit])
+                           (menu :text "Edit" :items [a-copy a-cut a-paste])
+                           (menu :text "Run" :items [a-eval-file])
+                           (menu :text "Projects" :items (into [] a-projects))
+                           (menu :text "Git" :items [])
+                           #_(menu :text "My Project" :items [(action :handler (fn [e] nil) :name "Open a project")
+                                                             (action :handler (fn [e] nil) :name "in")
+                                                             (action :handler (fn [e] nil) :name "projects menu")])])
+           ;f (frame :title "Brevis - Editor Window" :menubar menus)
+           ]
+       (.setSyntaxEditingStyle textArea (cond (= (:language params) :java)
+                                              (SyntaxConstants/SYNTAX_STYLE_JAVA)
+                                              :else
+                                              (SyntaxConstants/SYNTAX_STYLE_CLOJURE)))
+       (.setCodeFoldingEnabled textArea true)
+       #_(display f sp)
+       #_(-> f pack! show!)
+       #_(.setLocation f 0 0)
+       {;:frame f
+        :text-area textArea
+        :scroll-pane sp
+        :menus menus}))

 (defn get-repl-inputstream
   "Return the input stream for the REPL."
@@ -243,97 +291,226 @@
   []
   @repl-outputstream)

+#_(defn make-repl-input-window
+     "Make a REPL input window."
+     [params]
+     (let [textArea (RSyntaxTextArea. 25 115)
+           ;textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
+           ;textArea.setCodeFoldingEnabled(true);
+           sp (RTextScrollPane. textArea)
+           a-new (action :handler a-new :name "New" :tip "Create a new file.")
+           a-open (action :handler a-open :name "Open" :tip "Open a file")
+           a-save (action :handler a-save :name "Save" :tip "Save the current file.")
+           a-exit (action :handler a-exit :name "Exit" :tip "Exit the editor.")
+           a-copy (action :handler a-copy :name "Copy" :tip "Copy selected text to the clipboard.")
+           a-paste (action :handler a-paste :name "Paste" :tip "Paste text from the clipboard.")
+           a-cut (action :handler a-cut :name "Cut" :tip "Cut text to the clipboard.")
+           a-save-as (action :handler a-save-as :name "Save As" :tip "Save the current file.")
+           menus (menubar
+                   :items [#_(menu :text "File" :items [a-new a-open a-save a-save-as a-exit])
+                           (menu :text "Edit" :items [a-copy a-cut a-paste])])
+           f (frame :title "Brevis - REPL Input" :menubar menus)]
+       (.addKeyListener textArea
+         (proxy [java.awt.event.KeyAdapter] []
+           (keyPressed [#^java.awt.event.KeyEvent e]
+             (when (= (.getKeyCode e) java.awt.event.KeyEvent/VK_UP)
+               (try
+                 (let [startPosition 0]
+                   (.remove (.getDocument textArea) startPosition (- (.getLength (.getDocument textArea)) startPosition 1))
+                   (.setText textArea (nth @repl-input (- (dec (count @repl-input)) @repl-input-index)))
+                   (reset! repl-input-index (min (inc @repl-input-index) (dec (count @repl-input))))
+                   #_(.setText textArea (last @repl-input)))
+                 (catch Exception e (println (.getMessage e))))
+               (.consume e))
+             (when (= (.getKeyCode e) java.awt.event.KeyEvent/VK_DOWN)
+               (try
+                 (let [startPosition 0]
+                   (.remove (.getDocument textArea) startPosition (- (.getLength (.getDocument textArea)) startPosition 1))
+                   (.setText textArea (nth @repl-input (- (dec (count @repl-input)) @repl-input-index)))
+                   (reset! repl-input-index (max (dec @repl-input-index) 0))
+                   #_(.setText textArea (last @repl-input)))
+                 (catch Exception e (println (.getMessage e))))
+               (.consume e))
+             (when (= (.getKeyCode e) java.awt.event.KeyEvent/VK_ENTER)
+               (.append textArea "\n")
+               ;; This shouldn't be here:
+               #_(text! (:text-area @repl-output-window) (.toString (get-repl-outputstream)))
+               (try
+                 (let [startPosition 0
+                       line (.getText textArea startPosition (- (.getLength (.getDocument textArea)) startPosition 1))
+                       ;response-vals (nrepl/message (:client @repl) {:op "eval" :code line})
+                       #_session-sender #_(nrepl/client-session @reply.eval-modes.nrepl/current-connection :session @reply.eval-modes.nrepl/current-session)]
+                   (reset! repl-input-index 0)
+                   (.setText textArea "")
+                   (eval-and-print line true)
+                   ;; Add to a console history
+                   )
+                 (catch Exception e (println (.getMessage e))))
+               (.consume e)))))
+       (.setSyntaxEditingStyle textArea (cond (= (:language params) :java)
+                                              (SyntaxConstants/SYNTAX_STYLE_JAVA)
+                                              :else
+                                              (SyntaxConstants/SYNTAX_STYLE_CLOJURE)))
+       #_(.setCodeFoldingEnabled textArea true)
+       (display f sp)
+       (-> f pack! show!)
+       #_(println (.getLocation f))
+       (.setLocation f 0 680)
+       {:frame f
+        :text-area textArea
+        :scroll-pane sp
+        :menus menus}))
+
 (defn make-repl-input-window
-    "Make a REPL input window."
+     "Make a REPL input window."
+     [params]
+     (let [textArea (RSyntaxTextArea. 25 115)
+           ;textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
+           ;textArea.setCodeFoldingEnabled(true);
+           sp (RTextScrollPane. textArea)
+           a-new (action :handler a-new :name "New" :tip "Create a new file.")
+           a-open (action :handler a-open :name "Open" :tip "Open a file")
+           a-save (action :handler a-save :name "Save" :tip "Save the current file.")
+           a-exit (action :handler a-exit :name "Exit" :tip "Exit the editor.")
+           a-copy (action :handler a-copy :name "Copy" :tip "Copy selected text to the clipboard.")
+           a-paste (action :handler a-paste :name "Paste" :tip "Paste text from the clipboard.")
+           a-cut (action :handler a-cut :name "Cut" :tip "Cut text to the clipboard.")
+           a-save-as (action :handler a-save-as :name "Save As" :tip "Save the current file.")
+           menus (menubar
+                   :items [#_(menu :text "File" :items [a-new a-open a-save a-save-as a-exit])
+                           (menu :text "Edit" :items [a-copy a-cut a-paste])])
+           ;f (frame :title "Brevis - REPL Input" :menubar menus)
+           ]
+       (.addKeyListener textArea
+         (proxy [java.awt.event.KeyAdapter] []
+           (keyPressed [#^java.awt.event.KeyEvent e]
+             (when (= (.getKeyCode e) java.awt.event.KeyEvent/VK_UP)
+               (try
+                 (let [startPosition 0]
+                   (.remove (.getDocument textArea) startPosition (- (.getLength (.getDocument textArea)) startPosition 1))
+                   (.setText textArea (nth @repl-input (- (dec (count @repl-input)) @repl-input-index)))
+                   (reset! repl-input-index (min (inc @repl-input-index) (dec (count @repl-input))))
+                   #_(.setText textArea (last @repl-input)))
+                 (catch Exception e (println (.getMessage e))))
+               (.consume e))
+             (when (= (.getKeyCode e) java.awt.event.KeyEvent/VK_DOWN)
+               (try
+                 (let [startPosition 0]
+                   (.remove (.getDocument textArea) startPosition (- (.getLength (.getDocument textArea)) startPosition 1))
+                   (.setText textArea (nth @repl-input (- (dec (count @repl-input)) @repl-input-index)))
+                   (reset! repl-input-index (max (dec @repl-input-index) 0))
+                   #_(.setText textArea (last @repl-input)))
+                 (catch Exception e (println (.getMessage e))))
+               (.consume e))
+             (when (= (.getKeyCode e) java.awt.event.KeyEvent/VK_ENTER)
+               (.append textArea "\n")
+               ;; This shouldn't be here:
+               #_(text! (:text-area @repl-output-window) (.toString (get-repl-outputstream)))
+               (try
+                 (let [startPosition 0
+                       line (.getText textArea startPosition (- (.getLength (.getDocument textArea)) startPosition 1))
+                       ;response-vals (nrepl/message (:client @repl) {:op "eval" :code line})
+                       #_session-sender #_(nrepl/client-session @reply.eval-modes.nrepl/current-connection :session @reply.eval-modes.nrepl/current-session)]
+                   (reset! repl-input-index 0)
+                   (.setText textArea "")
+                   (eval-and-print line true)
+                   ;; Add to a console history
+                   )
+                 (catch Exception e (println (.getMessage e))))
+               (.consume e)))))
+       (.setSyntaxEditingStyle textArea (cond (= (:language params) :java)
+                                              (SyntaxConstants/SYNTAX_STYLE_JAVA)
+                                              :else
+                                              (SyntaxConstants/SYNTAX_STYLE_CLOJURE)))
+       #_(.setCodeFoldingEnabled textArea true)
+       #_(display f sp)
+       #_(-> f pack! show!)
+       #_(println (.getLocation f))
+       #_(.setLocation f 0 680)
+       {;:frame f
+        :text-area textArea
+        :scroll-pane sp
+        :menus menus}))
+
+#_(defn make-repl-output-window
+    "Make an editor window."
     [params]
-    (let [textArea (RSyntaxTextArea. 25 115)
-          ;textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
-          ;textArea.setCodeFoldingEnabled(true);
-          sp (RTextScrollPane. textArea)
-          a-new (action :handler a-new :name "New" :tip "Create a new file.")
-          a-open (action :handler a-open :name "Open" :tip "Open a file")
-          a-save (action :handler a-save :name "Save" :tip "Save the current file.")
-          a-exit (action :handler a-exit :name "Exit" :tip "Exit the editor.")
-          a-copy (action :handler a-copy :name "Copy" :tip "Copy selected text to the clipboard.")
-          a-paste (action :handler a-paste :name "Paste" :tip "Paste text from the clipboard.")
-          a-cut (action :handler a-cut :name "Cut" :tip "Cut text to the clipboard.")
-          a-save-as (action :handler a-save-as :name "Save As" :tip "Save the current file.")
-          menus (menubar
-                  :items [#_(menu :text "File" :items [a-new a-open a-save a-save-as a-exit])
-                          (menu :text "Edit" :items [a-copy a-cut a-paste])])
-          f (frame :title "Brevis - REPL Input" :menubar menus)]
-      (.addKeyListener textArea
-        (proxy [java.awt.event.KeyAdapter] []
-          (keyPressed [#^java.awt.event.KeyEvent e]
-            (when (= (.getKeyCode e) java.awt.event.KeyEvent/VK_UP)
-              (try
-                (let [startPosition 0]
-                  (.remove (.getDocument textArea) startPosition (- (.getLength (.getDocument textArea)) startPosition 1))
-                  (.setText textArea (nth @repl-input (- (dec (count @repl-input)) @repl-input-index)))
-                  (reset! repl-input-index (min (inc @repl-input-index) (dec (count @repl-input))))
-                  #_(.setText textArea (last @repl-input)))
-                (catch Exception e (println (.getMessage e))))
-              (.consume e))
-            (when (= (.getKeyCode e) java.awt.event.KeyEvent/VK_DOWN)
-              (try
-                (let [startPosition 0]
-                  (.remove (.getDocument textArea) startPosition (- (.getLength (.getDocument textArea)) startPosition 1))
-                  (.setText textArea (nth @repl-input (- (dec (count @repl-input)) @repl-input-index)))
-                  (reset! repl-input-index (max (dec @repl-input-index) 0))
-                  #_(.setText textArea (last @repl-input)))
-                (catch Exception e (println (.getMessage e))))
-              (.consume e))
-            (when (= (.getKeyCode e) java.awt.event.KeyEvent/VK_ENTER)
-              (.append textArea "\n")
-              ;; This shouldn't be here:
-              #_(text! (:text-area @repl-output-window) (.toString (get-repl-outputstream)))
-              (try
-                (let [startPosition 0
-                      line (.getText textArea startPosition (- (.getLength (.getDocument textArea)) startPosition 1))
-                      ;response-vals (nrepl/message (:client @repl) {:op "eval" :code line})
-                      #_session-sender #_(nrepl/client-session @reply.eval-modes.nrepl/current-connection :session @reply.eval-modes.nrepl/current-session)]
-                  (reset! repl-input-index 0)
-                  (.setText textArea "")
-                  (eval-and-print line true)
-                  ;; Add to a console history
-                  )
-                (catch Exception e (println (.getMessage e))))
-              (.consume e)))))
-      (.setSyntaxEditingStyle textArea (cond (= (:language params) :java)
-                                             (SyntaxConstants/SYNTAX_STYLE_JAVA)
-                                             :else
-                                             (SyntaxConstants/SYNTAX_STYLE_CLOJURE)))
-      #_(.setCodeFoldingEnabled textArea true)
-      (display f sp)
-      (-> f pack! show!)
-      #_(println (.getLocation f))
-      (.setLocation f 0 680)
-      {:frame f
-       :text-area textArea
-       :scroll-pane sp
-       :menus menus}))
+    (let [f (frame :title "Brevis - REPL Output" :width 800 :height 200 :minimum-size [800 :by 360])
+          text-area (text :multi-line? true :font "MONOSPACED-PLAIN-14"
+                                           :text "> ")
+          area (scrollable text-area)
+          listener-thread (Thread. (fn []
+                                     (loop []
+                                       (let [resp (nrepl.transport/recv (:client @repl) 20)]
+                                         (when resp
+                                           (when (:out resp) (write-stdout-repl (:out resp)))
+                                           (when (:value resp) (write-value-repl (:value resp)))))
+                                       (recur))))]
+     (display f area)
+     (-> f pack! show!)
+     (.setLocation f 850 650)
+     {:frame f
+      :scrollable area
+      :listener-thread listener-thread
+      :text-area text-area}))

 (defn make-repl-output-window
-   "Make an editor window."
-   [params]
-   (let [f (frame :title "Brevis - REPL Output" :width 800 :height 200 :minimum-size [800 :by 360])
-         text-area (text :multi-line? true :font "MONOSPACED-PLAIN-14"
-                                          :text "> ")
-         area (scrollable text-area)
-         listener-thread (Thread. (fn []
-                                    (loop []
-                                      (let [resp (nrepl.transport/recv (:client @repl) 20)]
-                                        (when resp
-                                          (when (:out resp) (write-stdout-repl (:out resp)))
-                                          (when (:value resp) (write-value-repl (:value resp)))))
-                                      (recur))))]
-    (display f area)
-    (-> f pack! show!)
-    (.setLocation f 850 650)
+    "Make an editor window."
+    [params]
+    (let [;f (frame :title "Brevis - REPL Output" :width 800 :height 200 :minimum-size [800 :by 360])
+          text-area (text :multi-line? true :font "MONOSPACED-PLAIN-14"
+                                           :text "> ")
+          area (scrollable text-area)
+          listener-thread (Thread. (fn []
+                                     (loop []
+                                       (let [resp (nrepl.transport/recv (:client @repl) 20)]
+                                         (when resp
+                                           (when (:out resp) (write-stdout-repl (:out resp)))
+                                           (when (:value resp) (write-value-repl (:value resp)))))
+                                       (recur))))]
+     #_(display f area)
+     #_(-> f pack! show!)
+     #_(.setLocation f 850 650)
+     {;:frame f
+      :scrollable area
+      :listener-thread listener-thread
+      :text-area text-area}))
+
+(defn make-ui
+  "Make a multi-widget UI."
+  []
+  (let [a-new (action :handler a-new :name "New" :tip "Create a new file.")
+        a-open (action :handler a-open :name "Open" :tip "Open a file")
+        a-save (action :handler a-save :name "Save" :tip "Save the current file.")
+        a-exit (action :handler a-exit :name "Exit" :tip "Exit the editor.")
+        a-copy (action :handler a-copy :name "Copy" :tip "Copy selected text to the clipboard.")
+        a-paste (action :handler a-paste :name "Paste" :tip "Paste text from the clipboard.")
+        a-cut (action :handler a-cut :name "Cut" :tip "Cut text to the clipboard.")
+        a-save-as (action :handler a-save-as :name "Save As" :tip "Save the current file.")
+        a-eval-file (action :handler a-eval-file :name "Evaluate" :tip "Evaluate the current file.")
+        a-projects (map #(action :handler (make-a-active-project %)
+                                 :name (str (:group %) "/" (:name %))
+                                 :tip (str (:group %) "/" (:name %)))
+                        (:projects @current-profile))
+        menus (menubar
+                :items [(menu :text "File" :items [a-new a-open a-save a-save-as a-exit])
+                        (menu :text "Edit" :items [a-copy a-cut a-paste])
+                        (menu :text "Run" :items [a-eval-file])
+                        (menu :text "Projects" :items (into [] a-projects))
+                        (menu :text "Git" :items [])
+                        #_(menu :text "My Project" :items [(action :handler (fn [e] nil) :name "Open a project")
+                                                          (action :handler (fn [e] nil) :name "in")
+                                                          (action :handler (fn [e] nil) :name "projects menu")])])
+        panel (mig-panel :constraints [#_"wrap 2"]
+                         :items [[(:scroll-pane (get-editor)) "wrap, span 2, w 100%, h 75%"]
+                                 [(:scroll-pane @repl-input-window) "w 50%, h 25%"]
+                                 [(:scrollable @repl-output-window) "w 50%, h 25%"]])
+        f (frame :title "Brevis - UI" :width 1024 :height 768 #_:minimum-size #_[800 :by 600] :menubar menus)]
+    (display f panel)
+    (-> f #_pack! show!)
+    (.setLocation f 0 0)
     {:frame f
-     :scrollable area
-     :listener-thread listener-thread
-     :text-area text-area}))
+     :panel panel}))

 (defn -main
   "Start from command line."
@@ -376,6 +553,7 @@
     (reset! repl-input-window ri)
     (reset! repl-output-window ro)
     (reset! current-filename (:current-filename @current-profile))
+    (make-ui)
     (.setText (:text-area ew) (slurp @current-filename))))

 (when (find-ns 'ccw.complete)


Fix regex coercion in client config

Fix regex coercion in client config

--- src/refactor_nrepl/config.clj
+++ src/refactor_nrepl/config.clj
@@ -30,9 +30,11 @@
   (into {}
         (map (fn [[k v]] (cond
                            (and (string? v) (= v "true")) [k true]
-                           (string? v) [k false]
+                           (and (string? v) (= v "false")) [k false]
                            :else [k v]))
-             (select-keys msg (keys *config*)))))
+             (update (select-keys msg (keys *config*))
+                     :ignore-paths
+                     (partial map re-pattern)))))

 (defmacro with-config
   "Merge the override map with the default config and execute body."


Add a triangle symbol to the board menu to make its purpose obvious

--- src/kanban/components/boards_menu.cljs
+++ src/kanban/components/boards_menu.cljs
@@ -23,7 +23,7 @@
   Object
   (render [this]
     (dom/div #js {:className "header-menu"}
-      (dom/a nil "Boards")
+      (dom/a nil "▾ Boards")
       (dom/ul nil
         (let [{:keys [boards activate-fn]} (om/props this)]
           (for [board boards]


Set output-dir for tests in project.clj (#36)

Fixes figwheel error about unique output-dir, fixes #33

--- src/leiningen/new/re_frame/project.clj
+++ src/leiningen/new/re_frame/project.clj
@@ -74,8 +74,9 @@
     {{#test?}}
     {:id           "test"
      :source-paths ["src/cljs" "test/cljs"]
-     :compiler     {:output-to     "resources/public/js/compiled/test.js"
-                    :main          {{name}}.runner
+     :compiler     {:main          {{name}}.runner
+                    :output-to     "resources/public/js/compiled/test.js"
+                    :output-dir    "resources/public/js/compiled/test/out"
                     :optimizations :none}}{{/test?}}
     ]}
 {{#handler?}}


Test that recv ch's are closed.

Test that recv ch's are closed.

--- src/cbfg/net-test.cljs
+++ src/cbfg/net-test.cljs
@@ -113,6 +113,8 @@
                                                              (aclose tn close-client-recv-ch)
                                                              (aclose tn server-send-ch)
                                                              (aclose tn client-send-ch)
+                                                             (e n (atake tn server-recv-ch) nil nil)
+                                                             (e n (atake tn client-recv-ch) nil nil)
                                                              (aclose tn listen-ch)
                                                              (aclose tn connect-ch)
                                                              (e n (atake tn net) :done (atake tn net))))))))))))))))


fix deps graph script

fix deps graph script

--- bin/closure_deps_graph.clj
+++ bin/closure_deps_graph.clj
@@ -2,7 +2,9 @@
   (:require [clojure.java.io :as io])
   (:import [java.io File]
            [com.google.javascript.jscomp SourceFile BasicErrorManager]
-           [com.google.javascript.jscomp.deps DepsGenerator DepsGenerator$InclusionStrategy]))
+           [com.google.javascript.jscomp.deps DepsGenerator
+            DepsGenerator$InclusionStrategy ModuleLoader
+            ModuleLoader$PathResolver ModuleLoader$ResolutionMode]))

 (defn js-files-in
   "Return a sequence of all .js files in the given directory."
@@ -25,4 +27,7 @@
         (report [level error]
           (println error))
         (println [level error]
-          (println error))))))
+          (println error)))
+      (ModuleLoader. nil [] []
+        ModuleLoader$PathResolver/ABSOLUTE
+        ModuleLoader$ResolutionMode/LEGACY))))


CMR-3832: Changed test name.

CMR-3832: Changed test name.

--- umm-spec-lib/test/cmr/umm_spec/test/xml_to_umm_mappings/iso19115_2/additional_attribute.clj
+++ umm-spec-lib/test/cmr/umm_spec/test/xml_to_umm_mappings/iso19115_2/additional_attribute.clj
@@ -17,7 +17,7 @@
     :Description "The identifier of the airplane used by the FAA to uniquely identify each aircraft"
     :DataType "STRING"}])

-(deftest dif10-metadata-additional-attributes-test
+(deftest iso-metadata-additional-attributes-test
   (testing (str "Parse additional attributes from dataQualityInfo where there are multiple "
                 "eos:EOS_AdditionalAttributeDescription under eos:reference.")
     ;; Note this should be invalid according to xml schema, but xml validation is not catching


Add optional :capture boolean kwarg to event listener wrappers.

--- src/cljs/c2/event.cljs
+++ src/cljs/c2/event.cljs
@@ -11,13 +11,17 @@

 (defn on-raw
   "Attach `event-type` handler `f` to `node`, a CSS selector or live DOM node.
-   Event type is something like `:click` or `:mousemove`."
-  [node event-type f]
-  (gevents/listen (dom/->dom node) (name event-type) f))
+   Event type is something like `:click` or `:mousemove`.
+   Optional :capture boolean kwarg to fire listener in capture phase (default false)."
+  [node event-type f
+   & {:keys [capture]
+      :or {capture false}}]
+  (gevents/listen (dom/->dom node) (name event-type) f capture))

 (defn on
   "Attach delegate `event-type` event handler `f` to `node` whose children were created via `c2.core/unify!`, scoped by optional `selector`.
    Handler is called with datum, $node, and the event object.
+   Optional :capture boolean kwarg to fire listener in capture phase (default false).

    Example usage:

@@ -26,7 +30,9 @@

    This method should be preferred over attaching event handlers to individual nodes created by a `unify!` call because it creates a single event handler on the parent instead of a handler on each child."
   ([node event-type f] (on node "*" event-type f))
-  ([node selector event-type f]
+  ([node selector event-type f
+    & {:keys [capture]
+       :or {capture false}}]
      (gevents/listen (dom/->dom node)
                      (name event-type)
                      (fn [event]
@@ -39,7 +45,8 @@
                              ;;Then, call the handler on this node
                              (f d $node event)
                              (if-let [parent (dom/parent $node)]
-                               (recur parent)))))))))
+                               (recur parent))))))
+                     capture)))


added events incoming chart

added events incoming chart

--- src-cljs/photon/ui/frontend.cljs
+++ src-cljs/photon/ui/frontend.cljs
@@ -158,24 +158,29 @@
         (do
           (>! ws-channel {:ok true})
           (loop [elem (<! ws-channel)
-                 last-25 []
+                 last-25-processed []
+                 last-25-incoming []
                  timestamps []
-                 previous 0
+                 previous-processed 0
+                 previous-incoming 0
                  is-first? true]
             (when-not (nil? elem)
               (if (contains? elem :error)
                 (do
                   #_(.log js/console (pr-str elem)))
                 (let [stats-from-msg (:stats (:message elem))
-                      difference (if is-first? 0 (- (:processed stats-from-msg) previous))
-                      new-last-25 (into [] (take-last 25 (conj last-25 difference)))
+                      difference-processed (if is-first? 0 (- (:processed stats-from-msg) previous-processed))
+                      difference-incoming (if is-first? 0 (- (:incoming stats-from-msg) previous-incoming))
+                      new-last-25-processed (into [] (take-last 25 (conj last-25-processed difference-processed)))
+                      new-last-25-incoming (into [] (take-last 25 (conj last-25-incoming difference-incoming)))
                       new-timestamps (into [] (take-last 25 (conj timestamps (.getTime (js/Date.)))))
-                      stats (assoc stats-from-msg :last-25 {:val new-last-25
+                      stats (assoc stats-from-msg :last-25 {:processed new-last-25-processed
+                                                            :incoming new-last-25-incoming
                                                             :timestamps new-timestamps})]
                   (when-not is-first?
                     (om/update-state! owner #(assoc % :stats stats)))
                   (>! ws-channel {:ok true})
-                  (recur (<! ws-channel) new-last-25 new-timestamps (:processed stats-from-msg) false))))))
+                  (recur (<! ws-channel) new-last-25-processed new-last-25-incoming new-timestamps (:processed stats-from-msg) (:incoming stats-from-msg) false))))))
         (do
           (.log js/console "Error:" (pr-str error)))))))

@@ -289,9 +294,9 @@
                   (let [block (om/build code-block (:active-projection state))]
                     block)))))))

-(defn update-chart! [chart data]
-  (let [vector-data (clj->js (concat ["Events Processed"] (:val data)))
-        x-axis (clj->js (concat ["x"] (:timestamps data)))]
+(defn update-chart! [chart data timestamps name]
+  (let [vector-data (clj->js (concat [name] data))
+        x-axis (clj->js (concat ["x"] timestamps ))]
     #_(.log js/console vector-data)
     (.load chart #js {:columns #js [x-axis vector-data]})))

@@ -299,36 +304,55 @@
   (reify
     om/IInitState
     (init-state [_]
-      {:events-processed-chart nil})
+      {:events-processed-chart nil
+       :events-incoming-chart nil})
     om/IDidMount
     (did-mount [_]
-      (let [events-processed-chart (.generate js/c3
+      (let [events-incoming-chart (.generate js/c3
+                             #js {:bindto "#events-incoming"
+                                  :data
+                                  #js {:x "x"
+                                       :columns #js []
+                                       :colors #js {"Events Incoming" "#800000"}}
+                                  :axis
+                                  #js {:y #js {:min 0
+                                               :padding #js {:bottom 10}
+                                               :label "Events"}
+                                       :x #js {:type "timeseries"
+                                              :tick #js {:format "%H:%M:%S"}}}
+                                  :transition
+                                  #js {:duration 0}})
+            events-processed-chart (.generate js/c3
                              #js {:bindto "#events-processed"
                                   :data
                                   #js {:x "x"
-                                       :columns #js []}
+                                       :columns #js []
+                                       :colors #js {"Events Processed" "#009000"}}
                                   :axis
                                   #js {:y #js {:min 0
-                                               :padding #js {:bottom 10}}
+                                               :padding #js {:bottom 10}
+                                               :label "Events"}
                                        :x #js {:type "timeseries"
                                               :tick #js {:format "%H:%M:%S"}}}
                                   :transition
                                   #js {:duration 0}})]
-        (om/update-state! owner (fn [state] (assoc state :events-processed-chart events-processed-chart)))))
+        (om/update-state! owner (fn [state] (assoc state :events-processed-chart events-processed-chart :events-incoming-chart events-incoming-chart)))))
     om/IRenderState
     (render-state [_ state]
       (.log js/console (pr-str (:stats params)))
+      (if-let [events-incoming-chart (:events-incoming-chart state)]
+        (update-chart! events-incoming-chart (:incoming (:last-25 (:stats params))) (:timestamps (:last-25 (:stats params))) "Events Incoming" ))
       (if-let [events-processed-chart (:events-processed-chart state)]
-        (update-chart! events-processed-chart (:last-25 (:stats params))))
+        (update-chart! events-processed-chart (:processed (:last-25 (:stats params))) (:timestamps (:last-25 (:stats params))) "Events Processed"))
       (dom/div #js {:className "dashboard"}
+        (dom/div
+          #js {:className "col-sm-12 col-md-6 col-lg-6"}
+          (dom/div
+            #js {:id "events-incoming"}))
         (dom/div
           #js {:className "col-sm-12 col-md-6 col-lg-6"}
           (dom/div
             #js {:id "events-processed"}))
-        (dom/div
-          #js {:className "col-sm-12 col-md-6 col-lg-6"}
-          (dom/div
-            #js {:id "chart"}))
         (dom/div
           #js {:className "col-sm-12 col-md-6 col-lg-4"}
           (dom/div


added corpus docs

added corpus docs

--- src/crawler/corpus.clj
+++ src/crawler/corpus.clj
@@ -1,10 +1,13 @@
 (ns crawler.corpus
+  "Tools for processing a downloaded corpus"
   (:require [cheshire.core :as json]
             [clojure.java.io :as io])
   (:use [clojure.pprint :only [pprint]])
   (:import [java.io PushbackReader]))

 (defn corpus->json
+  "Converts a corpus file which is essentially a pprinted map
+   to a json file that python or someone else can handle"
   [a-corpus-file]
   (let [rdr (PushbackReader.
              (io/reader a-corpus-file))


Add "sort-by: <value>" in nodes with kind: project

Allowed values are: location (position in YAML), title and name.
The default is location.

--- src/custard/parser.clj
+++ src/custard/parser.clj
@@ -71,7 +71,6 @@
   (let [markdown-data (parse-markdown-data data)]
     {:title (or (data "title") (:title markdown-data))
      :kind (or (parse-kind data) (:kind markdown-data))
-     :marker (data "marker")
      :description (if (:title markdown-data)
                     (:text markdown-data)
                     (or (data "description")
@@ -82,7 +81,10 @@
                      (mapv #(hash-map :name %) (:tags markdown-data))))}))

 (defn parse-project [data]
-  {:copyright (data "copyright")})
+  {:copyright (data "copyright")
+   :sort-by (let [possible-values ["title" "location" "name"]
+                  value (or (data "sort-by") "location")]
+              (if (some #{value} possible-values) value "location"))})

 (defn parse-requirement [data]
   {})
@@ -94,7 +96,7 @@
   {})

 (defn parse-tag [data]
-  {})
+  {:marker (data "marker")})

 (def kind-parsers
   {"project" parse-project


Provide data-element when initializing search engine

--- src/discuss/views.cljs
+++ src/discuss/views.cljs
@@ -180,7 +180,7 @@
       (= view :reference-agree-disagree) (om/build ref/agree-disagree-view {})
       (= view :reference-dialog) (om/build ref/dialog-view {})
       (= view :reference-usages) (om/build ref/usages-view {})
-      (= view :reference-create) (om/build ref/create-view {})
+      (= view :reference-create) (om/build ref/create-view data)
       :else (discussion-elements data))))

 (defn main-content-view


Rename login buttons

Rename login buttons

--- src/discuss/views.cljs
+++ src/discuss/views.cljs
@@ -20,7 +20,7 @@
                    " "
                    (dom/i #js {:className "fa fa-angle-right pointer"}))))

-(defn login-view [data _owner]
+(defn login-view-buttons [data _owner]
   (grid/grid {:class "text-muted"}
              (grid/row {}
                        (if (get-in data [:extras :logged_in])
@@ -78,7 +78,7 @@
                             (apply dom/ul #js {:id (lib/prefix-name "items-main")}
                                    (om/build-all item-view (:items data)))
                             (control-buttons)
-                            (login-view data owner))))))
+                            (login-view-buttons data owner))))))

 (defn debug-view [data _owner]
   (reify om/IRender
@@ -91,4 +91,4 @@
                ;(pprint data)
                (dom/pre nil
                         (apply dom/ul nil
-                               (map (fn [[k v]] (dom/li nil (str k ": " v))) (get-in data [:debug :response]))))))))+                               (map (fn [[k v]] (dom/li nil (str k "\t\t" v))) (get-in data [:debug :response]))))))))


:nail_care:

--- test/com/wsscode/pathom/core_test.cljc
+++ test/com/wsscode/pathom/core_test.cljc
@@ -1,11 +1,11 @@
 (ns com.wsscode.pathom.core-test
-  (:require [clojure.test :refer [is are testing]]
-            [nubank.workspaces.core :refer [deftest]]
-            [clojure.core.async :as async :refer [go]]
+  (:require [clojure.core.async :as async :refer [go]]
+            [clojure.test :refer [is are testing]]
             [com.wsscode.pathom.core :as p]
             [com.wsscode.pathom.parser :as pp]
+            [com.wsscode.pathom.test-helpers :refer [mock]]
             [fulcro.client.primitives :as fp]
-            [com.wsscode.pathom.test-helpers :refer [mock]]))
+            [nubank.workspaces.core :refer [deftest]]))

 (defn q [q] (-> (fp/query->ast q) :children first))


Spaces replacement test in uri->job-name function

--- test/emender_jenkins/rest_api_test.clj
+++ test/emender_jenkins/rest_api_test.clj
@@ -369,9 +369,15 @@
             (uri->job-name "http://jenkins.server.com:8080/test-Product_Name-Product_Version-Book_Name-en-US%20(prod)" "http://jenkins.server.com:8080/")
             )))

+(deftest test-uri->job-name-space-replacement
+    "Check the function emender-jenkins.rest-api/uri->job-name."
+    (testing "the function emender-jenkins.rest-api/uri->job-name."
+        (is (= "   " (uri->job-name "prefix%20%20%20" "prefix")))))
+
 (deftest test-uri->job-name-empty-string-checking
     "Check the function emender-jenkins.rest-api/uri->job-name."
     (testing "the function emender-jenkins.rest-api/uri->job-name."
+        (is (nil? (uri->job-name "prefix" "prefix")))
         (is (nil? (uri->job-name "" "prefix")))))

 (deftest test-uri->job-name-NPE


Test fix :wrench:

Test fix :wrench:

--- test/metabase/driver/postgres_test.clj
+++ test/metabase/driver/postgres_test.clj
@@ -231,7 +231,7 @@
         ;; sync one last time
         (sync!)
         ;; now take a look at the Tables in the database related to the view. THERE SHOULD BE ONLY ONE!
-        (db/select [Table :name :active] :db_id (u/get-id database), :name "angry_birds")))))
+        (map (partial into {}) (db/select [Table :name :active] :db_id (u/get-id database), :name "angry_birds"))))))

 ;;; timezone tests


closure for cons

closure for cons


Changed first arg of add child to node instead of parent.

--- evermind.core/src/evermind/domain/core.clj
+++ evermind.core/src/evermind/domain/core.clj
@@ -31,12 +31,12 @@

 (defn add-child
-      ([parent child]
-        (assoc parent :children
-          (cljset/union (:children parent) #{child}))))
+      ([node child]
+        (assoc node :children
+          (cljset/union (:children node) #{child}))))

 (s/fdef add-child
-        :args (s/cat :parent ::node :child ::node)
+        :args (s/cat :node ::node :child ::node)
         :ret ::node
         :fn #(contains? (-> % :ret :children) (-> % :args :child)))


remove old startup hack for queues

remove old startup hack for queues

--- src/galleon.clj
+++ src/galleon.clj
@@ -45,9 +45,6 @@
                 (load-system-config "to/some/path") ;; TODO: Make this configurable.
                  apps)]

-    #_
-    (gw-util/start-queues! gw-util/queues)
-
     ;;; Lets get some app-magic started, shall we?
     (loop [system-startup-state system
            app (first apps)


Wrap material-ui form contents in Grid items

--- examples/material-ui/src/example/core.cljs
+++ examples/material-ui/src/example/core.cljs
@@ -70,82 +70,88 @@
 (defn form [{:keys [classes] :as props}]
   [:> mui/Grid
    {:container true
-    :direction "column"}
+    :direction "column"
+    :spacing 16}

-   [:> mui/Toolbar
-    {:disable-gutters true}
-    [:> mui/Button
-     {:variant "contained"
-      :color "primary"
-      :class (.-button classes)
-      :on-click #(swap! text-state str " foo")}
-     "Update value property"
-     [:> mui-icons/AddBox]]
+   [:> mui/Grid {:item true}
+    [:> mui/Toolbar
+     {:disable-gutters true}
+     [:> mui/Button
+      {:variant "contained"
+       :color "primary"
+       :class (.-button classes)
+       :on-click #(swap! text-state str " foo")}
+      "Update value property"
+      [:> mui-icons/AddBox]]

-    [:> mui/Button
-     {:variant "outlined"
-      :color "secondary"
-      :class (.-button classes)
-      :on-click #(reset! text-state "")}
-     "Reset"
-     [:> mui-icons/Clear]]]
+     [:> mui/Button
+      {:variant "outlined"
+       :color "secondary"
+       :class (.-button classes)
+       :on-click #(reset! text-state "")}
+      "Reset"
+      [:> mui-icons/Clear]]]]

-   [text-field
-    {:value @text-state
-     :label "Text input"
-     :placeholder "Placeholder"
-     :helper-text "Helper text"
-     :class (.-textField classes)
-     :on-change (fn [e]
-                  (reset! text-state (.. e -target -value)))
-     :inputRef #(js/console.log "input-ref" %)}]
+   [:> mui/Grid {:item true}
+    [text-field
+     {:value @text-state
+      :label "Text input"
+      :placeholder "Placeholder"
+      :helper-text "Helper text"
+      :class (.-textField classes)
+      :on-change (fn [e]
+                   (reset! text-state (.. e -target -value)))
+      :inputRef #(js/console.log "input-ref" %)}]]

-   [text-field
-    {:value @text-state
-     :label "Textarea"
-     :placeholder "Placeholder"
-     :helper-text "Helper text"
-     :class (.-textField classes)
-     :on-change (fn [e]
-                  (reset! text-state (.. e -target -value)))
-     :multiline true
-     ;; TODO: Autosize textarea is broken.
-     :rows 10}]
+   [:> mui/Grid {:item true}
+    [text-field
+     {:value @text-state
+      :label "Textarea"
+      :placeholder "Placeholder"
+      :helper-text "Helper text"
+      :class (.-textField classes)
+      :on-change (fn [e]
+                   (reset! text-state (.. e -target -value)))
+      :multiline true
+      ;; TODO: Autosize textarea is broken.
+      :rows 10}]]

-   [text-field
-    {:value @text-state
-     :label "Select"
-     :placeholder "Placeholder"
-     :helper-text "Helper text"
-     :class (.-textField classes)
-     :on-change (fn [e]
-                  (reset! text-state (.. e -target -value)))
-     :select true}
-    [:> mui/MenuItem
-     {:value 1}
-     "Item 1"]
-    ;; Same as previous, alternative to adapt-react-class
-    [:> mui/MenuItem
-     {:value 2}
-     "Item 2"]]
+   [:> mui/Grid {:item true}
+    [text-field
+     {:value @text-state
+      :label "Select"
+      :placeholder "Placeholder"
+      :helper-text "Helper text"
+      :class (.-textField classes)
+      :on-change (fn [e]
+                   (reset! text-state (.. e -target -value)))
+      :select true}
+     [:> mui/MenuItem
+      {:value 1}
+      "Item 1"]
+     ;; Same as previous, alternative to adapt-react-class
+     [:> mui/MenuItem
+      {:value 2}
+      "Item 2"]]]

-   [:> mui/Grid
-    {:container true
-     :direction "row"
-     :spacing 8}
+   [:> mui/Grid {:item true}
+    [:> mui/Grid
+     {:container true
+      :direction "row"
+      :spacing 8}

-    ;; For properties that require React Node as parameter,
-    ;; either use r/as-element to convert Reagent hiccup forms into React elements,
-    ;; or use r/create-element to directly instantiate element from React class (i.e. non-adapted React component).
-    [:> mui/Grid {:item true}
-     [:> mui/Chip
-      {:icon (r/as-element [:> mui-icons/Face])
-       :label "Icon element example, r/as-element"}]]
+     ;; For properties that require React Node as parameter,
+     ;; either use r/as-element to convert Reagent hiccup forms into React elements,
+     ;; or use r/create-element to directly instantiate element from React class (i.e. non-adapted React component).
+     [:> mui/Grid {:item true}
+      [:> mui/Chip
+       {:icon (r/as-element [:> mui-icons/Face])
+        :label "Icon element example, r/as-element"}]]

-    [:> mui/Grid {:item true}
-     [:> mui/Chip
-      {:icon (r/create-element mui-icons/Face)
-       :label "Icon element example, r/create-element"}]]]])
+     [:> mui/Grid {:item true}
+      [:> mui/Chip
+       {:icon (r/create-element mui-icons/Face)
+        :label "Icon element example, r/create-element"}]]]]])

 (defn main []
   ;; fragment


page rank begin better documentation

page rank begin better documentation

--- src/v/algorithms/pagerank.clj
+++ src/v/algorithms/pagerank.clj
@@ -1,5 +1,22 @@
 (ns v.algorithms.pagerank)

+;;; Pagerank
+;; - Famous algorithm by Larry Page (Google)
+;; - Ranks nodes in a graph by how much other nodes point to it (and recursively what points to those nodes)
+;;   - ranks nodes in graph by how much the rest of the graph point to it
+;; - measure of node importance/significance
+
+;; Given damping factor d (fraction), an actor will select a random
+;; link on page A d times, and will select some other page 1-d
+;; times. The actor will then select a node with pagerank X, fraction
+;; X times.
+
+;; Aka page rank gives probability distribution a random walk through
+;; network will end up on a given node
+
+;; Iterative algorithm
+;; (Want basic algorithm description in engligh)
+;; - (maybe also include simple math description)
 (def d 0.85)

 (defn simple-score


Fix 3.0 zip filename NPE

Fix 3.0 zip filename NPE

--- src/vip/data_processor/s3.clj
+++ src/vip/data_processor/s3.clj
@@ -66,7 +66,7 @@
                    first
                    :vip_id)
           state (-> tables
-                    :state
+                    :states
                     korma/select
                     first
                     :name)


only supply Basic-Auth header if necessary (some servers don't like it).

--- src/ancient_clj/io.clj
+++ src/ancient_clj/io.clj
@@ -13,7 +13,11 @@
       (verbose msg "(with authentication)")
       (verbose msg))
     (try
-      (when-let [response (client/get url {:basic-auth [username password] :as :stream})]
+      (when-let [response (->> {:as :stream}
+                               (merge
+                                 (when username
+                                   {:basic-auth [username password]}))
+                               (client/get url))]
         (with-open [data-stream (:body response)]
           (slurp data-stream)))
       (catch Exception ex


Extracts more functions

Extracts more functions

--- src/expound/alpha.cljc
+++ src/expound/alpha.cljc
@@ -403,6 +403,15 @@
    (expected-str _type spec-name val path problems opts)
    ))

+(defmethod expected-str :problem/unknown [_type spec-name val path problems opts]
+  (printer/format
+   "should satisfy
+
+%s"
+   (preds problems)
+   )
+  )
+
 (defmethod problem-group-str :problem/unknown [_type spec-name val path problems opts]
   (assert (apply = (map :val problems)) (str "All values should be the same, but they are " problems))
   (printer/format
@@ -410,12 +419,11 @@

 %s

-should satisfy
-
 %s"
    (header-label "Spec failed")
    (show-spec-name spec-name (printer/indent (*value-str-fn* spec-name val path (problems/value-in val path))))
-   (preds problems)))
+   (expected-str _type spec-name val path problems opts)
+   ))

 (defn problem-group-str1 [type spec-name val path problems opts]
   (str


added a test for delete flow

added a test for delete flow

--- test/ctia/flows/crud_test.clj
+++ test/ctia/flows/crud_test.clj
@@ -67,3 +67,18 @@
                                   :id "model-id"
                                   :owner "login"
                                   :old {:old "object"}}}))))))
+
+
+(t/deftest test-delete-flow-without-hook
+  (do
+    (h/reset-hooks!)
+    (let [stored-object (into object {:id "model-id"
+                                      :owner "nobody"})
+          _ (reset! store stored-object)
+          resp (crud/delete-flow :model Model
+                                 :get-fn (fn [_] @store)
+                                 :delete-fn (fn [_] (reset! store {}) true)
+                                 :object-type :model
+                                 :id (:id stored-object))]
+      (t/is (= {} @store))
+      (t/is (= true resp)))))


Remove debugging println

Remove debugging println

--- src/get_here/ferry.clj
+++ src/get_here/ferry.clj
@@ -124,7 +124,6 @@
   ([d]
      (times-for d times))
   ([d x]
-   (println "Type: " (type d))
    (cond (string? x)
          [(c/to-date (.toDateTime d (parse-ferry-time x) eastern))]


Have explicit prog-curr ts (timestamp).

Have explicit prog-curr ts (timestamp).

--- src/cbfg/world/t1.cljs
+++ src/cbfg/world/t1.cljs
@@ -29,19 +29,19 @@
                      :net-listen-ch (achan-buf world 10)
                      :net-connect-ch (achan-buf world 10)
                      :res-ch (achan-buf world 10)})
-  (reset! prog-curr {:servers {}   ; { server-addr => ports }.
+  (reset! prog-curr {:ts 0
+                     :servers {}   ; { server-addr => ports }.
                      :clients {}   ; { client-addr => client-info }.
                      :reqs    {}}) ; { opaque-ts => [req, [[reply-ts reply] ...] }.
   (reset! prog-hover nil)
   (reset! prog-history []))

 (defn prog-event [world label prog-frame-fn]
-  (let [prog-next (swap! prog-curr prog-frame-fn)]
+  (let [prog-next (swap! prog-curr #(prog-frame-fn (update-in % [:ts] inc)))]
     ; Only snapshot when we're quiescent.
     (when (<= (.-length cljs.core.async.impl.dispatch/tasks) 0)
-      (let [ss-ts (count @prog-history)]
-        (swap! prog-history #(conj % [ss-ts label prog-next]))
-        (swap! prog-ss #(assoc % ss-ts (ago-snapshot (actx-agw world))))))))
+      (swap! prog-history #(conj % [(:ts prog-next) label prog-next]))
+      (swap! prog-ss #(assoc % (:ts prog-next) (ago-snapshot (actx-agw world)))))))

 ; -------------------------------------------------------------------

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

 (defn render-prog-frame [prog-frame owner]
   (apply dom/ul nil
-         (map (fn [[k v]] (dom/li nil (str k ":" (count v))))
+         (map (fn [[k v]] (dom/li nil (str k ":" (if (number? v) v (count v)))))
               prog-frame)))

 (defn render-events [app owner]


Populating clients dropdown from prog-world.

--- src/cbfg/world/t1.cljs
+++ src/cbfg/world/t1.cljs
@@ -96,6 +96,12 @@
            [nil []]
            (:events app)))))

+(defn render-clients [app owner]
+  (apply dom/select #js {:id "client"}
+         (map (fn [client-addr]
+                (dom/option #js {:value client-addr} (str client-addr)))
+              (keys (:clients app)))))
+
 (defn init-roots []
   (om/root render-world run-world
            {:target (. js/document (getElementById "world"))})
@@ -106,7 +112,9 @@
   (om/root render-world run-world-hover
            {:target (. js/document (getElementById "world-map-hover"))})
   (om/root render-events run-history
-           {:target (. js/document (getElementById "events"))}))
+           {:target (. js/document (getElementById "events"))})
+  (om/root render-clients prog-world
+           {:target (. js/document (getElementById "controls-clients"))}))

 ; ------------------------------------------------


Fix for Curtain Wall and Wraparound infinite recursion on Parasite trash.

--- src/clj/game/cards.clj
+++ src/clj/game/cards.clj
@@ -2829,7 +2829,8 @@
    {:abilities [{:msg "end the run" :effect (effect (end-run))}]
     :strength-bonus (req (let [ices (:ices (card->server state card))]
                               (if (= (:cid card) (:cid (last ices))) 4 0)))
-    :events (let [cw {:req (req (= (card->server state card) (card->server state target)))
+    :events (let [cw {:req (req (and (not= (:cid card) (:cid target))
+                                     (= (card->server state card) (card->server state target))))
                       :effect (effect (update-ice-strength card))}]
                  {:corp-install cw :trash cw :card-moved cw})}

@@ -3327,7 +3328,7 @@
    {:abilities [{:msg "end the run" :effect (effect (end-run))}]
     :strength-bonus (req (if (some #(has? % :subtype "Fracter") (get-in runner [:rig :program]))
                            0 7))
-    :events (let [wr {:req (req (has? target :subtype "Fracter"))
+    :events (let [wr {:req (req (and (not= (:cid target) (:cid card)) (has? target :subtype "Fracter")))
                       :effect (effect (update-ice-strength card))}]
                  {:runner-install wr :trash wr :card-moved wr})}


Cleanup scale docs.

Cleanup scale docs.

--- src/cljx/c2/scale.cljx
+++ src/cljx/c2/scale.cljx
@@ -5,6 +5,12 @@
          (:use-macros [c2.util :only [c2-obj]])
          (:use [c2.maths :only [log10]]))

+;;Linear scale
+;;
+;;Kwargs:
+;;> *:domain* domain of scale, default [0 1]
+;;
+;;> *:range* range of scale, default [0 1]
 (c2-obj linear {:domain [0 1]
                 :range  [0 1]}

@@ -16,6 +22,12 @@
                               (/ (- x (first domain))
                                  domain-length))))))

+;;Logarithmic scale
+;;
+;;Kwargs:
+;;> *:domain* domain of scale, default [1 10]
+;;
+;;> *:range* range of scale, default [0 1]
 (c2-obj log {:domain [1 10]
              :range  [0 1]}
         clojure.lang.IFn
@@ -23,8 +35,3 @@
                 ((comp (linear :domain (map log10 domain)
                                :range range)
                        log10) x)))
-
-
-
-
-


introduced alias for core-test

introduced alias for core-test

--- src/notepad.clj
+++ src/notepad.clj
@@ -5,24 +5,24 @@
   ;(:require [mastersign.wordcloud-test])
   ;(:require [distillery.data :refer :all])
   ;(:require [distillery.tasks :refer :all])
-  (:require [distillery.core-test])
+  (:require [distillery.core-test :as ct])
   )

 ;(run-tests 'mastersign.wordcloud-test)

-;(distillery.core-test/test-playground)
+;(ct/test-playground)

-;(distillery.core-test/test-resources)
+;(ct/test-resources)

-;(distillery.core-test/test-analyze)
+;(ct/test-analyze)

-;(distillery.core-test/test-categories)
+;(ct/test-categories)

-;(distillery.core-test/test-index)
+;(ct/test-index)

-;(distillery.core-test/test-complete)
+;(ct/test-complete)

-;(distillery.core-test/test-show-main-page)
+;(ct/test-show-main-page)

 ; -----------------

@@ -34,7 +34,7 @@
   [dldir]
   (let [ress (mapcat (fn [c] (map #(vector (:type %) (:url %))
                                   (:resources c)))
-                     (:categories distillery.core-test/job-descr))]
+                     (:categories ct/job-descr))]
     (doseq [[typ url] ress]
       (let [url* (java.net.URL. url)
             p (.getPath url*)]
@@ -49,7 +49,7 @@
   [dldir]
   (intern 'distillery.core-test 'job-descr
     (update-in
-     distillery.core-test/job-descr [:categories]
+     ct/job-descr [:categories]
      (fn [cats]
        (vec (map
              (fn [cat]


improved notepad

improved notepad

--- src/notepad.clj
+++ src/notepad.clj
@@ -1,8 +1,7 @@
-(require 'distillery.data)
-(refer 'distillery.data)
-(require 'distillery.tasks)
-(refer 'distillery.tasks)
+(ns notepad
+  (:require [clojure.pprint :refer [pprint]])
+  ;(:require [distillery.data :refer :all])
+  ;(:require [distillery.tasts :refer :all])
+  ;(:require [mastersign.wordcloud :refer :all])
+  )

-(require 'mastersign.wordcloud)
-(refer 'mastersign.wordcloud)
-


Fixed DB and Datom pprinting (closes #287)

--- src/datascript/db.cljc
+++ src/datascript/db.cljc
@@ -4,6 +4,7 @@
      clojure.walk
      clojure.data
      clojure.set
+    #?(:clj [clojure.pprint :as pp])
     [datascript.arrays :as da]
     [datascript.btset :as btset])
   #?(:cljs (:require-macros [datascript.db :refer [case-tree combine-cmp raise defrecord-updatable cond-let]]))
@@ -702,11 +703,49 @@
          (apply pr (map (fn [^Datom d] [(.-e d) (.-a d) (.-v d) (.-tx d)]) (-datoms db :eavt []))))
        (.write w "]}"))

-     (defmethod print-method DB [db, ^java.io.Writer w]
-       (pr-db db w))
-
-     (defmethod print-method FilteredDB [db, ^java.io.Writer w]
-       (pr-db db w))))
+     (defmethod print-method DB [db w] (pr-db db w))
+     (defmethod print-method FilteredDB [db w] (pr-db db w))
+
+     (defmethod pp/simple-dispatch Datom [^Datom d]
+       (pp/pprint-logical-block :prefix "#datascript/Datom [" :suffix "]"
+         (pp/write-out (.-e d))
+         (.write ^java.io.Writer *out* " ")
+         (pp/pprint-newline :linear)
+         (pp/write-out (.-a d))
+         (.write ^java.io.Writer *out* " ")
+         (pp/pprint-newline :linear)
+         (pp/write-out (.-v d))
+         (.write ^java.io.Writer *out* " ")
+         (pp/pprint-newline :linear)
+         (pp/write-out (.-tx d))))
+
+     (defn- pp-db [db ^java.io.Writer w]
+       (pp/pprint-logical-block :prefix "#datascript/DB {" :suffix "}"
+         (pp/pprint-logical-block
+           (pp/write-out :schema)
+           (.write w " ")
+           (pp/pprint-newline :linear)
+           (pp/write-out (:schema db)))
+         (.write w ", ")
+         (pp/pprint-newline :linear)
+
+         (pp/pprint-logical-block
+           (pp/write-out :datoms)
+           (.write w " ")
+           (pp/pprint-newline :linear)
+           (pp/pprint-logical-block :prefix "[" :suffix "]"
+             (pp/print-length-loop [aseq (seq db)]
+               (when aseq
+                 (let [^Datom d (first aseq)]
+                   (pp/write-out [(.-e d) (.-a d) (.-v d) (.-tx d)])
+                   (when (next aseq)
+                     (.write w " ")
+                     (pp/pprint-newline :linear)
+                     (recur (next aseq))))))))))
+
+     (defmethod pp/simple-dispatch DB [db] (pp-db db *out*))
+     (defmethod pp/simple-dispatch FilteredDB [db] (pp-db db *out*))
+))

 (defn db-from-reader [{:keys [schema datoms]}]
   (init-db (map (fn [[e a v tx]] (Datom. e a v tx true)) datoms) schema))


Trigger quests-handler before other handlers

--- src/braid/client/dispatcher.cljs
+++ src/braid/client/dispatcher.cljs
@@ -7,7 +7,7 @@
   ([event args]
    (println event)
    (store/transact! (-> @store/app-state
-                        (handler [event args])
-                        (quests-handler [event args]))))
+                        (quests-handler [event args])
+                        (handler [event args]))))
   ([event]
    (dispatch! event nil)))


[uploads] another instance where spec has gotten pickier

Previously a data-spec of `[foo?]` would be a sequence of `foo?`; now
it seems to specifically mean a vector of `foo?`

--- src/braid/page_uploads/core.cljc
+++ src/braid/page_uploads/core.cljc
@@ -43,7 +43,7 @@
        (base/register-events!
          {::store-group-uploads!
           (fn [{db :db} [_ group-id uploads]]
-            {:db (assoc-in db [::uploads group-id] uploads)})
+            {:db (assoc-in db [::uploads group-id] (vec uploads))})

           :braid.uploads-page/get-group-uploads!
           (fn [{state :db} _]


Better hooks loading warning message.

Better hooks loading warning message.

--- src/leiningen/core.clj
+++ src/leiningen/core.clj
@@ -82,7 +82,8 @@
     (try (require n)
          (catch Exception e
            (when-not (empty? (.list (File. "lib")))
-             (println "Problem loading hooks:" n (.getMessage e)))))))
+             (println "Warning: problem requiring hooks:" n (.getMessage e))
+             (println "...continuing without hooks completely loaded."))))))

 (defn ns->path [n]
   (str (.. (str n)


Suppress extra "lein deps" output.

Suppress extra "lein deps" output.

--- src/leiningen/deps.clj
+++ src/leiningen/deps.clj
@@ -61,7 +61,6 @@
                           (:library-path project) true
                           (.getReference lancet/ant-project
                                          (.getFilesetId deps-task)))
-       (println (format "Copied %s into %s." set (:library-path project)))
        (when (and (not skip-dev) (seq (:dev-dependencies project)))
          (deps (assoc project :library-path (str (:root project) "/lib/dev"))
                true :dev-dependencies))))


Second attempt at the maven reporting bug, Resolves #112

--- src/leiningen/deps.clj
+++ src/leiningen/deps.clj
@@ -45,9 +45,20 @@

 (defn make-deps-task [project deps-set]
   (let [deps-task (DependenciesTask.)]
+    (.setProject deps-task lancet/ant-project)
+    ;; in maven-ant-tasks (at least 2.0.10 and 2.1.1) if there's an
+    ;; exception thrown, there must be a call to
+    ;; AbstractArtifactTask.getContainer() made to set some local
+    ;; state on the task, before the exception happens, or else you
+    ;; don't see stack traces. getContainer is a protected
+    ;; method. Since we don't have contrib, we can't use
+    ;; wall-hack-method, and clojure.lang.Reflector doesn't call
+    ;; private methods, we'll call a public method that we know calls
+    ;; getContainer, getSupportedProtocols.
+    ;;
+    (.getSupportedProtocols deps-task)
     (.setBasedir lancet/ant-project (:root project))
     (.setFilesetId deps-task "dependency.fileset")
-    (.setProject deps-task lancet/ant-project)
     (.setPathId deps-task (:name project))
     (doseq [r (map make-repository (repositories-for project))]
       (.addConfiguredRemoteRepository deps-task r))


build-shabam: Eliminate superfluous frame recursion.

We can pop the current frame when we've added all of the work to
handle both itself and its parents.

--- src/leiningen/voom.clj
+++ src/leiningen/voom.clj
@@ -992,7 +992,7 @@
                          (q pldb [par]
                             (r-commit-parent frame par)))]
             (recur shabam
-                   (-> stack
+                   (-> (pop stack)
                        (conj (into [frame] parents)) ;; to add myself later
                        (into parents)))))) ;; have parents check themselves
       {:shabam shabam :pldb pldb})))


1.3-ifying examples.dsoar

1.3-ifying examples.dsoar

--- src/examples/dsoar.clj
+++ src/examples/dsoar.clj
@@ -9,10 +9,8 @@
 ;; This version was written by Brian Martin in 2010-2011.

 (ns examples.dsoar
-  (:require [clojush]
-	    [clojure.contrib.math])
   (:use [clojush]
-    [clojure.contrib.math]))
+	[clojure.math.numeric-tower]))

 (in-ns 'clojush)


Adds colors for footer

Adds colors for footer

--- src/expound/alpha.cljc
+++ src/expound/alpha.cljc
@@ -538,12 +538,13 @@
              "%s

 %s
-Detected %s %s\n"
+%s %s %s\n"
              (string/join "\n\n" (for [[[in type] probs] problems]
                                    (problem-group-str1 type (spec-name explain-data) form in probs opts')))
-             (section-label)
-             (count problems)
-             (if (= 1 (count problems)) "error" "errors")))))))))
+             (ansi/color (section-label) :footer)
+             (ansi/color "Detected" :footer)
+             (ansi/color (count problems) :footer)
+             (ansi/color (if (= 1 (count problems)) "error" "errors") :footer)))))))))

 (s/def ::foo string?)


Removes unused function

Removes unused function

--- src/expound/paths.cljc
+++ src/expound/paths.cljc
@@ -240,7 +240,3 @@
   (->> (map compare-path-segment path1 path2)
        (remove #{0})
        first))
-
-;; TODO - remove
-(defn kps [k]
-  (->KeyPathSegment k))


Add links, but performance is horrible

Add links, but performance is horrible

Will optimize repeated computations next.

--- src/graphito/core.cljs
+++ src/graphito/core.cljs
@@ -130,8 +130,8 @@
         displacement (subtract-vec pos camera-pos)
         r (scaled-distance-from-camera state pos)
         projected-r (project-displacement r)]
-      (add-vec view-center
-            (vec-clamp-to-bounds (scalar-multiply displacement (/ projected-r r)) view-center))))
+    (add-vec view-center
+             (vec-clamp-to-bounds (scalar-multiply displacement (/ projected-r r)) view-center))))

 (defn project-radius [t]
   (+ min-radius (* (- max-radius min-radius)
@@ -142,13 +142,27 @@
     (project-radius r)))

 (defn sync-graph! [state]
-  (let [{:keys [svg nodes]} state
+  (let [{:keys [svg nodes links]} state
         _view-position (fn [d] (view-position state (:pos d)))
         view-x (comp :x _view-position)
         view-y (comp :y _view-position)
         _view-radius (fn [d] (view-radius state (:pos d)))]
-    (-> svg
-        (.selectAll ".node")
+    (-> svg (.selectAll ".link")
+        (.data (apply array links))
+        (.attr "x1" (fn [link] (view-x (nodes (:source link)))))
+        (.attr "y1" (fn [link] (view-y (nodes (:source link)))))
+        (.attr "x2" (fn [link] (view-x (nodes (:target link)))))
+        (.attr "y2" (fn [link] (view-y (nodes (:target link)))))
+        .enter
+        (.append "line")
+        (.attr "class" "link")
+        (.attr "x1" (fn [link] (view-x (nodes (:source link)))))
+        (.attr "y1" (fn [link] (view-y (nodes (:source link)))))
+        (.attr "x2" (fn [link] (view-x (nodes (:target link)))))
+        (.attr "y2" (fn [link] (view-y (nodes (:target link)))))
+        (.style "stroke" "black")
+        (.style "stroke-width" 3))
+    (-> svg (.selectAll ".node")
         (.data (apply array nodes))
         (.attr "cx" view-x)
         (.attr "cy" view-y)
@@ -166,7 +180,8 @@
   {:svg svg
    :view-size (math-vec width height)
    :camera-pos (math-vec 0 0)
-   :nodes []})
+   :nodes []
+   :edges []})

 (defn swap-state! [current-state f & args]
   (apply swap! current-state f args)
@@ -223,16 +238,27 @@
   {:title title
    :pos (math-vec x y)})

-(defn load-nodes [json-file callback]
+(defn link
+  "Source and target are indexes into the list of nodes."
+  [source target]
+  {:source source :target target})
+
+(defn load-graph [json-file callback]
   (.json d3 json-file
-         (fn [data]
-           (do-layout! data)
-           (let [raw-nodes (js->clj (.-nodes data) :keywordize-keys true)
-                 nodes (map (fn [raw-node]
-                              (node (:name raw-node)
-                                    (:x raw-node)
-                                    (:y raw-node))) raw-nodes)]
-             (callback nodes)))))
+         (fn [raw-data]
+           ;; Running do-layout! modifies the link data to contain full nodes
+           ;;  rather than indices. Hence this ugly ordering.
+           (let [data-links (js->clj (aget raw-data "links"))
+                 links (mapv (fn [data-link]
+                               (link (data-link "source") (data-link "target")))
+                             data-links)]
+             (do-layout! raw-data)
+             (let [data-nodes (js->clj (aget raw-data "nodes"))
+                   nodes (mapv (fn [data-node]
+                                 (node (data-node "name")
+                                       (data-node "x")
+                                       (data-node "y"))) data-nodes)]
+               (callback {:nodes nodes :links links}))))))

 ;; Reactive

@@ -369,9 +395,11 @@
         current-state (atom (initial-state svg width height))
         gesture-manager (hammer-manager svg)]
     (sync-graph! @current-state)
-    (load-nodes "miserables.json" (fn [nodes]
-                                    (swap-state! current-state assoc :nodes nodes)))
-    (move-camera-on-arrow-keys! current-state)
-    (move-camera-on-pan! gesture-manager current-state)
-    (move-camera-on-swipe! gesture-manager current-state)
-    (zoom-out-on-pinch! gesture-manager current-state)))
+    (load-graph "miserables.json"
+                (fn [graph]
+                  (let [{:keys [nodes links]} graph]
+                    (swap-state! current-state assoc :nodes nodes :links links))))
+                (move-camera-on-arrow-keys! current-state)
+                (move-camera-on-pan! gesture-manager current-state)
+                (move-camera-on-swipe! gesture-manager current-state)
+                (zoom-out-on-pinch! gesture-manager current-state)))


Fix handling of non-recursive build wrap cases.

--- src/leiningen/voom.clj
+++ src/leiningen/voom.clj
@@ -785,13 +785,13 @@
 ;; === lein entrypoint ===

 (defn wrap-expected-version-helper [kargset]
-  (->
-   (->>
-    (map name kargset)
-    (filter #(.startsWith ^String % "expected-version--")))
-   first
-   (s/replace-first #"expected-version--" "")
-   (ver-parse)))
+  (when-let [res (->>
+                  (map name kargset)
+                  (filter #(.startsWith ^String % "expected-version--"))
+                  first)]
+    (-> res
+        (s/replace-first #"expected-version--" "")
+        (ver-parse))))

 (defn- wrap-version-correction-helper
   "Unfortunately, we need this fix forever...
@@ -802,7 +802,7 @@
   still ensures that the sha is identical and will only adjust the
   time when the old version of voom would have truncated the hours."
   [expected-version found-version]
-  (if (= found-version expected-version)
+  (if (or (not expected-version) (= found-version expected-version))
     found-version
     (do
       (assert (= (:sha expected-version) (:sha found-version)))


Create local 'sh fn which acts like c.j.shell/sh but turns Files into strings.

--- src/leiningen/voom.clj
+++ src/leiningen/voom.clj
@@ -1,5 +1,5 @@
 (ns leiningen.voom
-  (:require [clojure.java.shell :refer [sh]]
+  (:require [clojure.java.shell :as shell]
             [clojure.string :as s]
             [clojure.pprint :refer [pprint]]
             [clojure.java.io :as io]
@@ -13,6 +13,13 @@
            [org.sonatype.aether.transfer ArtifactNotFoundException]))

 (set! *warn-on-reflection* true)
+
+(defn sh
+  [& cmdline]
+  (apply shell/sh (map #(if (= File (class %))
+                          (.getPath ^File %)
+                          %)
+                       cmdline)))

 (defn git
   [{:keys [^File gitdir ok-statuses]


Accessors for various board square sets.

--- src/clojure/clj_chess/board.cljc
+++ src/clojure/clj_chess/board.cljc
@@ -531,6 +531,44 @@
      (.see board move)))

 #?(:clj
+
+   (defn occupied-squares
+     "The set of occupied squares on the board, including blockers. Supplying
+     the optional 'color' parameter will result in only squares occupied by
+     pieces of that color (and no blockers) to be returned."
+     ([board] (.occupiedSquares board))
+     ([board color] (.piecesOfColor board color)))
+
+   (defn pawn-squares
+     "The set of squares containing pawns of the given color."
+     [board color]
+     (.pawnsOfColor board color))
+
+   (defn knight-squares
+     "The set of squares containing knights of the given color."
+     [board color]
+     (.knightsOfColor board color))
+
+   (defn bishop-squares
+     "The set of squares containing bishops of the given color."
+     [board color]
+     (.bishopsOfColor board color))
+
+   (defn rook-squares
+     "The set of squares containing rooks of the given color."
+     [board color]
+     (.rooksOfColor board color))
+
+   (defn queen-squares
+     "The set of squares containing queens of the given color."
+     [board color]
+     (.queensOfColor board color))
+
+   (defn king-squares
+     "The set of squares containing kings of the given color."
+     [board color]
+     (.kingsOfColor board color))
+
    (defn attacks-from
      "The set of squares attacked by the piece on the given square."
      [board square]


Org picker on a workflows route goes to workflows

--- src-cljs/frontend/routes.cljs
+++ src-cljs/frontend/routes.cljs
@@ -429,4 +429,13 @@
       :route/account (v1-account)
       :route/projects (v1-organization-projects-path org)
       :team (v1-team-path org)
+
+      (:route/workflows
+       :route/org-workflows
+       :route/project-workflows
+       :route/project-branch-workflows
+       :route/run)
+      (v1-org-workflows-path (:vcs_type org)
+                             (:org org))
+
       (v1-organization-dashboard-path org))))


new cues with hue set up

new cues with hue set up

--- src/lights/my_show.clj
+++ src/lights/my_show.clj
@@ -27,10 +27,6 @@
   my-show
   (atom nil))

-(defonce ^{:doc "Allows effects to set variables in the running show."}
-  var-binder
-  (atom nil))
-
 (defn rgbd-cheap
   "A simple RGB with dimmer and strobe on 1 channel"
   []
@@ -323,7 +319,7 @@
   )

 (defn shutter-open
-  "Open shutters"
+  "Open shutters on heads in London show"
   []
   (show/add-effect! :shutter
     (afterglow.effects.channel/channel-effect "Shutter" 255
@@ -367,38 +363,70 @@
     (move/aim-effect "Center" (params/build-aim-param :x 0 :y 0 :z 5) (show/fixtures-named "head")))
 )

+; Magic from Afterglow examples
+(defonce ^{:doc "Allows effects to set variables in the running show."}
+  var-binder
+  (atom nil))
+(reset! var-binder (var-fx/create-for-show *show*))
+
 (defn new-cues
   "Create cues."
   []

-  (ct/set-cue! (:cue-grid *show*) 0 16
+  (ct/set-cue! (:cue-grid *show*) 0 7
+      (cues/cue :sparkle (fn [var-map] (fun/sparkle (show/all-fixtures)
+        :chance (:chance var-map 0.05)
+        :fade-time (:fade-time var-map 50)))
+          :held true
+          :priority 100
+          :variables [{:key "chance" :min 0.0 :max 0.4 :start 0.05 :velocity true}
+            {:key "fade-time" :name "Fade" :min 1 :max 2000 :start 50 :type :integer}]))
+
+  (ct/set-cue! (:cue-grid *show*) 0 1
     (cues/cue :color  (fn [_] (afterglow.effects/scene
-      "Blue Sparks"
-      (global-color-effect :blue)
-      (fun/sparkle (show/all-fixtures)
-                   :chance 0.07 :fade-time 500)))))
-
-
-  (ct/set-cue! (:cue-grid *show*) 0 17
-    (cues/cue :color  (fn [_] (afterglow.effects/scene
-      "Blue and red 2"
+      "Blue and red"
         (afterglow.effects.color/color-effect
           "Plain red" (create-color "red") (show/fixtures-named "back-odd"))
         (afterglow.effects.color/color-effect
           "Plain Blue" (create-color "blue") (show/fixtures-named "back-even"))
     ))))

-  (ct/set-cue! (:cue-grid *show*) 0 18
-    (cues/cue :color (fn [_](afterglow.effects/scene
-      "Hue 0"
+  (ct/set-cue! (:cue-grid *show*) 0 0
+    (cues/cue :color (fn [_](afterglow.effects/scene
+      "Hue Red"
         (fn [_] (var-fx/variable-effect @var-binder :main-hue 0))
       )
     )))
-  (ct/set-cue! (:cue-grid *show*) 1 18
-    (cues/cue :color (fn [_](afterglow.effects/scene
-      "Hue 120"
-        (set-hue 120)
+  (ct/set-cue! (:cue-grid *show*) 1 0
+    (cues/cue :color (fn [_](afterglow.effects/scene
+      "Hue Yellow"
+        (fn [_] (var-fx/variable-effect @var-binder :main-hue 60))
+      )
+    )))
+  (ct/set-cue! (:cue-grid *show*) 2 0
+    (cues/cue :color (fn [_](afterglow.effects/scene
+      "Hue Green"
         (fn [_] (var-fx/variable-effect @var-binder :main-hue 120))
       )
     )))
-)+  (ct/set-cue! (:cue-grid *show*) 3 0
+    (cues/cue :color (fn [_](afterglow.effects/scene
+      "Hue Blue"
+        (fn [_] (var-fx/variable-effect @var-binder :main-hue 180))
+      )
+    )))
+  (ct/set-cue! (:cue-grid *show*) 4 0
+    (cues/cue :color (fn [_](afterglow.effects/scene
+      "Hue Violet"
+        (fn [_] (var-fx/variable-effect @var-binder :main-hue 240))
+      )
+    )))
+  (ct/set-cue! (:cue-grid *show*) 5 0
+    (cues/cue :color (fn [_](afterglow.effects/scene
+      "Hue Purple"
+        (fn [_] (var-fx/variable-effect @var-binder :main-hue 300))
+      )
+    )))
+)
+
+(new-cues)


(maint) Don't import jdbc ns twice in middleware

--- src/puppetlabs/puppetdb/middleware.clj
+++ src/puppetlabs/puppetdb/middleware.clj
@@ -2,7 +2,7 @@
   "Ring middleware"
   (:require [puppetlabs.i18n.core :as i18n]
             [puppetlabs.kitchensink.core :as kitchensink]
-            [puppetlabs.puppetdb.jdbc :as jdbc]
+            [puppetlabs.puppetdb.jdbc :as jdbc :refer [with-transacted-connection]]
             [puppetlabs.puppetdb.query-eng :as qe]
             [puppetlabs.puppetdb.utils.metrics :refer [multitime!]]
             [puppetlabs.puppetdb.http :as http]
@@ -14,7 +14,6 @@
             [clojure.set :as set]
             [pantomime.media :as media]
             [puppetlabs.puppetdb.metrics.core :as metrics]
-            [puppetlabs.puppetdb.jdbc :refer [with-transacted-connection]]
             [metrics.timers :refer [timer time!]]
             [metrics.meters :refer [meter mark!]]
             [clojure.walk :refer [keywordize-keys]]


Added system.

Added system.

--- ingestion-api/src/ingestion_api/system.clj
+++ ingestion-api/src/ingestion_api/system.clj
@@ -25,11 +25,10 @@
    :tracking {:enabled false :type :console}
    })

-(reloaded.repl/set-init! #(ingestion-api-system DEFAULT-CONFIG))
-
-(go)
-
-(stop)
+;(reloaded.repl/set-init! #(ingestion-api-system DEFAULT-CONFIG))
+;(go)
+;(stop)

+


Force clean module Agent thread-locals on stop.

--- src/containium/modules/boxes.clj
+++ src/containium/modules/boxes.clj
@@ -90,5 +90,6 @@
         (ex/exit-when-fatal ex)
         (.printStackTrace ex))
       (finally
+        (boxure.BoxureClassLoader/cleanThreadLocals)
         (boxure/clean-and-stop box)
         (log-fn "Module" name "stopped.")))))


added click-anchor

added click-anchor

--- src/hypertext_ray/navigation.clj
+++ src/hypertext_ray/navigation.clj
@@ -27,6 +27,21 @@
   (let [found (first (filter-class :match (classify-elements {:tag :a} {:match [re]})))]
     (when found (-> found :xpath to-element click))))

+(defn click-anchor [re]
+  (println "clicking anchor matching" re)
+  (let [elements (find-elements {:tag :a})
+        match (first (remove #(nil? (second %))
+                             (for [e elements]
+                               [e (or
+                                    (re-matches re (or (attribute e :href) ""))
+                                    (re-matches re (or (attribute e :class) ""))
+                                    )])))
+        ]
+  (when match (click (first match)))
+
+    )
+  )
+
 (defn search [text]
   (let [form (->> (classify-forms) (filter-class :search) first)]
     (when (not (nil? form))
@@ -38,7 +53,13 @@

 (defn element-match? [e re-list]
-  (some true?  (for [re re-list] ((complement nil?) (re-matches re (text e))))) )
+  (some true?  (for [re re-list
+                     at (map second (get-attributes-plus e))
+                     ]
+                 (do
+                   ((complement nil?) (re-matches re at)))))
+
+  )

 (defn str-match? [s re-list]
   (some true? (for [re re-list] ((complement nil?) (re-matches re s)))))
@@ -46,7 +67,7 @@
 (defn match-elements [[q re-list]]
   (case q
     :title (str-match? (title) re-list)
-    (some true? (pmap #(element-match? % re-list) (find-elements q)))
+    (some true? (map #(element-match? % re-list) (filter visible? (find-elements q))))
     )
   )


Improved index generation marginally

Improved index generation marginally

- now generating a per-post entry but not resolved lazy fn properly

--- src/omhome/indices.clj
+++ src/omhome/indices.clj
@@ -1,6 +1,6 @@
 (ns omhome.indices
   (:require [net.cgrand.enlive-html :as html]
-            [omhome.posts-meta :as posts]))
+            [omhome.posts-meta :refer [  posts]]))

 (defn enlive->html
   "Convert the enlive-transformed templates into html using a Java StringBuilder"
@@ -11,7 +11,11 @@
     (.toString buf)))

 (html/deftemplate topic-index* "fragments/index-template.html" [tag]
-  [:section :> :p] (html/content "Introductory content for index placed by index generator."))
+  [:section :> :p] (html/content "Introductory content for index placed by index generator.")
+  [:article] (html/clone-for [post posts]
+                             [:h2] (html/html-content
+                                     (html/html [:a {:href (:post-url post)} (:title post) ])))
+  )

 (defn topic-index
   "Generate a html index of pages for the supplied tag, or complete page index if not tags are supplied."


"adb shell am start -n" requires {packageName}/{Activity} format strictly

--- src/leiningen/droid/manifest.clj
+++ src/leiningen/droid/manifest.clj
@@ -71,9 +71,7 @@
                             up up
                             (xml-> (attr :android:name)))
         pkg-name (first (xml-> manifest (attr :package)))]
-    (if (.startsWith activity-name pkg-name)
-      activity-name
-      (str pkg-name "/" activity-name))))
+    (str pkg-name "/" activity-name)))

 (defn write-manifest-with-internet-permission
   "Updates the manifest on disk guaranteed to have the Internet permission."


Fix typo in :dragend event keyword

Fix typo in :dragend event keyword

--- src/playmary/util.cljs
+++ src/playmary/util.cljs
@@ -52,10 +52,9 @@
    :dragover goog.events.EventType.DRAGOVER
    :dragleave goog.events.EventType.DRAGLEAVE
    :drop goog.events.EventType.DROP
-   :dragent goog.events.EventType.DRAGEND
+   :dragend goog.events.EventType.DRAGEND

-   :orientation-change "orientationchange"
-   })
+   :orientation-change "orientationchange"})

 (defn listen
   ([el type] (listen el type nil))


Exclude take from cljs.core ns.

Exclude take from cljs.core ns.

--- src/postal/frames.cljc
+++ src/postal/frames.cljc
@@ -1,5 +1,6 @@
 (ns postal.frames
-  "A frame types definition.")
+  "A frame types definition."
+  (:refer-clojure :exclude [take])

 (defrecord Frame [command headers body])


500 error

500 error

--- src/proxmox/remote.clj
+++ src/proxmox/remote.clj
@@ -12,6 +12,7 @@
 (ns proxmox.remote
   (:require
     [cheshire.core :refer :all]
+    [slingshot.slingshot :refer  [throw+ try+]]
     [proxmox.auth :refer (auth-headers)]
     [clojure.core.strint :refer (<<)]
     [proxmox.http-common :refer (root http-opts)]
@@ -21,9 +22,10 @@
 (import-logging)

 (defn call [verb api args]
-  (:data
-    (parse-string
-      (:body @(verb (<< "~(root)~{api}") (merge args http-opts {:headers (auth-headers)}))) true)))
+  (let [{:keys [body error status] :as res} @(verb (<< "~(root)~{api}") (merge args http-opts {:headers (auth-headers)}))]
+  (when (= status 500)
+    (throw+ (assoc res :type ::call-failed)))
+  (:data (parse-string body true))))

 (defn prox-post


Update to transit-cljs 0.8.243

Update to transit-cljs 0.8.243

--- ClojureScript/replete/project.clj
+++ ClojureScript/replete/project.clj
@@ -2,7 +2,7 @@
   :dependencies [[andare "0.7.0"]                           ; Update in script/build also
                  [cljsjs/parinfer "1.8.1-0"]
                  [com.cognitect/transit-clj "0.8.300"]
-                 [com.cognitect/transit-cljs "0.8.239"]
+                 [com.cognitect/transit-cljs "0.8.243"]
                  [fipp "0.6.8"]
                  [tailrecursion/cljson "1.0.7"]
                  [malabarba/lazy-map "1.1"]


figwheel.main: fix (reset) error

figwheel.main: fix (reset) error

--- figwheel-main/src/figwheel/main/watching.clj
+++ figwheel-main/src/figwheel/main/watching.clj
@@ -9,8 +9,10 @@
 (defn alter-watches [{:keys [watcher watches]} f]
   (when watcher (hawk/stop! watcher))
   (let [watches (f watches)
-        watcher (apply hawk/watch! (map vector (vals watches)))]
-    {:watcher watcher :watches watches}))
+        watcher (when (not-empty watches)
+                  (apply hawk/watch! (map vector (vals watches))))]
+    {:watcher watcher
+     :watches watches}))

 (defn add-watch! [watch-key watch]
   (swap! *watcher* alter-watches #(assoc % watch-key watch)))


:sparkles: Proper use of hooks on frame shape.

--- frontend/src/uxbox/main/ui/shapes/frame.cljs
+++ frontend/src/uxbox/main/ui/shapes/frame.cljs
@@ -5,8 +5,7 @@
 ;; This Source Code Form is "Incompatible With Secondary Licenses", as
 ;; defined by the Mozilla Public License, v. 2.0.
 ;;
-;; Copyright (c) 2015-2020 Andrey Antukh <niwi@niwi.nz>
-;; Copyright (c) 2015-2020 Juan de la Cruz <delacruzgarciajuan@gmail.com>
+;; Copyright (c) 2020 UXBOX Labs SL

 (ns uxbox.main.ui.shapes.frame
   (:require
@@ -51,33 +50,44 @@

 (defn frame-wrapper
   [shape-wrapper]
-  (mf/fnc frame-wrapper
-    {::mf/wrap [#(mf/memo' % frame-wrapper-memo-equals?)]}
-    [{:keys [shape objects] :as props}]
-    (let [selected-iref (-> (mf/deps (:id shape))
-                            (mf/use-memo #(refs/make-selected (:id shape))))
-          selected? (mf/deref selected-iref)
-          zoom (mf/deref refs/selected-zoom)
-          frame-shape (mf/use-memo #(frame-shape shape-wrapper))]
-      (when (and shape (not (:hidden shape)))
-        (let [on-mouse-down #(common/on-mouse-down % shape)
-              on-context-menu #(common/on-context-menu % shape)
-              shape (merge frame-default-props shape)
+  (let [frame-shape (frame-shape shape-wrapper)]
+    (mf/fnc frame-wrapper
+      {::mf/wrap [#(mf/memo' % frame-wrapper-memo-equals?)]
+       ::mf/wrap-props false}
+      [props]
+      (let [shape (unchecked-get props "shape")
+            objects (unchecked-get props "objects")

-              {:keys [x y width height]} shape
+            selected-iref (mf/use-memo (mf/deps (:id shape))
+                                       #(refs/make-selected (:id shape)))
+            selected? (mf/deref selected-iref)
+            zoom (mf/deref refs/selected-zoom)

-              inv-zoom (/ 1 zoom)
-              childs (mapv #(get objects %) (:shapes shape))
-              ds-modifier (:displacement-modifier shape)

-              label-pos (cond-> (gpt/point x (- y 10))
-                          (gmt/matrix? ds-modifier) (gpt/transform ds-modifier))
+            on-mouse-down   (mf/use-callback (mf/deps shape)
+                                             #(common/on-mouse-down % shape))
+            on-context-menu (mf/use-callback (mf/deps shape)
+                                             #(common/on-context-menu % shape))

-              on-double-click
-              (fn [event]
-                (dom/prevent-default event)
-                (st/emit! dw/deselect-all
-                          (dw/select-shape (:id shape))))]
+
+            {:keys [x y width height]} shape
+
+            inv-zoom    (/ 1 zoom)
+            childs      (mapv #(get objects %) (:shapes shape))
+            ds-modifier (:displacement-modifier shape)
+
+            label-pos (cond-> (gpt/point x (- y 10))
+                        (gmt/matrix? ds-modifier) (gpt/transform ds-modifier))
+
+            on-double-click
+            (mf/use-callback
+             (mf/deps (:id shape))
+             (fn [event]
+               (dom/prevent-default event)
+               (st/emit! dw/deselect-all
+                         (dw/select-shape (:id shape)))))]
+
+        (when-not (:hidden shape)
           [:g {:class (when selected? "selected")
                :on-context-menu on-context-menu
                :on-double-click on-double-click
@@ -86,25 +96,32 @@
                    :y 0
                    :width width
                    :height 20
-                   :class-name "workspace-frame-label"
-                   ;; Ensure that the label has always the same font size, regardless of zoom
+                   :class "workspace-frame-label"
+                   ;; Ensure that the label has always the same font
+                   ;; size, regardless of zoom
                    ;; https://css-tricks.com/transforms-on-svg-elements/
                    :transform (str
                                "scale(" inv-zoom ", " inv-zoom ") "
-                               "translate(" (* zoom (:x label-pos)) ", " (* zoom (:y label-pos)) ")")
+                               "translate(" (* zoom (:x label-pos)) ", "
+                               (* zoom (:y label-pos)) ")")
                    ;; User may also select the frame with single click in the label
                    :on-click on-double-click}
             (:name shape)]
-           [:& frame-shape {:shape (geom/transform-shape shape)
-                            :childs childs}]])))))
+           [:& frame-shape
+            {:shape (geom/transform-shape shape)
+             :childs childs}]])))))

 (defn frame-shape
   [shape-wrapper]
   (mf/fnc frame-shape
-    [{:keys [shape childs] :as props}]
-    (let [{:keys [id x y width height]} shape
+    {::mf/wrap-props false}
+    [props]
+    (let [childs (unchecked-get props "childs")
+          shape (unchecked-get props "shape")
+          {:keys [id x y width height]} shape

-          props (-> (attrs/extract-style-attrs shape)
+          props (-> (merge frame-default-props shape)
+                    (attrs/extract-style-attrs)
                     (itr/obj-assign!
                      #js {:x 0
                           :y 0


Change regex for stacktrace stuff.

Change regex for stacktrace stuff.

It didn't work for defrecord/deftype functions; now it's
at least kinda working.

--- dev/bake/test.clj
+++ dev/bake/test.clj
@@ -37,7 +37,7 @@
   (defn- clojure-ns
     "Returns the clojure namespace name implied by the bytecode class name."
     [class-name]
-    (re-gsub #"_" "-" (re-get #"([^$]+)\$" class-name 1)))
+    (re-gsub #"_" "-" (re-get #"([^$]+(?=\$)|.+(?=\.))" class-name 1)))

   ; drop everything before and including the first $
   ; drop everything after and including and the second $


Zap error in comment.

Zap error in comment.

--- src/active/clojure/validation.cljc
+++ src/active/clojure/validation.cljc
@@ -268,8 +268,8 @@
   validations.

   All failures' [[validation-error-label]]s are prepended with a tuple
-  of `label` if present (otherwise, defaults to `::seq`) and the index
-  of the value that could not be validated."
+  of `label` if present (otherwise, defaults to `::choice`) and the
+  index of the value that could not be validated."
   [validators candidate & [label]]
   ;; Choice is interesting because we need to have exactly one
   ;; validator successfully validate the candidate.


render horizontal walls

render horizontal walls

--- src/quoridor/board.clj
+++ src/quoridor/board.clj
@@ -29,13 +29,23 @@
   [state coords]
   (reduce above (repeat 3 blank-column)))

-(defn- row-separator
-  [state n]
-  (s/join (cons "     " (flatten (repeat 7 [blank-column "     "])))))
+(defn- horizontal-wall-at?
+  [state pos]
+  (some (fn [x] (or (= (subs x 0 2) pos)
+                    (= (subs x 2 4) pos)))
+        (state :walls)))

 (defn char-range
   [start end]
   (set (map char (range (int start) (+ (int end) 1)))))
+
+(defn- row-separator
+  [state n]
+  (beside blank-column
+          (s/join blank-column (for [c (char-range \a \h)]
+                                 (if (horizontal-wall-at? state (str c n))
+                                   "*****"
+                                   "     ")))))

 (defn- row
   [state n]
@@ -59,5 +69,5 @@
   ([state]
    (let [rows (reduce above (for [n (range 8 0 -1)]
                               (above (beside (row-label n) (row state n))
-                                     (row-separator state n))))]
+                                     (row-separator state (- n 1)))))]
      (above (column-headers) rows))))


#14 - Eventually remove bug warning in h-box demo

--- src/re_demo/h_box.cljs
+++ src/re_demo/h_box.cljs
@@ -120,8 +120,7 @@
                                [:p [:code ":justify"] " is the analog of " [hyperlink-href
                                                                             :label "Flexbox justify-content style"
                                                                             :href "https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content"
-                                                                            :target "_blank"] "."]
-                               [:p [:strong "Note: "] "There is a bug in Chrome. When switching from :between to :around (or visa versa), the change is not shown. To get around this, select a different value beforehand."]]]}
+                                                                            :target "_blank"] "."]]]}

             ;; Align
             {:hbox {:over?      false


add helpful error messages which explain recent renaming

--- src/re_frame/core.cljc
+++ src/re_frame/core.cljc
@@ -40,6 +40,7 @@
 (def clear-event!        events/clear-handler!)

 ;; Registers a pure event handler. Places pure middleware in the correct, LHS position.
+
 (defn reg-event
   ([id handler]
     (events/register-base id pure handler))
@@ -94,3 +95,20 @@
 (defn remove-post-event-callback
   [f]
   (router/remove-post-event-callback re-frame.router/event-queue f))
+
+
+;; --  Helpful Message
+;; Assisting the v0.0.7 ->  v0.0.8 tranistion.  Remove in v0.0.9
+(defn register-handler
+  [& args]
+  (console :error  "re-frame:  \"register-handler\" has been renamed \"reg-event\""))
+
+(defn register-sub
+  [& args]
+  (console :error  "re-frame:  \"register-sub\" has been renamed \"reg-sub-raw\"."))
+
+;; v0.0.8 alpha2 -> alpha3
+(defn def-fx    [& args]  (console :error  "re-frame:  in v0.0.8-alpha3 \"def-fx\" was renamed \"reg-fx\"."))
+(defn def-event [& args]  (console :error  "re-frame:  in v0.0.8-alpha3 \"def-event\" was renamed \"reg-event\"."))
+(defn def-sub   [& args]  (console :error  "re-frame:  in v0.0.8-alpha3 \"def-sub\" was renamed \"reg-sub\"."))
+