(maint) Restructure test to use fixture

(maint) Restructure test to use fixture

Restructures tests to use a `with-running-server` fixture to simplify
setup.

--- test/integration/puppetlabs/services/jruby/tasks_test.clj
+++ test/integration/puppetlabs/services/jruby/tasks_test.clj
@@ -14,7 +14,42 @@
   (:import [java.io File]
            [org.jruby.exceptions RaiseException]))

+(schema/defn puppet-tk-config
+  [code-dir :- File, conf-dir :- File]
+  (jruby-testutils/jruby-puppet-tk-config
+   (jruby-testutils/jruby-puppet-config
+    {:master-code-dir (.getAbsolutePath code-dir)
+     :master-conf-dir (.getAbsolutePath conf-dir)})))
+
+(def puppet-conf-file-contents
+  "[main]\nenvironment_timeout=unlimited\nbasemodulepath=$codedir/modules\n")
+
+(def ^:dynamic *code-dir* nil)
+(def ^:dynamic *jruby-service* nil)
+(def ^:dynamic *jruby-puppet* nil)
+
+(defn with-running-server
+  [f]
+  (let [code-dir (ks/temp-dir)
+        conf-dir (ks/temp-dir)]
+    (testutils/create-file (fs/file conf-dir "puppet.conf") puppet-conf-file-contents)
+    (tk-bootstrap/with-app-with-config
+      app
+      jruby-testutils/jruby-service-and-dependencies
+      (puppet-tk-config code-dir conf-dir)
+      (let [jruby-service (tk-app/get-service app :JRubyPuppetService)
+            instance (jruby-testutils/borrow-instance jruby-service :test)
+            jruby-puppet (:jruby-puppet instance)]
+        (binding [*code-dir* code-dir
+                  *jruby-service* jruby-service
+                  *jruby-puppet* jruby-puppet]
+          (try
+            (f)
+            (finally
+              (jruby-testutils/return-instance jruby-service instance :test))))))))
+
 (use-fixtures :once schema-test/validate-schemas)
+(use-fixtures :each with-running-server)

 (def TaskOptions
   {:name schema/Str
@@ -74,209 +109,153 @@
                   (str module-name "::" name))})
        tasks))

-(schema/defn puppet-tk-config
-  [code-dir :- File, conf-dir :- File]
-  (jruby-testutils/jruby-puppet-tk-config
-   (jruby-testutils/jruby-puppet-config
-    {:master-code-dir (.getAbsolutePath code-dir)
-     :master-conf-dir (.getAbsolutePath conf-dir)})))
-
-(def puppet-conf-file-contents
-  "[main]\nenvironment_timeout=unlimited\nbasemodulepath=$codedir/modules\n")
-
 (deftest ^:integration task-data-test
   (testing "requesting data about a specific task"
-    (let [code-dir (ks/temp-dir)
-          conf-dir (ks/temp-dir)]
-
-      (testutils/create-file (fs/file conf-dir "puppet.conf") puppet-conf-file-contents)
-
-      (tk-bootstrap/with-app-with-config
-        app
-        jruby-testutils/jruby-service-and-dependencies
-        (puppet-tk-config code-dir conf-dir)
-        (let [jruby-service (tk-app/get-service app :JRubyPuppetService)
-              instance (jruby-testutils/borrow-instance jruby-service :test)
-              jruby-puppet (:jruby-puppet instance)
-              env-1-dir (env-dir code-dir "env1")
-              env-1-tasks [{:name "install"
-                            :module-name "apache"
-                            :metadata? true
-                            :number-of-files 2}
-                           {:name "init"
-                            :module-name "apache"
-                            :metadata? false
-                            :number-of-files 1}]
-              get-task-data (fn [env module task]
-                              (-> (.getTaskData jruby-puppet env module task)
-                                  mc/sort-nested-info-maps))]
-
-          (try (create-env env-1-dir env-1-tasks)
-            (testing "when the environment, module, and task do exist"
-              (testing "with the init task"
-                (let [res (get-task-data "env1" "apache" "init")]
-                  (is (nil? (schema/check mc/TaskData res)))
-                  (is (some (fn [file-path] (.contains file-path "init"))
-                            (:files res)))))
-
-              (testing "with another named task"
-                (let [res (get-task-data "env1" "apache" "install")]
-                  (is (nil? (schema/check mc/TaskData res)))
-                  (is (some (fn [file-path] (.contains file-path "install"))
-                            (:files res))))))
-
-            (testing "when the environment does not exist"
-              (is (thrown-with-msg? RaiseException
-                                    #"(EnvironmentNotFound)"
-                                    (get-task-data "env2" "doesnotmatter" "whatever"))))
-
-            (testing "when the module does not exist"
-              (is (thrown-with-msg? RaiseException
-                                    #"(MissingModule)"
-                                    (get-task-data "env1" "notamodule" "install"))))
-
-            (testing "when the module name is invalid"
-              (is (thrown-with-msg? RaiseException
-                                    #"(MissingModule)"
-                                    (get-task-data "env1" "7!" "install"))))
-
-            (testing "when the task does not exist"
-              (is (thrown-with-msg? RaiseException
-                                    #"(TaskNotFound)"
-                                    (get-task-data "env1" "apache" "recombobulate"))))
-
-            (testing "when the task does not exist"
-              (is (thrown-with-msg? RaiseException
-                                    #"(TaskNotFound)"
-                                    (get-task-data "env1" "apache" "recombobulate"))))
-
-            (testing "when the task name is invalid"
-              (is (thrown-with-msg? RaiseException
-                                    #"(TaskNotFound)"
-                                    (get-task-data "env1" "apache" "&&&"))))
-
-            (finally
-              (jruby-testutils/return-instance jruby-service instance :test))))))))
+    (let [tasks [{:name "install"
+                  :module-name "apache"
+                  :metadata? true
+                  :number-of-files 2}
+                 {:name "init"
+                  :module-name "apache"
+                  :metadata? false
+                  :number-of-files 1}]
+          get-task-data (fn [env module task]
+                          (-> (.getTaskData *jruby-puppet* env module task)
+                              mc/sort-nested-info-maps))]
+
+      (create-env (env-dir *code-dir* "env1") tasks)
+      (testing "when the environment, module, and task do exist"
+        (testing "with the init task"
+          (let [res (get-task-data "env1" "apache" "init")]
+            (is (nil? (schema/check mc/TaskData res)))
+            (is (some (fn [file-path] (.contains file-path "init"))
+                      (:files res)))))
+
+        (testing "with another named task"
+          (let [res (get-task-data "env1" "apache" "install")]
+            (is (nil? (schema/check mc/TaskData res)))
+            (is (some (fn [file-path] (.contains file-path "install"))
+                      (:files res))))))
+
+      (testing "when the environment does not exist"
+        (is (thrown-with-msg? RaiseException
+                              #"(EnvironmentNotFound)"
+                              (get-task-data "env2" "doesnotmatter" "whatever"))))
+
+      (testing "when the module does not exist"
+        (is (thrown-with-msg? RaiseException
+                              #"(MissingModule)"
+                              (get-task-data "env1" "notamodule" "install"))))
+
+      (testing "when the module name is invalid"
+        (is (thrown-with-msg? RaiseException
+                              #"(MissingModule)"
+                              (get-task-data "env1" "7!" "install"))))
+
+      (testing "when the task does not exist"
+        (is (thrown-with-msg? RaiseException
+                              #"(TaskNotFound)"
+                              (get-task-data "env1" "apache" "recombobulate"))))
+
+      (testing "when the task does not exist"
+        (is (thrown-with-msg? RaiseException
+                              #"(TaskNotFound)"
+                              (get-task-data "env1" "apache" "recombobulate"))))
+
+      (testing "when the task name is invalid"
+        (is (thrown-with-msg? RaiseException
+                              #"(TaskNotFound)"
+                              (get-task-data "env1" "apache" "&&&")))))))

 (deftest ^:integration all-tasks-test
   (testing "requesting all tasks"
-    (let [code-dir (ks/temp-dir)
-          conf-dir (ks/temp-dir)]
-      (testutils/create-file (fs/file conf-dir "puppet.conf") puppet-conf-file-contents)
-
-      (tk-bootstrap/with-app-with-config
-        app
-        jruby-testutils/jruby-service-and-dependencies
-        (puppet-tk-config code-dir conf-dir)
-        (let [jruby-service (tk-app/get-service app :JRubyPuppetService)
-              instance (jruby-testutils/borrow-instance jruby-service :test)
-              jruby-puppet (:jruby-puppet instance)
-              env-1-dir (env-dir code-dir "env1")
-              env-1-tasks [{:name "install"
-                            :module-name "apache"
-                            :metadata? true
-                            :number-of-files 2}
-                           {:name "init"
-                            :module-name "apache"
-                            :metadata? false
-                            :number-of-files 1}
-                           {:name "configure"
-                            :module-name "django"
-                            :metadata? true
-                            :number-of-files 0}]
-
-              get-tasks (fn [env]
-                          (.getTasks jruby-puppet env))]
-
-          (try (create-env env-1-dir env-1-tasks)
-               (testing "for environment that does exist"
-                 (is (= (->> env-1-tasks
-                             expected-tasks-info
-                             (sort-by :name))
-                        (->> (get-tasks "env1")
-                             mc/sort-nested-info-maps
-                             (sort-by :name)))
-                     "Unexpected info retrieved for 'env1'"))
-
-               (testing "for environment that does not exist"
-                 (is (nil? (get-tasks "env2"))))
-
-               (finally
-                 (jruby-testutils/return-instance jruby-service instance :test))))))))
+    (let [tasks [{:name "install"
+                  :module-name "apache"
+                  :metadata? true
+                  :number-of-files 2}
+                 {:name "init"
+                  :module-name "apache"
+                  :metadata? false
+                  :number-of-files 1}
+                 {:name "configure"
+                  :module-name "django"
+                  :metadata? true
+                  :number-of-files 0}]
+          get-tasks (fn [env]
+                      (.getTasks *jruby-puppet* env))]
+
+      (create-env (env-dir *code-dir* "env1") tasks)
+      (testing "for environment that does exist"
+        (is (= (->> tasks
+                    expected-tasks-info
+                    (sort-by :name))
+               (->> (get-tasks "env1")
+                    mc/sort-nested-info-maps
+                    (sort-by :name)))
+            "Unexpected info retrieved for 'env1'"))
+
+      (testing "for environment that does not exist"
+        (is (nil? (get-tasks "env2")))))))

 (deftest ^:integration task-details-test
   (testing "getting details for a specific task"
-    (let [code-dir (ks/temp-dir)
-          conf-dir (ks/temp-dir)]
-      (testutils/create-file (fs/file conf-dir "puppet.conf") puppet-conf-file-contents)
-
-      (tk-bootstrap/with-app-with-config
-        app
-        jruby-testutils/jruby-service-and-dependencies
-        (puppet-tk-config code-dir conf-dir)
-        (let [jruby-service (tk-app/get-service app :JRubyPuppetService)
-              instance (jruby-testutils/borrow-instance jruby-service :test)
-              jruby-puppet (:jruby-puppet instance)
-              tasks [{:name "install_mods"
-                      :module-name "apache"
-                      :metadata? true
-                      :number-of-files 1}
-                     {:name "init"
-                      :module-name "apache"
-                      :metadata? false
-                      :number-of-files 1}
-                     {:name "about"
-                      :module-name "apache"
-                      :metadata? true
-                      :number-of-files 0}]
-              get-task-details (fn [env module task]
-                                 (mc/task-details jruby-service jruby-puppet env module task))]
-
-          (try (create-env (env-dir code-dir "production") tasks)
-
-            (testing "when the environment exists"
-              (testing "and the module exists"
-                (testing "and the task exists"
-                  (testing "with metadata and payload files"
-                    (let [expected-info {:metadata {"meta" "data"}
-                                         :files [{:filename "install_mods.rb"
-                                                  :sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
-                                                  :size_bytes 0
-                                                  :uri {:path "/puppet/v3/file_content/tasks/apache/install_mods.rb"
-                                                        :params {:environment "production"}}}]}]
-                      (is (= expected-info
-                             (get-task-details "production" "apache" "install_mods")))))
-
-                  (testing "without a metadata file"
-                    (let [expected-info {:metadata {}
-                                         :files [{:filename "init.rb"
-                                                  :sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
-                                                  :size_bytes 0
-                                                  :uri {:path "/puppet/v3/file_content/tasks/apache/init.rb"
-                                                        :params {:environment "production"}}}]}]
-                      (is (= expected-info
-                             (get-task-details "production" "apache" "init")))))
-
-                  (testing "with no payload files"
-                    (let [expected-info {:metadata {"meta" "data"}
-                                         :files []}]
-                      (is (= expected-info
-                             (get-task-details "production" "apache" "about"))))))
-
-                (testing "but the task doesn't exist"
-                  (is (thrown-with-msg? RaiseException
-                                        #"(TaskNotFound)"
-                                        (get-task-details "production" "apache" "refuel")))))
-
-              (testing "but the module doesn't exist"
-                (is (thrown-with-msg? RaiseException
-                                      #"(MissingModule)"
-                                      (get-task-details "production" "mahjoule" "heat")))))
-
-            (testing "when the environment doesn't exist"
-              (is (thrown-with-msg? RaiseException
-                                    #"(EnvironmentNotFound)"
-                                    (get-task-details "DNE" "module" "missing"))))
-
-            (finally
-              (jruby-testutils/return-instance jruby-service instance :test))))))))
+    (let [tasks [{:name "install_mods"
+                  :module-name "apache"
+                  :metadata? true
+                  :number-of-files 1}
+                 {:name "init"
+                  :module-name "apache"
+                  :metadata? false
+                  :number-of-files 1}
+                 {:name "about"
+                  :module-name "apache"
+                  :metadata? true
+                  :number-of-files 0}]
+          get-task-details (fn [env module task]
+                             (mc/task-details *jruby-service* *jruby-puppet* env module task))]
+
+      (create-env (env-dir *code-dir* "production") tasks)
+
+      (testing "when the environment exists"
+        (testing "and the module exists"
+          (testing "and the task exists"
+            (testing "with metadata and payload files"
+              (let [expected-info {:metadata {"meta" "data"}
+                                   :files [{:filename "install_mods.rb"
+                                            :sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
+                                            :size_bytes 0
+                                            :uri {:path "/puppet/v3/file_content/tasks/apache/install_mods.rb"
+                                                  :params {:environment "production"}}}]}]
+                (is (= expected-info
+                       (get-task-details "production" "apache" "install_mods")))))
+
+            (testing "without a metadata file"
+              (let [expected-info {:metadata {}
+                                   :files [{:filename "init.rb"
+                                            :sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
+                                            :size_bytes 0
+                                            :uri {:path "/puppet/v3/file_content/tasks/apache/init.rb"
+                                                  :params {:environment "production"}}}]}]
+                (is (= expected-info
+                       (get-task-details "production" "apache" "init")))))
+
+            (testing "with no payload files"
+              (let [expected-info {:metadata {"meta" "data"}
+                                   :files []}]
+                (is (= expected-info
+                       (get-task-details "production" "apache" "about"))))))
+
+          (testing "but the task doesn't exist"
+            (is (thrown-with-msg? RaiseException
+                                  #"(TaskNotFound)"
+                                  (get-task-details "production" "apache" "refuel")))))
+
+        (testing "but the module doesn't exist"
+          (is (thrown-with-msg? RaiseException
+                                #"(MissingModule)"
+                                (get-task-details "production" "mahjoule" "heat")))))
+
+      (testing "when the environment doesn't exist"
+        (is (thrown-with-msg? RaiseException
+                              #"(EnvironmentNotFound)"
+                              (get-task-details "DNE" "module" "missing")))))))


More substitutions

More substitutions

- did case-specific ones instead of [xX] ones to preserve the case in the
  replacement phrase

--- src/mickopedia/mickify.clj
+++ src/mickopedia/mickify.clj
@@ -57,8 +57,15 @@
       (s/replace "Wikipedia" "Mickopedia")
       (s/replace #"\bbroken\b" "banjaxed")
       (s/replace #"\bpunch\b" "clatter")
+      (s/replace #"\bMother\b" "Mammy")
       (s/replace #"\bmother\b" "mammy")
+      (s/replace #"\bmothers\b" "mammies")
       (s/replace #"\bhim\b" "yer man")
+      (s/replace #"\b[vV]agina\b" "gee")
+      (s/replace #"\bVagina\b" "Gee")
+      (s/replace #"\bpenis\b" "mickey")
+      (s/replace #"\bPenis\b" "Mickey")
+
       (s/replace " a " (random-collection-choice aReps " a "))
       (s/replace " the " (random-collection-choice theReps " the "))
       (s/replace "." (random-collection-choice phrases "."))))
@@ -80,7 +87,7 @@
   "The mickopedia transformations."
   (html/transformation
    [:head] (html/prepend (html/html [:base {:href "http://en.wikipedia.org"}]))
-   [:div html/text-node] mickify-text-node
+   [ #{:h1 :div} html/text-node] mickify-text-node
    [:a] mickify-alink-node
    [:form#searchform] (html/set-attr :action "http://mickopedia.org/mickify")
    [:div#simpleSearch :> :input] (html/remove-attr :name)


Compression is now done inside messaging layer.

--- src/onyx/peer/function.clj
+++ src/onyx/peer/function.clj
@@ -82,13 +82,13 @@
                   scattered (get grouped nil)
                   scattered-target (rand-nth active-peers)
                   scattered-link (operation/peer-link event scattered-target :send-peer-site)]
-              (onyx.extensions/send-messages messenger event scattered-link (compress (filter-by-route scattered task-name)))
+              (onyx.extensions/send-messages messenger event scattered-link (filter-by-route scattered task-name))

               (doseq [k (filter identity (keys grouped))]
                 (let [messages (get grouped k)
                       target (nth active-peers (mod (.hashCode k) (count active-peers)))
                       target-link (operation/peer-link event target :send-peer-site)]
-                  (onyx.extensions/send-messages messenger event target-link (compress (filter-by-route messages task-name)))))))))
+                  (onyx.extensions/send-messages messenger event target-link (filter-by-route messages task-name))))))))
       {})
     {}))


hardcoded key-name fix

hardcoded key-name fix

--- src/openstack/provider.clj
+++ src/openstack/provider.clj
@@ -48,7 +48,7 @@
     (.name (machine :hostname))
     (.flavor (openstack :flavor))
     (.image (image-id machine))
-    (.keypairName "ronen")
+    (.keypairName (openstack :key-name))
     (.networks (openstack :network-ids))
     (.build)))


Ensure osc lib fns are in scope within server

--- src/overtone/sc/server.clj
+++ src/overtone/sc/server.clj
@@ -7,7 +7,8 @@
   (:import [java.util.concurrent TimeoutException])
   (:use [overtone.libs event]
         [overtone.sc.machinery.server connection comms ]
-        [overtone.util.lib :only [deref!]])
+        [overtone.util.lib :only [deref!]]
+        [overtone.osc])
   (:require [overtone.util.log :as log]))

 (def OVERTONE-VERSION {:major 0


rm_case_pat_info

--- src/pg_demo/table_defs.clj
+++ src/pg_demo/table_defs.clj
@@ -1415,6 +1415,111 @@
               PRIMARY KEY (ENTERPRISE_ID,CASE_ID,SEQ_NUM,DLP_REVISION_NUMBER)
           ); " }

+    { "rm_case_pat_info"
+          "CREATE TABLE rm_case_pat_info (
+              ENTERPRISE_ID numeric NOT NULL,
+              CASE_ID numeric NOT NULL,
+              PAT_ID varchar(10),
+              PAT_SUBJ_NUM varchar(20),
+              PAT_INITIALS varchar(10),
+              PAT_FIRSTNAME varchar(35),
+              PAT_MI varchar(15),
+              PAT_LASTNAME varchar(50),
+              PAT_ADDRESS varchar(120),
+              PAT_CITY varchar(35),
+              PAT_STATE varchar(40),
+              PAT_POSTAL_CODE varchar(15),
+              PAT_COUNTRY varchar(50),
+              PAT_PHONE varchar(20),
+              PAT_DOB timestamp,
+              PAT_DOB_RES numeric,
+              PAT_AGE numeric(22,7),
+              AGE_UNIT_ID numeric,
+              AGE_GROUP_ID numeric,
+              GENDER_ID numeric,
+              PAT_WEIGHT_LBS numeric(22,7),
+              PAT_WEIGHT_KG numeric(22,7),
+              PAT_HEIGHT_IN numeric(22,7),
+              PAT_HEIGHT_CM numeric(22,7),
+              ETHNICITY_ID numeric,
+              OCCUPATION_ID numeric,
+              PAT_STAT_PREG numeric,
+              REL_TEST_ID numeric,
+              PAT_DOB_PARTIAL varchar(20),
+              RAND_NUM varchar(15),
+              CONFIDENTIAL numeric(1),
+              NUMBER_OF_PATIENTS varchar(8),
+              UD_TEXT_1 varchar(100),
+              UD_TEXT_2 varchar(100),
+              UD_TEXT_3 varchar(100),
+              UD_TEXT_4 varchar(100),
+              UD_TEXT_5 varchar(100),
+              UD_TEXT_6 varchar(100),
+              UD_TEXT_7 varchar(100),
+              UD_TEXT_8 varchar(100),
+              UD_TEXT_9 varchar(100),
+              UD_TEXT_10 varchar(100),
+              UD_TEXT_11 varchar(100),
+              UD_TEXT_12 varchar(100),
+              UD_DATE_1 timestamp,
+              UD_DATE_2 timestamp,
+              UD_DATE_3 timestamp,
+              UD_DATE_4 timestamp,
+              UD_DATE_5 timestamp,
+              UD_DATE_6 timestamp,
+              UD_DATE_7 timestamp,
+              UD_DATE_8 timestamp,
+              UD_DATE_9 timestamp,
+              UD_DATE_10 timestamp,
+              UD_DATE_11 timestamp,
+              UD_DATE_12 timestamp,
+              UD_NUMBER_1 numeric(30,10),
+              UD_NUMBER_2 numeric(30,10),
+              UD_NUMBER_3 numeric(30,10),
+              UD_NUMBER_4 numeric(30,10),
+              UD_NUMBER_5 numeric(30,10),
+              UD_NUMBER_6 numeric(30,10),
+              UD_NUMBER_7 numeric(30,10),
+              UD_NUMBER_8 numeric(30,10),
+              UD_NUMBER_9 numeric(30,10),
+              UD_NUMBER_10 numeric(30,10),
+              UD_NUMBER_11 numeric(30,10),
+              UD_NUMBER_12 numeric(30,10),
+              DELETED timestamp,
+              CHILD_ONLY numeric(1),
+              PAT_BMI numeric(22,7),
+              PAT_BODY_AREA numeric(22,7),
+              PAT_ADDRESS_J varchar(120),
+              PAT_CITY_J varchar(35),
+              PAT_FIRSTNAME_J varchar(35),
+              PAT_LASTNAME_J varchar(50),
+              PAT_MI_J varchar(15),
+              PAT_STATE_J varchar(40),
+              UD_TEXT_1_J varchar(100),
+              UD_TEXT_2_J varchar(100),
+              UD_TEXT_3_J varchar(100),
+              UD_TEXT_4_J varchar(100),
+              UD_TEXT_5_J varchar(100),
+              UD_TEXT_6_J varchar(100),
+              UD_TEXT_7_J varchar(100),
+              UD_TEXT_8_J varchar(100),
+              UD_TEXT_9_J varchar(100),
+              UD_TEXT_10_J varchar(100),
+              UD_TEXT_11_J varchar(100),
+              UD_TEXT_12_J varchar(100),
+              PAT_COUNTRY_ID numeric,
+              DLP_REVISION_NUMBER numeric NOT NULL,
+              REVISION_DELETE_FLAG numeric,
+              DELETED_FLAG numeric(1) NOT NULL,
+              EFFECTIVE_START_DATE timestamp NOT NULL,
+              EFFECTIVE_END_DATE timestamp NOT NULL,
+              NOTES text,
+              NOTES_J text,
+              AGE_UNIT_ID_AT_VACC numeric,
+              PAT_AGE_AT_VACC numeric,
+              PRIMARY KEY (ENTERPRISE_ID,CASE_ID,DLP_REVISION_NUMBER)
+          ); " }
+
   ] ))

 (def dummy


Fixes alignment in components.clj (#301)

--- scheduler/src/cook/components.clj
+++ scheduler/src/cook/components.clj
@@ -68,58 +68,58 @@

 (def raw-scheduler-routes
   {:scheduler (fnk [mesos-datomic framework-id mesos-pending-jobs-atom [:settings task-constraints mesos-gpu-enabled is-authorized-fn]]
-                   ((lazy-load-var 'cook.mesos.api/main-handler)
-                    mesos-datomic
-                    framework-id
-                    task-constraints
-                    mesos-gpu-enabled
-                    (fn [] @mesos-pending-jobs-atom)
-                    is-authorized-fn))
+                ((lazy-load-var 'cook.mesos.api/main-handler)
+                  mesos-datomic
+                  framework-id
+                  task-constraints
+                  mesos-gpu-enabled
+                  (fn [] @mesos-pending-jobs-atom)
+                  is-authorized-fn))
    :view (fnk [scheduler]
-              scheduler)})
+           scheduler)})

 (def full-routes
   {:raw-scheduler raw-scheduler-routes
    :view (fnk [raw-scheduler]
-              (routes (:view raw-scheduler)
-                      (route/not-found "
Not a valid route
")))})
+           (routes (:view raw-scheduler)
+                   (route/not-found "
Not a valid route
")))})

 (def mesos-scheduler
   {:mesos-scheduler (fnk [[:settings mesos-master mesos-master-hosts mesos-leader-path mesos-failover-timeout mesos-principal mesos-role mesos-framework-name offer-incubate-time-ms mea-culpa-failure-limit fenzo-max-jobs-considered fenzo-scaleback fenzo-floor-iterations-before-warn fenzo-floor-iterations-before-reset task-constraints riemann mesos-gpu-enabled rebalancer good-enough-fitness] mesos-datomic mesos-datomic-mult curator-framework mesos-pending-jobs-atom mesos-offer-cache]
-                         (let [make-mesos-driver-fn (partial (lazy-load-var 'cook.mesos/make-mesos-driver)
-                                                             {:mesos-master mesos-master
-                                                              :mesos-failover-timeout mesos-failover-timeout
-                                                              :mesos-principal mesos-principal
-                                                              :mesos-role mesos-role
-                                                              :mesos-framework-name mesos-framework-name
-                                                              :gpus-enabled? mesos-gpu-enabled})
-                               get-mesos-utilization-fn (partial (lazy-load-var 'cook.mesos/get-mesos-utilization) mesos-master-hosts)]
-                           (try
-                             (Class/forName "org.apache.mesos.Scheduler")
-                             ((lazy-load-var 'cook.mesos/start-mesos-scheduler)
-                              make-mesos-driver-fn
-                              get-mesos-utilization-fn
-                              curator-framework
-                              mesos-datomic
-                              mesos-datomic-mult
-                              mesos-leader-path
-                              offer-incubate-time-ms
-                              mea-culpa-failure-limit
-                              task-constraints
-                              (:host riemann)
-                              (:port riemann)
-                              mesos-pending-jobs-atom
-                              mesos-offer-cache
-                              mesos-gpu-enabled
-                              rebalancer
-                              {:fenzo-max-jobs-considered fenzo-max-jobs-considered
-                               :fenzo-scaleback fenzo-scaleback
-                               :fenzo-floor-iterations-before-warn fenzo-floor-iterations-before-warn
-                               :fenzo-floor-iterations-before-reset fenzo-floor-iterations-before-reset
-                               :good-enough-fitness good-enough-fitness})
-                             (catch ClassNotFoundException e
-                               (log/warn e "Not loading mesos support...")
-                               nil))))})
+                      (let [make-mesos-driver-fn (partial (lazy-load-var 'cook.mesos/make-mesos-driver)
+                                                          {:mesos-master mesos-master
+                                                           :mesos-failover-timeout mesos-failover-timeout
+                                                           :mesos-principal mesos-principal
+                                                           :mesos-role mesos-role
+                                                           :mesos-framework-name mesos-framework-name
+                                                           :gpus-enabled? mesos-gpu-enabled})
+                            get-mesos-utilization-fn (partial (lazy-load-var 'cook.mesos/get-mesos-utilization) mesos-master-hosts)]
+                        (try
+                          (Class/forName "org.apache.mesos.Scheduler")
+                          ((lazy-load-var 'cook.mesos/start-mesos-scheduler)
+                            make-mesos-driver-fn
+                            get-mesos-utilization-fn
+                            curator-framework
+                            mesos-datomic
+                            mesos-datomic-mult
+                            mesos-leader-path
+                            offer-incubate-time-ms
+                            mea-culpa-failure-limit
+                            task-constraints
+                            (:host riemann)
+                            (:port riemann)
+                            mesos-pending-jobs-atom
+                            mesos-offer-cache
+                            mesos-gpu-enabled
+                            rebalancer
+                            {:fenzo-max-jobs-considered fenzo-max-jobs-considered
+                             :fenzo-scaleback fenzo-scaleback
+                             :fenzo-floor-iterations-before-warn fenzo-floor-iterations-before-warn
+                             :fenzo-floor-iterations-before-reset fenzo-floor-iterations-before-reset
+                             :good-enough-fitness good-enough-fitness})
+                          (catch ClassNotFoundException e
+                            (log/warn e "Not loading mesos support...")
+                            nil))))})

 (defn health-check-middleware
   "This adds /debug to return 200 OK"
@@ -137,29 +137,29 @@

 (def mesos-datomic
   (fnk [[:settings mesos-datomic-uri]]
-       ((lazy-load-var 'datomic.api/create-database) mesos-datomic-uri)
-       (let [conn ((lazy-load-var 'datomic.api/connect) mesos-datomic-uri)]
-         (doseq [txn (deref (lazy-load-var 'cook.mesos.schema/work-item-schema))]
-           (deref ((lazy-load-var 'datomic.api/transact) conn txn))
-           ((lazy-load-var 'metatransaction.core/install-metatransaction-support) conn)
-           ((lazy-load-var 'metatransaction.utils/install-utils-support) conn))
-         conn)))
+    ((lazy-load-var 'datomic.api/create-database) mesos-datomic-uri)
+    (let [conn ((lazy-load-var 'datomic.api/connect) mesos-datomic-uri)]
+      (doseq [txn (deref (lazy-load-var 'cook.mesos.schema/work-item-schema))]
+        (deref ((lazy-load-var 'datomic.api/transact) conn txn))
+        ((lazy-load-var 'metatransaction.core/install-metatransaction-support) conn)
+        ((lazy-load-var 'metatransaction.utils/install-utils-support) conn))
+      conn)))

 (def curator-framework
   (fnk [[:settings zookeeper] local-zookeeper]
-       (let [retry-policy (BoundedExponentialBackoffRetry. 100 120000 10)
-             ;; The 180s session and 30s connection timeouts were pulled from a google group
-             ;; recommendation
-             curator-framework (CuratorFrameworkFactory/newClient zookeeper 180000 30000 retry-policy)
-             ]
-         (.. curator-framework
-             getConnectionStateListenable
-             (addListener (reify ConnectionStateListener
-                            (stateChanged [_ client newState]
-                              (log/info "Curator state changed:"
-                                        (str newState))))))
-         (.start curator-framework)
-         curator-framework)))
+    (let [retry-policy (BoundedExponentialBackoffRetry. 100 120000 10)
+          ;; The 180s session and 30s connection timeouts were pulled from a google group
+          ;; recommendation
+          curator-framework (CuratorFrameworkFactory/newClient zookeeper 180000 30000 retry-policy)
+          ]
+      (.. curator-framework
+          getConnectionStateListenable
+          (addListener (reify ConnectionStateListener
+                         (stateChanged [_ client newState]
+                           (log/info "Curator state changed:"
+                                     (str newState))))))
+      (.start curator-framework)
+      curator-framework)))

 (defn tell-jetty-about-usename [h]
   "Our auth in cook.spnego doesn't hook in to Jetty - this handler
@@ -210,37 +210,37 @@
     {:mesos-datomic mesos-datomic
      :route full-routes
      :http-server (fnk [[:settings server-port authorization-middleware [:rate-limit user-limit]] [:route view]]
-                       (log/info "Launching http server")
-                       (let [rate-limit-storage (storage/local-storage)
-                             jetty ((lazy-load-var 'qbits.jet.server/run-jetty)
-                                    {:port server-port
-                                     :ring-handler (-> view
-                                                       tell-jetty-about-usename
-                                                       (wrap-rate-limit {:storage rate-limit-storage
-                                                                         :limit user-limit})
-                                                       authorization-middleware
-                                                       wrap-stacktrace
-                                                       wrap-no-cache
-                                                       wrap-cookies
-                                                       wrap-params
-                                                       health-check-middleware
-                                                       instrument)
-                                     :join? false
-                                     :configurator configure-jet-logging
-                                     :max-threads 200
-                                     :request-header-size 32768})]
-                         (fn [] (.stop jetty))))
+                    (log/info "Launching http server")
+                    (let [rate-limit-storage (storage/local-storage)
+                          jetty ((lazy-load-var 'qbits.jet.server/run-jetty)
+                                  {:port server-port
+                                   :ring-handler (-> view
+                                                     tell-jetty-about-usename
+                                                     (wrap-rate-limit {:storage rate-limit-storage
+                                                                       :limit user-limit})
+                                                     authorization-middleware
+                                                     wrap-stacktrace
+                                                     wrap-no-cache
+                                                     wrap-cookies
+                                                     wrap-params
+                                                     health-check-middleware
+                                                     instrument)
+                                   :join? false
+                                   :configurator configure-jet-logging
+                                   :max-threads 200
+                                   :request-header-size 32768})]
+                      (fn [] (.stop jetty))))

      :framework-id (fnk [curator-framework [:settings mesos-leader-path]]
-                        (when-let [bytes (curator/get-or-nil curator-framework
-                                                             (str mesos-leader-path "/framework-id"))]
-                          (String. bytes)))
+                     (when-let [bytes (curator/get-or-nil curator-framework
+                                                          (str mesos-leader-path "/framework-id"))]
+                       (String. bytes)))
      :mesos-datomic-mult (fnk [mesos-datomic]
-                              (first ((lazy-load-var 'cook.datomic/create-tx-report-mult) mesos-datomic)))
+                           (first ((lazy-load-var 'cook.datomic/create-tx-report-mult) mesos-datomic)))
      :local-zookeeper (fnk [[:settings zookeeper-server]]
-                           (when zookeeper-server
-                             (log/info "Starting local ZK server")
-                             (.start zookeeper-server)))
+                        (when zookeeper-server
+                          (log/info "Starting local ZK server")
+                          (.start zookeeper-server)))
      :mesos mesos-scheduler
      :mesos-pending-jobs-atom (fnk [] (atom {}))
      :mesos-offer-cache (fnk [[:settings [:offer-cache max-size ttl-ms]]]
@@ -256,41 +256,41 @@
                (.getHostName (java.net.InetAddress/getLocalHost)))))

 #_(def dev-mem-settings
-  {:server-port (fnk [] 12321)
-   :authorization-middleware (fnk [] (fn [h] (fn [req] (h (assoc req :authorization/user (System/getProperty "user.name"))))))
-   :sim-agent-path (fnk [] "/usr/bin/sim-agent") ;;TODO parameterize
-   :mesos-datomic-uri (fnk [] "datomic:mem://mesos-jobs")
-   :dns-name simple-dns-name
-   :zookeeper (fnk []
-                   "localhost:3291")
-   :zookeeper-server (fnk []
-                          (org.apache.curator.test.TestingServer. 3291 true) ;; Start a local ZK for simplicity
-                          )
-   :hostname (fnk [] (.getCanonicalHostName (java.net.InetAddress/getLocalHost)))
-   :offer-incubate-time-ms (fnk [] (* 15 1000))
-   :task-constraints (fnk []
-                          {:timeout-hours 1
-                           :timeout-interval-minutes 1
-                           :memory-gb 48
-                           :cpus 6
-                           :retry-limit 5})
-   ;:task-constraints (fnk []
-   ;                       {:timeout-hours (* 5 24)
-   ;                        :timeout-interval-minutes 10
-   ;                        :memory-gb 128
-   ;                        :cpus 24})
-   :mesos-master (fnk [] "zk://localhost:2181/mesos")
-   :mesos-failover-timeout (fnk [] nil) ; don't fail over
-   ;:mesos-failover-timeout (fnk [] (* 1.0
-   ;                                   3600  ; seconds/hour
-   ;                                   24    ; hours/day
-   ;                                   7     ; days/week
-   ;                                   2     ; weeks
-   ;                                   ))
-   :mesos-leader-path (fnk [] (str "/cook-scheduler"))
-   :mesos-principal (fnk [] nil) ;; You can change this to customize for your environment
-   :exception-handler (fnk [] ((lazy-load-var 'cook.util/install-email-on-exception-handler))) ;;TODO parameterize
-   })
+    {:server-port (fnk [] 12321)
+     :authorization-middleware (fnk [] (fn [h] (fn [req] (h (assoc req :authorization/user (System/getProperty "user.name"))))))
+     :sim-agent-path (fnk [] "/usr/bin/sim-agent") ;;TODO parameterize
+     :mesos-datomic-uri (fnk [] "datomic:mem://mesos-jobs")
+     :dns-name simple-dns-name
+     :zookeeper (fnk []
+                  "localhost:3291")
+     :zookeeper-server (fnk []
+                         (org.apache.curator.test.TestingServer. 3291 true) ;; Start a local ZK for simplicity
+                         )
+     :hostname (fnk [] (.getCanonicalHostName (java.net.InetAddress/getLocalHost)))
+     :offer-incubate-time-ms (fnk [] (* 15 1000))
+     :task-constraints (fnk []
+                         {:timeout-hours 1
+                          :timeout-interval-minutes 1
+                          :memory-gb 48
+                          :cpus 6
+                          :retry-limit 5})
+     ;:task-constraints (fnk []
+     ;                       {:timeout-hours (* 5 24)
+     ;                        :timeout-interval-minutes 10
+     ;                        :memory-gb 128
+     ;                        :cpus 24})
+     :mesos-master (fnk [] "zk://localhost:2181/mesos")
+     :mesos-failover-timeout (fnk [] nil) ; don't fail over
+     ;:mesos-failover-timeout (fnk [] (* 1.0
+     ;                                   3600  ; seconds/hour
+     ;                                   24    ; hours/day
+     ;                                   7     ; days/week
+     ;                                   2     ; weeks
+     ;                                   ))
+     :mesos-leader-path (fnk [] (str "/cook-scheduler"))
+     :mesos-principal (fnk [] nil) ;; You can change this to customize for your environment
+     :exception-handler (fnk [] ((lazy-load-var 'cook.util/install-email-on-exception-handler))) ;;TODO parameterize
+     })

 (def default-authorization {:authorization-fn 'cook.authorization/open-auth})

@@ -300,141 +300,141 @@
   "Parses the settings out of a config file"
   (graph/eager-compile
     {:server-port (fnk [[:config port]]
-                       port)
+                    port)
      :is-authorized-fn (fnk [[:config {authorization-config default-authorization}]]
-                                (partial (lazy-load-var 'cook.authorization/is-authorized?)
-                                         authorization-config))
+                         (partial (lazy-load-var 'cook.authorization/is-authorized?)
+                                  authorization-config))
      :authorization-middleware (fnk [[:config [:authorization {one-user false} {kerberos false} {http-basic false}]]]
-                                    (cond
-                                      http-basic
-                                      (let [validation (get http-basic :validation :none)
-                                            user-password-valid?
-                                            ((lazy-load-var 'cook.basic-auth/make-user-password-valid?) validation http-basic)]
-                                        (log/info "Using http basic authorization with validation" validation)
-                                        ((lazy-load-var 'cook.basic-auth/create-http-basic-middleware) user-password-valid?))
-
-                                      one-user
-                                      (do
-                                        (log/info "Using single user authorization")
-                                        (fn one-user-middleware [h]
-                                          (fn one-user-auth-wrapper [req]
-                                            (h (assoc req :authorization/user one-user)))))
-
-                                      kerberos
-                                      (do
-                                        (log/info "Using kerberos middleware")
-                                        (lazy-load-var 'cook.spnego/require-gss))
-                                      :else (throw (ex-info "Missing authorization configuration" {}))))
+                                 (cond
+                                   http-basic
+                                   (let [validation (get http-basic :validation :none)
+                                         user-password-valid?
+                                         ((lazy-load-var 'cook.basic-auth/make-user-password-valid?) validation http-basic)]
+                                     (log/info "Using http basic authorization with validation" validation)
+                                     ((lazy-load-var 'cook.basic-auth/create-http-basic-middleware) user-password-valid?))
+
+                                   one-user
+                                   (do
+                                     (log/info "Using single user authorization")
+                                     (fn one-user-middleware [h]
+                                       (fn one-user-auth-wrapper [req]
+                                         (h (assoc req :authorization/user one-user)))))
+
+                                   kerberos
+                                   (do
+                                     (log/info "Using kerberos middleware")
+                                     (lazy-load-var 'cook.spnego/require-gss))
+                                   :else (throw (ex-info "Missing authorization configuration" {}))))
      :rate-limit (fnk [[:config {rate-limit nil}]]
-                      (let [{:keys [user-limit-per-m]
-                             :or {user-limit-per-m 600}} rate-limit]
-                        {:user-limit (->UserRateLimit :user-limit user-limit-per-m (t/minutes 1))}))
+                   (let [{:keys [user-limit-per-m]
+                          :or {user-limit-per-m 600}} rate-limit]
+                     {:user-limit (->UserRateLimit :user-limit user-limit-per-m (t/minutes 1))}))
      :sim-agent-path (fnk [] "/usr/bin/sim-agent")
      :mesos-datomic-uri (fnk [[:config [:database datomic-uri]]]
-                             (when-not datomic-uri
-                               (throw (ex-info "Must set a the :database's :datomic-uri!" {})))
-                             datomic-uri)
+                          (when-not datomic-uri
+                            (throw (ex-info "Must set a the :database's :datomic-uri!" {})))
+                          datomic-uri)
      :dns-name simple-dns-name
      :hostname (fnk [] (.getCanonicalHostName (java.net.InetAddress/getLocalHost)))
      :local-zk-port (fnk [[:config [:zookeeper {local-port 3291}]]]
-                         local-port)
+                      local-port)
      :zookeeper-server (fnk [[:config [:zookeeper {local? false}]] local-zk-port]
-                            (when local?
-                              (log/info "Created local ZooKeeper; not yet started")
-                              (org.apache.curator.test.TestingServer. local-zk-port false)))
+                         (when local?
+                           (log/info "Created local ZooKeeper; not yet started")
+                           (org.apache.curator.test.TestingServer. local-zk-port false)))
      :zookeeper (fnk [[:config [:zookeeper {local? false} {connection nil}]] local-zk-port]
-                     (cond
-                       local? (str "localhost:" local-zk-port)
-                       connection connection
-                       :else (throw (ex-info "Must specify a zookeeper connection" {}))))
+                  (cond
+                    local? (str "localhost:" local-zk-port)
+                    connection connection
+                    :else (throw (ex-info "Must specify a zookeeper connection" {}))))
      :task-constraints (fnk [[:config [:scheduler {task-constraints nil}]]]
-                            ;; Trying to pick conservative defaults
-                            (merge
-                              {:timeout-hours 1
-                               :timeout-interval-minutes 1
-                               :retry-limit 20
-                               :memory-gb 12
-                               :cpus 4}
-                              task-constraints))
+                         ;; Trying to pick conservative defaults
+                         (merge
+                           {:timeout-hours 1
+                            :timeout-interval-minutes 1
+                            :retry-limit 20
+                            :memory-gb 12
+                            :cpus 4}
+                           task-constraints))
      :offer-incubate-time-ms (fnk [[:config [:scheduler {offer-incubate-ms 15000}]]]
-                                  offer-incubate-ms)
+                               offer-incubate-ms)
      :offer-cache (fnk [[:config [:scheduler {offer-cache nil}]]]
                     (merge
                       {:max-size 2000
                        :ttl-ms 15000}
                       offer-cache))
      :mea-culpa-failure-limit (fnk [[:config [:scheduler {mea-culpa-failure-limit nil}]]]
-                                   mea-culpa-failure-limit)
+                                mea-culpa-failure-limit)
      :fenzo-max-jobs-considered (fnk [[:config [:scheduler {fenzo-max-jobs-considered 1000}]]]
-                                     fenzo-max-jobs-considered)
+                                  fenzo-max-jobs-considered)
      :fenzo-scaleback (fnk [[:config [:scheduler {fenzo-scaleback 0.95}]]]
-                           fenzo-scaleback)
+                        fenzo-scaleback)
      :fenzo-floor-iterations-before-warn (fnk [[:config [:scheduler {fenzo-floor-iterations-before-warn 10}]]]
-                                              fenzo-floor-iterations-before-warn)
+                                           fenzo-floor-iterations-before-warn)
      :fenzo-floor-iterations-before-reset (fnk [[:config [:scheduler {fenzo-floor-iterations-before-reset 1000}]]]
-                                               fenzo-floor-iterations-before-reset)
+                                            fenzo-floor-iterations-before-reset)
      :mesos-gpu-enabled (fnk [[:config [:mesos {enable-gpu-support false}]]]
-                             (boolean enable-gpu-support))
+                          (boolean enable-gpu-support))
      :good-enough-fitness (fnk [[:config [:scheduler {good-enough-fitness 0.8}]]]
-                               good-enough-fitness)
+                            good-enough-fitness)
      :mesos-master (fnk [[:config [:mesos master]]]
-                        master)
+                     master)
      :mesos-master-hosts (fnk [[:config [:mesos master {master-hosts nil}]]]
-                              (if master-hosts
-                                (if (and (sequential? master-hosts) (every? string? master-hosts))
-                                  master-hosts
-                                  (throw (ex-info ":mesos-master should be a list of hostnames (e.g. [\"host1.example.com\", ...])" {})))
-                                (->> master
-                                     (re-seq #"[/|,]?([^/,:]+):\d+")
-                                     (mapv second))))
+                           (if master-hosts
+                             (if (and (sequential? master-hosts) (every? string? master-hosts))
+                               master-hosts
+                               (throw (ex-info ":mesos-master should be a list of hostnames (e.g. [\"host1.example.com\", ...])" {})))
+                             (->> master
+                                  (re-seq #"[/|,]?([^/,:]+):\d+")
+                                  (mapv second))))
      :mesos-failover-timeout (fnk [[:config [:mesos {failover-timeout-ms nil}]]]
-                                  failover-timeout-ms)
+                               failover-timeout-ms)
      :mesos-leader-path (fnk [[:config [:mesos leader-path]]]
-                             leader-path)
+                          leader-path)
      :mesos-principal (fnk [[:config [:mesos {principal nil}]]]
-                           principal)
+                        principal)
      :mesos-role (fnk [[:config [:mesos {role "*"}]]]
-                           role)
+                   role)
      :mesos-framework-name (fnk [[:config [:mesos {framework-name "Cook"}]]]
-                                framework-name)
+                             framework-name)
      ;:riemann-metrics (fnk [[:config [:metrics {riemann nil}]]]
      ;                  (when riemann
      ;                    (when-not (= 4 (count (select-keys riemann [:host :port])))
      ;                      (throw (ex-info "You must specify the riemann :host and :port!" riemann)))
      ;                    ((lazy-load-var 'cook.reporter/riemann-reporter) riemann)))
      :jmx-metrics (fnk [[:config [:metrics {jmx false}]]]
-                       (when jmx
-                         ((lazy-load-var 'cook.reporter/jmx-reporter))))
+                    (when jmx
+                      ((lazy-load-var 'cook.reporter/jmx-reporter))))
      :graphite-metrics (fnk [[:config [:metrics {graphite nil}]]]
-                            (when graphite
-                              (when-not (:host graphite)
-                                (throw (ex-info "You must specify the graphite host!" {:graphite graphite})))
-                              (let [config (merge {:port 2003 :pickled? true} graphite)]
-                                ((lazy-load-var 'cook.reporter/graphite-reporter) config))))
+                         (when graphite
+                           (when-not (:host graphite)
+                             (throw (ex-info "You must specify the graphite host!" {:graphite graphite})))
+                           (let [config (merge {:port 2003 :pickled? true} graphite)]
+                             ((lazy-load-var 'cook.reporter/graphite-reporter) config))))
      :riemann (fnk [[:config [:metrics {riemann nil}]]]
-                   riemann)
+                riemann)
      :riemann-metrics (fnk [[:config [:metrics {riemann nil}]]]
-                           (when riemann
-                             (when-not (:host riemann)
-                               (throw (ex-info "You must specific the :host to send the riemann metrics to!" {:riemann riemann})))
-                             (when-not (every? string? (:tags riemann))
-                               (throw (ex-info "Riemann tags must be a [\"list\", \"of\", \"strings\"]" riemann)))
-                             (let [config (merge {:port 5555
-                                                  :local-host (.getHostName
-                                                                (java.net.InetAddress/getLocalHost))}
-                                                 riemann)]
-                               ((lazy-load-var 'cook.reporter/riemann-reporter) config))))
+                        (when riemann
+                          (when-not (:host riemann)
+                            (throw (ex-info "You must specific the :host to send the riemann metrics to!" {:riemann riemann})))
+                          (when-not (every? string? (:tags riemann))
+                            (throw (ex-info "Riemann tags must be a [\"list\", \"of\", \"strings\"]" riemann)))
+                          (let [config (merge {:port 5555
+                                               :local-host (.getHostName
+                                                             (java.net.InetAddress/getLocalHost))}
+                                              riemann)]
+                            ((lazy-load-var 'cook.reporter/riemann-reporter) config))))

      :rebalancer (fnk [[:config {rebalancer nil}]]
-                      (merge {:interval-seconds 300
-                              :dru-scale 1.0}
-                             rebalancer))
+                   (merge {:interval-seconds 300
+                           :dru-scale 1.0}
+                          rebalancer))

      :nrepl-server (fnk [[:config [:nrepl {enabled? false} {port 0}]]]
-                        (when enabled?
-                          (when (zero? port)
-                            (throw (ex-info "You enabled nrepl but didn't configure a port. Please configure a port in your config file." {})))
-                          ((lazy-load-var 'clojure.tools.nrepl.server/start-server) :port port)))}))
+                     (when enabled?
+                       (when (zero? port)
+                         (throw (ex-info "You enabled nrepl but didn't configure a port. Please configure a port in your config file." {})))
+                       ((lazy-load-var 'clojure.tools.nrepl.server/start-server) :port port)))}))

 (defn- init-logger
   ([] (init-logger {:levels {"datomic.db" :warn
@@ -446,23 +446,23 @@
   ([{:keys [file] :or {file "log/cook.log"} {:keys [default] :or {default :info} :as overrides} :levels}]
    (try
      (.. (org.apache.log4j.Logger/getRootLogger)
-       (getLoggerRepository)
-       (resetConfiguration))
-   ;; This lets you inspect which loggers have which appenders turned on
-   ;;(clojure.pprint/pprint (map #(select-keys % [:allAppenders :name]) (log4j-conf/get-loggers)))
-   (let [overrides (->> overrides
-                        (filter (comp string? key))
-                        (mapcat (fn [[logger level]]
-                                  [[logger] {:level level}])))]
-     (apply log4j-conf/set-loggers!
-            (org.apache.log4j.Logger/getRootLogger)
-            {:out (org.apache.log4j.DailyRollingFileAppender.
-                    (org.apache.log4j.PatternLayout.
-                      "%d{ISO8601} %-5p %c [%t] - %m%n")
-                    file
-                    "'.'yyyy-MM-dd")
-             :level default}
-            overrides))
+         (getLoggerRepository)
+         (resetConfiguration))
+     ;; This lets you inspect which loggers have which appenders turned on
+     ;;(clojure.pprint/pprint (map #(select-keys % [:allAppenders :name]) (log4j-conf/get-loggers)))
+     (let [overrides (->> overrides
+                          (filter (comp string? key))
+                          (mapcat (fn [[logger level]]
+                                    [[logger] {:level level}])))]
+       (apply log4j-conf/set-loggers!
+              (org.apache.log4j.Logger/getRootLogger)
+              {:out (org.apache.log4j.DailyRollingFileAppender.
+                      (org.apache.log4j.PatternLayout.
+                        "%d{ISO8601} %-5p %c [%t] - %m%n")
+                      file
+                      "'.'yyyy-MM-dd")
+               :level default}
+              overrides))
      (catch Throwable t
        (.println System/err "Failed to initialize logging!")
        (.printCauseTrace t)
@@ -472,9 +472,9 @@
   "This configures logging and exception handling, to make the configuration phase simpler to understand"
   (graph/eager-compile
     {:exception-handler (fnk [[:config [:unhandled-exceptions {log-level :error} {email nil}]] logging]
-                             ((lazy-load-var 'cook.util/install-email-on-exception-handler) log-level email))
+                          ((lazy-load-var 'cook.util/install-email-on-exception-handler) log-level email))
      :logging (fnk [[:config log]]
-                   (init-logger log))}))
+                (init-logger log))}))

 (defn- env [name]
   (System/getenv name))
@@ -527,16 +527,16 @@
   (do
     (log4j-conf/set-loggers! (org.apache.log4j.Logger/getRootLogger)
                              {:level :info :out (org.apache.log4j.FileAppender.
-                                                 (org.apache.log4j.PatternLayout.
-                                                  "%d{ISO8601} %-5p %c [%t] - %m%n")
-                                                 "debug.log")}
+                                                  (org.apache.log4j.PatternLayout.
+                                                    "%d{ISO8601} %-5p %c [%t] - %m%n")
+                                                  "debug.log")}
                              ["datomic.peer"]
                              {:level :warn})
     (log/info "confirm we're online"))

   (log4j-conf/set-loggers! (org.apache.log4j.Logger/getRootLogger)
                            {:level :info :out (org.apache.log4j.ConsoleAppender.
-                                               (org.apache.log4j.PatternLayout.
-                                                "%d{ISO8601} %-5p %c [%t] - %m%n"))}
+                                                (org.apache.log4j.PatternLayout.
+                                                  "%d{ISO8601} %-5p %c [%t] - %m%n"))}
                            ["datomic.peer"]
                            {:level :warn}))


Removed tagged-tg8 problem

Removed tagged-tg8 problem

--- src/clojush/problems/integer_regression/tagged_tg8.clj
+++ src/clojush/problems/integer_regression/tagged_tg8.clj
@@ -1,59 +0,0 @@
-;; tagged-tg8.clj
-;; an example problem for clojush, a Push/PushGP system written in Clojure
-;; Lee Spector, lspector@hampshire.edu, 2010
-
-(ns clojush.problems.integer-regression.tagged-tg8
-  (:use [clojush.pushgp.pushgp]
-        [clojush.pushstate]
-        [clojush.interpreter]
-        [clojush.random]
-        [clojure.math.numeric-tower]
-        [clojush.instructions.tag]))
-
-;;;;;;;;;;;;
-;; Integer symbolic regression of the y=5x^6-2x^5-5x^3+3x^2+5. This uses
-;; the core integer arithmetic instructions and an input instruction that uses the input stack.
-;; This example also demonstrates  the use of fitness penalties for abnormally terminating programs.
-;; This is example 8 from the "trivial geography" chapter,
-;; http://hampshire.edu/lspector/pubs/trivial-geography-toappear.pdf
-;; (Hence the name tg8.)
-;; Also uses tags.
-
-(def argmap
-  {:error-function (fn [individual]
-                     (assoc individual
-                            :errors
-                            (doall
-                             (for [input (range 10)]
-                               (let [state (run-push (:program individual)
-                                                     (push-item input :input
-                                                                (push-item input :integer
-                                                                           (make-push-state))))
-                                     top-int (top-item :integer state)
-                                     invalid-output (or (not (number? top-int))
-                                                        (= (:termination state) :abnormal))]
-                                 (if invalid-output
-                                   10000000
-                                   (abs (- top-int
-                                           (+ (* 5 input input input input input input)
-                                              (* -2 input input input input input)
-                                              (* -5 input input input)
-                                              (* 3 input input)
-                                              5)))))))))
-   :atom-generators (concat
-                      '(integer_add integer_sub integer_mult integer_div)
-                      (list
-                        (fn [] (- (lrand-int 21) 10))
-                        (tag-instruction-erc [:exec :integer] 1000) ;; added for tagged version
-                        ;(untag-instruction-erc 1000) ;; added for tagged version
-                        (tagged-instruction-erc 1000) ;; added for tagged version
-                        'in1))
-   :tag-limit 1000
-   :parent-selection :tournament
-   :genetic-operator-probabilities {:alternation 0.5
-                                    :uniform-mutation 0.4
-                                    :uniform-close-mutation 0.1}
-   :max-points 400
-   :max-genome-size-in-initial-program 100
-   :population-size 5000
-   })


Removed code for alternative simulation computations

may be readded later.

Signed-off-by: Daniel Borchmann <25857343a15bf1edafebc2912e82ecf775c585c1@mailbox.tu-dresden.de>

--- src/conexp/contrib/dl/languages/description_graphs.clj
+++ src/conexp/contrib/dl/languages/description_graphs.clj
@@ -311,20 +311,6 @@
       [(make-tbox language #{(make-dl-definition 'All all)}), 'All])))

 ;;; simulations
-
-(defn- post
-  "Returns all neighbours of v in G, where the edges are labeled with
-  r."
-  [G r v]
-  (set-of x [[s x] ((neighbours G) v)
-	     :when (= r s)]))
-
-(defn- pre
-  "Returns all vertices in G which have v as its neighbour and whose
-  connecting edge is labeled with r."
-  [G r v]
-  (set-of w [w (vertices G)
-	     :when (contains? (post G r w) v)]))

 (defn- HashMap->hash-map
   "Converts a Java HashMap to a Clojure hash-map."
@@ -363,93 +349,6 @@
 	  (recur))))
     (HashMap->hash-map sim-sets)))

-
-;; refined (unfinished)
-
-(defn- refined-simulator-sets
-  "Implements RefinedSimliarity as presented by Henzinger, Henzinger
-  and Kopke, adapted for computing the maximal simulation between the
-  two description graphs G-1 and G-2."
-  [G-1 G-2]
-  (unsupported-operation "refined-simulator-sets not implemented.")
-  (let [neighbours-1 (neighbours G-1),
-	neighbours-2 (neighbours G-2),
-
-	label-1 (vertex-labels G-1),
-	label-2 (vertex-labels G-2),
-
-	#^HashMap prevsim  (HashMap.),
-	#^HashMap sim-sets (HashMap.)]
-    (doseq [v (vertices G-1)]
-      (.put prevsim v (vertices G-2))
-      (.put sim-sets v
-	    (if (empty? (neighbours-1 v))
-	      (set-of u [u (vertices G-2)
-			 :when (subset? (label-1 v) (label-2 u))])
-	      (set-of u [u (vertices G-2)
-			 :when (and (subset? (label-1 v) (label-2 u))
-				    (not (empty? (neighbours-2 u))))]))))
-    (loop []
-      (when-let [v (first (filter #(not= (.get sim-sets %)
-					 (.get prevsim %))
-				  (vertices G-1)))]
-	))))
-
-;; efficient (wrong)
-
-(defn- efficient-initialize
-  "Returns initialization for sim-sets and remove-sets for
-  EfficientSimliarity. Returns pair of sim-sets and remove-sets, both
-  as transient data structures."
-  [G-1 G-2]
-  (let [label-1      (vertex-labels G-1),
-	label-2      (vertex-labels G-2),
-
-	#^HashMap sim-sets    (HashMap.),
-	#^HashMap remove-sets (HashMap.)]
-    (doseq [v (vertices G-1)]
-      (.put sim-sets v
-	    (if (empty? (post G-1 v))
-	      (set-of u [u (vertices G-2),
-			 :when (subset? (label-1 v) (label-2 u))])
-	      (set-of u [u (vertices G-2),
-			 :when (and (subset? (label-1 v) (label-2 u))
-				    (not (empty? (post G-2 u))))])))
-      (.put remove-sets v
-	    (difference (set-of u [[u _ _] (edges G-2)])
-			(set-of u [[u _ w] (edges G-2)
-				   :when (contains? (.get sim-sets v) w)]))))
-    [sim-sets remove-sets]))
-
-(defn- efficient-simulator-sets
-  "Implements (as far as I can see) the EfficientSimilarity Algorithm
-  from \"Computing Simulations on Finite and Infinite Graphs\" by
-  Henzinger, Henzinger and Kopke, adapted for computing the maximal
-  simulation from G-1 to G-2."
-  [G-1 G-2]
-  (unsupported-operation "efficient-simulator-sets not implemented.")
-  (let [[#^HashMap sim-sets, #^HashMap remove-sets] (efficient-initialize G-1 G-2)]
-    (loop []
-      (let [v (first (filter (fn [v]
-			       (not (empty? (.get remove-sets v))))
-			     (vertices G-1)))]
-	(if-not v
-	  (HashMap->hash-map sim-sets)
-	  (do
-	    ;; u and v are vertices of G-1
-	    ;; w and x are vertices of G-2
-	    (doseq [u (pre G-1 v)]
-	      (doseq [w (.get remove-sets v)]
-		(when (contains? (.get sim-sets u) w)
-		  (.put sim-sets u
-			(disj (.get sim-sets u) w))
-		  (doseq [x (pre G-2 w)]
-		    (when (empty? (intersection (post G-2 x) (.get sim-sets u)))
-		      (.put remove-sets u
-			    (conj (.get remove-sets u) x)))))))
-	    (.put remove-sets v #{})
-	    (recur)))))))
-
 ;; simulation invocation point

 (defn simulates?


Remove debug code from edge.kick

Remove debug code from edge.kick

--- edge.kick/src/edge/kick/builder.clj
+++ edge.kick/src/edge/kick/builder.clj
@@ -25,7 +25,6 @@

 (defmethod ig/resume-key :edge.kick/builder
   [key opts old-opts old-impl]
-  (prn opts old-opts)
   (if (= opts old-opts)
     old-impl
     (do (ig/halt-key! key old-impl)


Added example of Table to devcard

Added example of Table to devcard


Add defcard-doc

Add defcard-doc

--- src-cljs/frontend/components/pieces/popover.cljs
+++ src-cljs/frontend/components/pieces/popover.cljs
@@ -1,6 +1,6 @@
 (ns frontend.components.pieces.popover
   (:require [clojure.string :as string]
-            [devcards.core :as dc :refer-macros [defcard]]
+            [devcards.core :as dc :refer-macros [defcard defcard-doc]]
             [frontend.components.pieces.button :as button]
             [frontend.components.pieces.icon :as icon]
             [goog.string :as gstring]
@@ -188,6 +188,19 @@
            children))

 (dc/do
+  (defcard-doc
+    "Simple tooltips and more complex popovers for displaying extended
+    information for things.
+
+    A simple popup provides extra information or operations on hover, focus
+    or click. Compared with tooltips, popovers can provide action elements
+    like links and buttons.
+
+    The tooltip shows on mouse enter and hides on mouse leave and doesn’t support
+    complex text. The default behavior in hover mode is to respond to clicks as
+    well. If you click, it \"pins\" the tooltip. Clicking again or clicking out
+    dismisses it, allowing tooltips to work on touch devices as well.")
+
   (def trigger
     (html
      [:div {:style {:width 32}}
@@ -210,17 +223,6 @@
                  trigger)))

   (defcard tooltip-and-popover-card
-    "Simple tooltips and more complex popovers for displaying extended
-    information for things.
-
-    A simple popup provide extra information or operations on hover, focus
-    or click. Compared with tooltips, popovers can provide action elements
-    like links and buttons.
-
-    The tooltip shows on mouse enter and hides on mouse leave and doesn’t support
-    complex text. The default behavior in hover mode is to respond to clicks as
-    well. If you click, it \"pins\" the tooltip. Clicking again or clicking out
-    dismisses it, allowing tooltips to work on touch devices as well."
     (fn [state]
       (html
        [:div {:style {:display "flex"


[#4779] fix Bootnodes are shown as enabled when they are not

--- src/status_im/ui/screens/profile/components/views.cljs
+++ src/status_im/ui/screens/profile/components/views.cljs
@@ -103,6 +103,6 @@
    [react/view styles/settings-item-text-wrapper
     [react/i18n-text {:style styles/settings-item-text :key label-kw}]]
    [react/switch {:on-tint-color   colors/blue
-                  :value           value
+                  :value           (boolean value)
                   :on-value-change action-fn
                   :disabled        (not active?)}]])


start the autobuilder before the nrepl starts

--- sidecar/src/figwheel_sidecar/repl.clj
+++ sidecar/src/figwheel_sidecar/repl.clj
@@ -365,8 +365,9 @@
     (or (not-empty build-ids) [(:id repl-build)])))

 (defn start-repl [build]
-  (let [{:keys [figwheel-server build-ids]} *autobuild-env*]
-    (start-autobuild build-ids)
+  (let [{:keys [figwheel-server build-ids state-atom]} *autobuild-env*]
+    (when-not (builder-running? state-atom)
+      (start-autobuild build-ids))
     (newline)
     (print "Launching ClojureScript REPL")
     (when-let [id (:id build)] (println " for build:" id))
@@ -430,6 +431,7 @@

 (defn run-autobuilder [{:keys [figwheel-options all-builds build-ids] :as options}]
   (binding [*autobuild-env* (create-autobuild-env options)]
+    (start-autobuild (:build-ids *autobuild-env*))
     (start-nrepl-server figwheel-options *autobuild-env*)
     (if (false? (:repl figwheel-options))
       (when (figwheel-sidecar.auto-builder/autobuild-ids *autobuild-env*)


Cleaned up nags

Cleaned up nags

--- test/layzee/integration/twitter_streaming_examples.clj
+++ test/layzee/integration/twitter_streaming_examples.clj
@@ -1,7 +1,7 @@
 (ns layzee.integration.twitter-streaming-examples
   (:use midje.sweet)
   (:require [clojure.test :refer :all]
-            [clojure.data.json :as json :refer :all]
+            [clojure.data.json :as json :refer [write-str]]
             [layzee.adapters.twitter.firehose :refer :all :as firehose]
             [layzee.adapters.settings :refer :all :as settings]
             [layzee.adapters.logging :refer :all]))
@@ -14,5 +14,5 @@
 (facts
  (fact "Can query a tweet"
        (let [result (firehose/get-tweet settings/oauth-credential "636438888567824384")]
-         (println (json/write-str result :value-fn (fn[k v] (str v))))))) ;; [!] https://groups.google.com/forum/#!topic/clojure-liberator/Vcsy1Pp_jMo
+         (println (json/write-str result :value-fn #(str %2)))))) ;; [!] https://groups.google.com/forum/#!topic/clojure-liberator/Vcsy1Pp_jMo


More aggressively catch exceptions

More aggressively catch exceptions

--- src/quark/tree_tokenizer.clj
+++ src/quark/tree_tokenizer.clj
@@ -22,13 +22,13 @@

 (defn expr-typename
   [node]
-  (let [expr-type (log-err (str "Exception getting expression type for [file node] "
-                                [(filename node) (tree-path node)]) nil
-                           (-> node .getExpressionType))]
-    (condp instance? expr-type
-        IProblemBinding "problem-binding"
-        IProblemType "problem-type"
-        (str expr-type))))
+  (log-err (str "Exception getting expression type for [file node] "
+                [(filename node) (tree-path node)]) "---exception---"
+           (let [expr-type (-> node .getExpressionType)]
+             (condp instance? expr-type
+               IProblemBinding "problem-binding"
+               IProblemType "problem-type"
+               (str expr-type)))))

 (defmulti to-poco "Convert IASTNode node to plain-old-clojure-object's" class)

@@ -59,10 +59,11 @@
           src-file (c-files src-path)
           :let [src-filename (.getAbsolutePath src-file)
                 out-filename (str (str/replace src-filename src-path out-path) ".edn")]]
-    ;(pprn src-filename)
     (clojure.java.io/make-parents out-filename)
     (->> src-filename parse-file to-edn (spit out-filename))))

 '((time-mins (src-dir-to-edn linux-path "tmp/src-to-edn/linux3")))

+'((time-mins (src-dir-to-edn linux-path "tmp/src-to-edn/linux4")))

+


ednize linux

ednize linux

--- src/quark/tree_tokenizer.clj
+++ src/quark/tree_tokenizer.clj
@@ -56,4 +56,4 @@
     (clojure.java.io/make-parents out-filename)
     (->> src-filename parse-file to-edn (spit out-filename))))

-'(src-dir-to-edn "~/opt/src/gcc/libgcc/soft-fp" "gcc-libgcc-softfp")
+'((src-dir-to-edn linux-path "tmp/src-to-edn/linux"))


log the storage and index hostname when starting the titan component

--- components/titan/src/gorillalabs/tesla/component/titan.clj
+++ components/titan/src/gorillalabs/tesla/component/titan.clj
@@ -1,23 +1,23 @@
 (ns gorillalabs.tesla.component.titan
-  (:require
-   [clojurewerkz.titanium.graph :as tg]
-   [clojure.tools.logging :as log]
-   [gorillalabs.tesla.component.configuration :as config]
-   [mount.core :as mnt]))
+  (:require [clojurewerkz.titanium.graph :as tg]
+            [clojure.tools.logging :as log]
+            [gorillalabs.tesla.component.configuration :as config]
+            [mount.core :as mnt]))

 (defn titan-config [config]
-  (merge {"storage.backend"  "cassandrathrift"
-          "index.search.backend" "lucene"
-          "index.search.directory" "/tmp/searchIndex"
-          "attributes.custom.attribute1.attribute-class" "clojure.lang.Keyword"
+  (merge {"storage.backend"                               "cassandrathrift"
+          "index.search.backend"                          "lucene"
+          "index.search.directory"                        "/tmp/searchIndex"
+          "attributes.custom.attribute1.attribute-class"  "clojure.lang.Keyword"
           "attributes.custom.attribute1.serializer-class" "hamburg.cypp.KeywordSerializer"}
          config))

 (defn- start []
-  (log/info "-> starting titan")
-  (let [server-config (titan-config (:titan config/configuration))
-        graph (tg/open server-config)]
-    graph))
+  (let [server-config (titan-config (:titan config/configuration))]
+    (log/infof "-> starting titan (storage @ %s, search index @ %s)"
+               (get server-config "storage.hostname" "[not set]")
+               (get server-config "index.search.hostname" "[not set]"))
+    (tg/open server-config)))

 (defn- stop [graph]
   (if graph
@@ -26,8 +26,6 @@
       (tg/close graph))
     (log/info "<- titan not running")))

-
 (mnt/defstate graph
               :start (start)
               :stop (stop graph))
-


debugger: on Reset also reset next-ids

debugger: on Reset also reset next-ids

--- examples/_common/middleware/devtools.cljs
+++ examples/_common/middleware/devtools.cljs
@@ -191,7 +191,7 @@

                ::on-reset
                (do
-                 (dispatch-action ::clear-history)
+                 (dispatch-action ::clear)
                  (dispatch-action ::replay))

                ::on-toggle-visibility
@@ -220,11 +220,6 @@
   (fn reconcile
     [model action]
     (match action
-           ::clear-history
-           (-> model
-               (assoc-in [::debugger :signal-events] (list))
-               (assoc-in [::debugger :action-events] (list)))
-
            [::record-signal-event signal-event]
            (-> model
                (update-in [::debugger :signal-events] concat [signal-event])
@@ -267,7 +262,9 @@
            ::clear
            (-> model
                (assoc-in [::debugger :signal-events] nil)
-               (assoc-in [::debugger :action-events] nil))
+               (assoc-in [::debugger :action-events] nil)
+               (assoc-in [::debugger :next-signal-id] 0)
+               (assoc-in [::debugger :next-action-id] 0))

            ::toggle-visibility
            (update-in model [::debugger :visible?] not)


(SERVER-547) Mount legacy-routes-service on "" in repl

Match up the user repl with the expected behavior of a production
system.

--- dev/user_repl.clj
+++ dev/user_repl.clj
@@ -42,7 +42,7 @@
      :web-router-service    {:puppetlabs.services.ca.certificate-authority-service/certificate-authority-service "/puppet-ca"
                              :puppetlabs.services.master.master-service/master-service "/puppet"
                              :puppetlabs.services.puppet-admin.puppet-admin-service/puppet-admin-service         "/admin"
-                             :puppetlabs.services.legacy-routes.legacy-routes-service/legacy-routes-service "/"}
+                             :puppetlabs.services.legacy-routes.legacy-routes-service/legacy-routes-service ""}
      :puppet-admin          {:client-whitelist       []
                              :authorization-required false}}))


made visibility-spec a part of view-model

--- examples/todomvc/src/app/todos.cljs
+++ examples/todomvc/src/app/todos.cljs
@@ -54,7 +54,7 @@

 ;;;;;;;;;;;;;;;;;;;;;;;; Control
 (defn control
-  [_model_ signal dispatch]
+  [_model signal dispatch]
   (match signal
          [:on-update-field val] (dispatch [:update-field val])
          :on-add (dispatch :add)
@@ -123,16 +123,9 @@
          (-remove-todos model :completed?)))

 ;;;;;;;;;;;;;;;;;;;;;;;; View model
-(def -visibility-spec
-  ; multiple tokens are supported mostly for :all case,
-  ; because on navigating to base url the token is "", but on clicking the link the token becomes "/"
-  [{:key :all :title "All" :href "#/" :tokens #{"" "/"}}
-   {:key :active :title "Active" :href "#/active" :tokens #{"/active"}}
-   {:key :completed :title "Completed" :href "#/completed" :tokens #{"/completed"}}])
-
 (defn -visibility
-  [model]
-  (if-let [result (->> -visibility-spec
+  [visibility-spec model]
+  (if-let [result (->> visibility-spec
                        (filter #(contains? (:tokens %) (::routing/token model)))
                        first
                        :key)]
@@ -140,18 +133,25 @@
     (do
       ; we don't use .error because PhantomJS somehow stops on it on running tests
       (.log js/console "ERROR: Could not determine visibility for token" (pr-str (::routing/token model)) ". Will use some default visibility.")
-      (-> -visibility-spec first :key))))
+      (-> visibility-spec first :key))))

 (defn view-model
   [model]
   ; reactions are extracted for better perfromance, e.g.:
   ; when input field changes most reactions will not be recalculated,
   ; because todos stay the same
-  (let [all-todos (reaction (:todos @model))
-        visibility (reaction (-visibility @model))]
+  (let [; Multiple tokens are supported mostly for :all case,
+        ; because on navigating to base url the token is "", but on clicking the link the token becomes "/".
+        ; Although it's always the same, the spec is made a reaction for consistency with other keys.
+        visibility-spec (reaction [{:key :all :title "All" :href "#/" :tokens #{"" "/"}}
+                                   {:key :active :title "Active" :href "#/active" :tokens #{"/active"}}
+                                   {:key :completed :title "Completed" :href "#/completed" :tokens #{"/completed"}}])
+        all-todos (reaction (:todos @model))
+        visibility (reaction (-visibility @visibility-spec @model))]
     (-> model
         (helpers/track-keys [:field])
-        (assoc :visibility visibility
+        (assoc :visibility-spec visibility-spec
+               :visibility visibility
                :has-todos? (reaction (-> @all-todos count pos?))
                :todos (reaction (filter (case @visibility
                                           :all (constantly true)
@@ -187,7 +187,7 @@

 (defn -view-todo-input
   "Note that |editing?| is passed only to trigger :component-did-update to set focus on the state change."
-  [_id_ _title_ _editing?_ _dispatch_]
+  [_id _title _editing? _dispatch]
   (r/create-class {:reagent-render
                    (fn [id title editing? dispatch]
                      [:input.edit {:value       title
@@ -209,7 +209,7 @@
                      (.focus (r/dom-node this)))}))

 (defn -view-todo
-  [{:keys [id title editing? completed?] :as _todo_} dispatch]
+  [{:keys [id title editing? completed?] :as _todo} dispatch]
   [:li {:class (cond editing? "editing" completed? "completed")}
    [:div.view
     [:input.toggle {:type      "checkbox"
@@ -236,13 +236,13 @@
       [-view-todo todo dispatch])]])

 (defn -view-footer
-  [active-count has-completed-todos? visibility dispatch]
+  [active-count has-completed-todos? visibility visibility-spec dispatch]
   [:footer.footer
    [:span.todo-count
     [:strong active-count] (str " " (if (= active-count 1) "item" "items")
                                 " left")]
    [:ul.filters
-    (for [{:keys [key title href]} -visibility-spec]
+    (for [{:keys [key title href]} visibility-spec]
       ^{:key key}
       [:li [:a
             {:href  href
@@ -253,7 +253,8 @@
      [:button.clear-completed {:on-click #(dispatch :on-clear-completed)} "Clear completed"])])

 (defn view
-  [{:keys [field has-todos? todos all-completed? active-count has-completed-todos? visibility] :as _view-model_}
+  [{:keys [field has-todos? todos all-completed? active-count has-completed-todos? visibility visibility-spec]
+    :as   _view-model}
    dispatch]
   [:section.todoapp
    [-view-header @field dispatch]
@@ -261,7 +262,7 @@
    (when @has-todos?
      [:div
       [-view-todo-list @todos @all-completed? dispatch]
-      [-view-footer @active-count @has-completed-todos? @visibility dispatch]])])
+      [-view-footer @active-count @has-completed-todos? @visibility @visibility-spec dispatch]])])

 ;;;;;;;;;;;;;;;;;;;;;;;; Start
 (defn on-start


Added stuff to do and a simple save fn.

Added stuff to do and a simple save fn.

--- nav-obj-splitter.clj
+++ nav-obj-splitter.clj
@@ -5,6 +5,13 @@
 (def type-id-map {"Table" 1 "Form" 2 "Report" 3 "Dataport" 4 "Codeunit" 5 "XMLport" 6 "MenuSuite" 7 "Page" 8})
 (def first-line-regex #"^OBJECT (.+) (\d+) (.+)")
 (def source-file-extension ".txt")
+
+;; Read big source file line by line.
+;; Check if line is first line of an NAV object.
+;; If so, than place that line and following lines on a "current object" stack.
+;; Check if the current line read is the "closing" line for the current object.
+;; If so , than place that line on the "stack" and send of the source for this
+;; one object to be parsed and saved in its own file.

 (defn parse-first-line
   "Parses meta data from the first line of the object source file."
@@ -20,6 +27,11 @@
   [object-metadata]
   (let [file-name (join "-" (map object-metadata [:type-id :type :id]))]
     (str file-name source-file-extension)))
+
+(defn save-single-source-file
+  "Saves the source code of one object in its own file."
+  [source file-name]
+  (spit file-name source))

 ; Some tests
 (def meta-data-example {:type-id 1 :type "Table" :id "70902" :name "Test Table (48)"})


Limit amount of users shown on front page

--- src-cljs/acha.cljs
+++ src-cljs/acha.cljs
@@ -263,7 +263,7 @@
   (let [ach-cnt (u/qmap '[:find  ?u (count ?a)
                           :where [?e :ach/achent ?a]
                                  [?e :ach/user ?u]] db)
-        users (->> users (sort-by #(ach-cnt (:db/id %) -1)) reverse)]
+        users (->> users (sort-by #(ach-cnt (:db/id %) -1)) reverse (take 40))]
     (s/html
       [:.users_pane.pane
         [:h1 "Users"]
@@ -398,6 +398,8 @@
             (profile "DB initialization"
               (reset! conn (d/init-db dump schema))
               (println "Pushed" (count (:eavt @conn)) "datoms")
+              (println (count (d/datoms @conn :aevt :user/name)) "users")
+              (println (count (d/datoms @conn :aevt :ach/sha1)) "achievements")
               (swap! state assoc
                 :first-load? false
                 :progress 1))


Ensure layouts loaded for markdown parser spec.

--- spec/incise/parsers/markdown_spec.clj
+++ spec/incise/parsers/markdown_spec.clj
@@ -1,8 +1,9 @@
 (ns incise.parsers.markdown-spec
   (:require [speclj.core :refer :all]
             [clojure.java.io :refer [file resource]]
-            [incise.parsers.core :as pc]
-            [incise.parsers.markdown :refer :all])
+            [incise.core] ; Ensure that layouts have been loaded
+            (incise.parsers [core :as pc]
+                            [markdown :refer :all]))
   (:import [java.io File]))

 (describe "parsing"


whitespace

whitespace

--- src-cljs/frontend/components/app.cljs
+++ src-cljs/frontend/components/app.cljs
@@ -173,14 +173,18 @@
                   (common/icon :times)]
                  [:article {:on-click #(.stopPropagation :overlay-info-toggled)}
                   [:h1 "What's this?"]
-                  [:p "Precursor is a collaborative idea tool.
-                      Think of it as a notebook with infinite pages – use it to create sketches, rapid prototypes, notes, and everything in between.
-                      Share your URL to collaborate and you'll instantly have multiple people working in the same document.
-                      It's still a work in progress, so if you have feedback or a great idea for us sketch it up and ping "
-                      [:a {:on-click #(cast! :chat-link-clicked)
-                           :role "button"}
-                       "@prcrsr"]
-                      " in the chat."]
+                  [:p
+                   "Precursor is a collaborative idea tool. "
+                   "Think of it as a notebook with infinite pages – use it to create sketches, "
+                   "rapid prototypes, notes, and everything in between. "
+                   "Share your URL to collaborate and you'll instantly have multiple people "
+                   "working in the same document. "
+                   "It's still a work in progress, so if you have feedback or a great idea "
+                   "for us sketch it up and ping "
+                   [:a {:on-click #(cast! :chat-link-clicked)
+                        :role "button"}
+                    "@prcrsr"]
+                   " in the chat."]
                   [:div.info-buttons
                    [:button.info-okay {:on-click #(cast! :overlay-info-toggled)}
                     "Okay, sounds good."]


Move top bar behind a different feature flag

--- src-cljs/frontend/components/app.cljs
+++ src-cljs/frontend/components/app.cljs
@@ -145,7 +145,7 @@
                                :class (when (feature/enabled? :ui-v2)
                                         "new-app-main-margin")}

-               (when (and inner? logged-in? (feature/enabled? :ui-v2))
+               (when (and inner? logged-in? (feature/enabled? :ui-fp-top-bar))
                  (om/build top-nav/top-nav app-without-container-data))

                (when show-inspector?


wrap with viewer-controls class

wrap with viewer-controls class

--- src-cljs/frontend/components/hud.cljs
+++ src-cljs/frontend/components/hud.cljs
@@ -286,17 +286,18 @@
                   (common/icon :user (when show-mouse? {:path-props {:className color-class}}))]
                  [:div.viewer-name.viewer-tag
                   id-str]
-                 (when (:recording sub)
-                   [:div.viewer-symbols.holo
-                    [:div.viewer-symbol
-                     (volume-icon (get-in sub [:recording :media-stream-volume] 0) color-class)]])
-                 [:div.viewer-toggles
-                  [:a.viewer-toggle
-                   {:key id
-                    :on-click #(cast! :chat-user-clicked {:id-str id-str})
-                    :role "button"
-                    :title "Ping this viewer in chat."}
-                   (common/icon :at)]]])]])
+                 [:div.viewer-controls
+                  (when (:recording sub)
+                    [:div.viewer-symbols.holo
+                     [:div.viewer-symbol
+                      (volume-icon (get-in sub [:recording :media-stream-volume] 0) color-class)]])
+                  [:div.viewer-toggles
+                   [:a.viewer-toggle
+                    {:key id
+                     :on-click #(cast! :chat-user-clicked {:id-str id-str})
+                     :role "button"
+                     :title "Ping this viewer in chat."}
+                    (common/icon :at)]]]])]])

           [:a.hud-viewers.hud-item.hud-toggle
            {:on-click (if show-viewers?


another try at setting srcObject on audio

--- src-cljs/frontend/components/rtc.cljs
+++ src-cljs/frontend/components/rtc.cljs
@@ -2,6 +2,21 @@
   (:require [frontend.utils :as utils]
             [om.core :as om]
             [om.dom :as dom]))
+
+(defn audio [stream owner]
+  (reify
+    om/IDidMount
+    (did-mount [_]
+      (when-let [audio (om/get-node owner "audio")]
+        (aset audio "srcObject" stream)))
+    om/IDidUpdate
+    (did-update [_ _ _]
+      (when-let [audio (om/get-node owner "audio")]
+        (aset audio "srcObject" stream)))
+    om/IRender
+    (render [_]
+      (dom/audio #js {:autoPlay true
+                      :ref "audio"}))))

 (defn rtc [app owner]
   (reify
@@ -11,6 +26,6 @@
       (apply dom/div nil
              (for [{:keys [stream]} (vals (get-in app [:subscribers :info]))
                    :when stream]
-               (dom/audio #js {:autoPlay true
-                               :key (aget stream "id")
-                               :ref (fn [r] (when r (aset r "srcObject" stream)))}))))))
+               (om/build audio
+                         stream
+                         {:react-key (aget stream "id")}))))))


add test for Mushin No Shin

add test for Mushin No Shin

--- src/clj/test/cards-operations.clj
+++ src/clj/test/cards-operations.clj
@@ -85,6 +85,32 @@
       (prompt-choice :corp 0) ; default trace
       (prompt-choice :runner 0) ; Runner won't match
       (is (= 6 (:tag (get-runner))) "Runner took 6 tags"))))
+
+(deftest mushin-no-shin
+  "Mushin No Shin - Add 3 advancements to a card; prevent rez/score of that card the rest of the turn"
+  (do-game
+    (new-game (default-corp [(qty "Mushin No Shin" 2) (qty "Ronin" 1) (qty "Profiteering" 1)])
+              (default-runner))
+    (play-from-hand state :corp "Mushin No Shin")
+    (prompt-select :corp (find-card "Ronin" (:hand (get-corp))))
+    (let [ronin (get-content state :remote1 0)]
+      (is (= 3 (:advance-counter (refresh ronin))) "3 advancements placed on Ronin")
+      (core/rez state :corp (refresh ronin))
+      (is (not (get-in (refresh ronin) [:rezzed])) "Ronin did not rez")
+      (take-credits state :corp)
+      (take-credits state :runner)
+      (core/rez state :corp (refresh ronin))
+      (is (get-in (refresh ronin) [:rezzed]) "Ronin now rezzed")
+      (play-from-hand state :corp "Mushin No Shin")
+      (prompt-select :corp (find-card "Profiteering" (:hand (get-corp))))
+      (let [prof (get-content state :remote2 0)]
+        (core/score state :corp (refresh prof))
+        (is (empty? (:scored (get-corp))) "Profiteering not scored")
+        (is (= 0 (:agenda-point (get-corp))))
+        (take-credits state :corp)
+        (take-credits state :runner)
+        (core/score state :corp (refresh prof))
+        (is (= 1 (:agenda-point (get-corp))) "Profiteering was able to be scored")))))

 (deftest neural-emp
   "Neural EMP - Play if Runner made a run the previous turn to do 1 net damage"


Fiz reset and load game state bugs

Fiz reset and load game state bugs

--- src/cljs/battle_console/game.cljs
+++ src/cljs/battle_console/game.cljs
@@ -11,6 +11,7 @@
   [data]
   (state/set-state :loading-game nil)
   (state/set-state :player-code (get-in data ["viewed-by" "player-code"]))
+  (state/set-state :original-game-data data)
   (state/set-state :game-data data))

 (defn- error-loading
@@ -56,23 +57,26 @@
 (defn- game-stash
   "Shows the current stash if available"
   [game]
-  (let [stash (get-stash game)]
+  (let [stash (get-stash (state/get-state :game-data))]
     (dom/div #js {:className "row"}
       (dom/div #js {:className "col-lg-3"}
         (dom/div #js {:className "bs-component"}
-          (apply dom/table #js {:className "table table-striped table-hover"}
+          (dom/table #js {:className "table table-striped table-hover"}
             (dom/caption nil "Stash")
-            (dom/tr nil
-              (dom/th nil "Unit")
-              (dom/th nil "Quantity"))
-            (for [[unit quantity] stash]
+            (apply dom/tbody nil
               (dom/tr nil
-                (dom/td nil unit)
-                (dom/td nil quantity)))))))))
+                (dom/th nil "Unit")
+                (dom/th nil "Quantity"))
+              (for [[unit quantity] stash]
+                (dom/tr nil
+                  (dom/td nil unit)
+                  (dom/td nil quantity))))))))))

 (defn- render-board-cell
   "Renders a board's cell"
   [game x y]
+  (let [element (get-in game ["board" "elements"])]
+    #_(println element))
   (dom/p #js {:className "boardCoords"} (str "[" x " " y "]")))

 (defn- render-board
@@ -117,6 +121,7 @@
 (defn- reset-actions
   "Reset the current actions being applied"
   []
+  (state/set-state :game-data (state/get-state :original-game-data))
   (state/set-state :current-actions []))

 (defn- action-added
@@ -125,11 +130,13 @@
   (let [actions (or (state/get-state :current-actions) [])
         current-action (state/get-state :processing-action)
         new-actions (conj actions current-action)
-        current-game (state/get-state :game-data)]
-    (println data)
-    (state/set-state :game-data (assoc current-game "battle" (get data "board")))
+        current-game (state/get-state :game-data)
+        updated-game (assoc current-game "battle" (get data "board"))]
+    (println updated-game)
+    (state/set-state :game-data updated-game)
     (state/set-state :current-actions new-actions)
-    (state/set-state :processing-action nil)))
+    (state/set-state :processing-action nil)
+    ))

 (defn- error-loading-action
   "Error loading action"
@@ -142,7 +149,7 @@
   (let [action (reader/read-string (get-action))
         current-actions (or (state/get-state :current-actions) [])
         new-actions (conj current-actions action)
-        game (-> (state/get-state :game-data)
+        game (-> (state/get-state :original-game-data)
                  (assoc :actions new-actions))
         jsgame (js/encodeURIComponent (.stringify js/JSON (clj->js game)))
         url (str "http://rules.api.orionsbelt.eu/game/turn/p1?context=" jsgame)]


Avoid re-rendering the welcome/finished message

--- src/cljs/cljs_repl_web/views.cljs
+++ src/cljs/cljs_repl_web/views.cljs
@@ -893,7 +893,9 @@

 (defn repl-component [console-key opts]
   (let [media-query (subscribe [:media-query-size])
-        console (console/console console-key opts)]
+        console (console/console console-key opts)
+        welcome-dialog (welcome-modal-dialog console-key)
+        finished-dialog (finished-tour-modal-dialog console-key)]
     (fn repl-component-form2 []
       (let [children [[cljs-buttons]
                       [v-box
@@ -908,8 +910,8 @@
                         [console]]]
                       [re-complete/completions console-key #(do (dispatch [:console-set-autocompleted-text console-key])
                                                                 (dispatch [:focus-console-editor console-key]))]
-                      [welcome-modal-dialog console-key]
-                      [finished-tour-modal-dialog console-key]]]
+                      [welcome-dialog]
+                      [finished-dialog]]]
         (if (= :narrow @media-query)
           [v-box
            :size "1 1 auto"