diff --git a/.gitignore b/.gitignore index 10ab477..7f22d8e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,10 @@ /target /classes /checkouts -pom.xml +.cpcache/ +.rebel_readline_history +cljs-test-runner-out +node_modules pom.xml.asc .repl* dev/resources/public/js/* diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..27d1fc5 --- /dev/null +++ b/Makefile @@ -0,0 +1,31 @@ +.PHONY: clean test jar tag outdated install deploy tree repl + +clean: + rm -rf target + rm -rf classes + +jar: clean test tag + clojure -A:jar + +test: clean + clojure -X:test :patterns '[".*"]' # clojure tests + # clojure -Atest-cljs -r ".*test.self.host.*" # clojure script tests + # run "j8; boot test-cljs" until running cljs tests via deps.edn is fixed + +outdated: + clojure -M:outdated + +tag: + clojure -A:tag + +install: jar + clojure -A:install + +deploy: jar + clojure -A:deploy + +tree: + mvn dependency:tree + +repl: + clojure -A:dev -A:repl diff --git a/README.md b/README.md index 1c52fe6..f1db914 100644 --- a/README.md +++ b/README.md @@ -103,7 +103,7 @@ That is pretty much it. But wait, there is more.. this state is _a top level bei `required` by other namespaces or in REPL: ```clojure -dev=> (require '[app.nyse :refer [conn]]) +dev=> (require '[app.db :refer [conn]]) nil dev=> conn #object[datomic.peer.LocalConnection 0x1661a4eb "datomic.peer.LocalConnection@1661a4eb"] diff --git a/build.boot b/build.boot index c9fd21a..95ee1f6 100644 --- a/build.boot +++ b/build.boot @@ -1,7 +1,17 @@ (def +version+ "0.1.18") +;; -- since boot is no more, this file will go away +;; -- once deps.edn "learns" how to run all cljs tests + +;; j8; boot test +;; j8; boot test-cljs +;; j8; boot test-cljs-advanced +;; j8; boot -v build-jar push-snapshot +;; j8; boot -v build-jar push-release + (set-env! :source-paths #{"src"} + :resource-paths #{"resources"} :dependencies '[;; mount brings _NO DEPENDENCIES_, everything here is for ;; mount dev, examples apps and tests diff --git a/deps.edn b/deps.edn new file mode 100644 index 0000000..07ac3c6 --- /dev/null +++ b/deps.edn @@ -0,0 +1,52 @@ +{:paths ["src" "resources"] + + :deps {} ;; deps no deps + + :aliases {:dev {:extra-deps {metosin/jsonista {:mvn/version "0.3.8"} + com.datomic/datomic-free {:mvn/version "0.9.5359" + :exclusions [joda-time/joda-time]} + org.clojure/tools.nrepl {:mvn/version "0.2.12"} + org.clojure/tools.namespace {:mvn/version "0.2.11"} + cheshire/cheshire {:mvn/version "5.5.0"} + compojure/compojure {:mvn/version "1.5.0"} + ring/ring-jetty-adapter {:mvn/version "1.1.0"} + robert/hooke {:mvn/version "1.3.0"} + proto-repl/proto-repl {:mvn/version "0.3.1"} + proto-repl-charts/proto-repl-charts {:mvn/version "0.3.2"} + nrepl/nrepl {:mvn/version "0.7.0"}}} + :test {:extra-paths ["test/core" "test/clj" "test/cljs" "test/resources"] + :extra-deps {com.datomic/datomic-free {:mvn/version "0.9.5359" + :exclusions [joda-time/joda-time]} + org.clojure/tools.nrepl {:mvn/version "0.2.12"} + robert/hooke {:mvn/version "1.3.0"} + org.clojure/tools.logging {:mvn/version "1.3.0"} + io.github.cognitect-labs/test-runner {:git/url "https://github.com/cognitect-labs/test-runner.git" + :sha "e7660458ce25bc4acb4ccc3e2415aae0a4907198"}} + :main-opts ["-m" "cognitect.test-runner"] + :exec-fn cognitect.test-runner.api/test} + :test-cljs {:extra-paths ["test/core" "test/cljs" "test/resources"] + :extra-deps {org.clojure/clojure {:mvn/version "1.8.0"} + org.clojure/clojurescript {:mvn/version "1.7.228"} + com.andrewmcveigh/cljs-time {:mvn/version "0.3.14"} + hiccups/hiccups {:mvn/version "0.3.0"} + datascript/datascript {:mvn/version "0.15.0"} + olical/cljs-test-runner {:mvn/version "3.8.1"}} + :main-opts ["-m" "cljs-test-runner.main"]} + :repl {:extra-paths ["dev/clj"] + :extra-deps {cider/cider-nrepl {:mvn/version "0.22.4"} + org.clojure/tools.logging {:mvn/version "1.2.4"} + com.bhauman/rebel-readline {:mvn/version "0.1.4"}} + :main-opts ["-e" "(require 'dev)(in-ns 'dev)" + "-m" "nrepl.cmdline" "--middleware" "[cider.nrepl/cider-middleware]" + "-i" "-f" "rebel-readline.main/-main"]} + :outdated {:extra-deps {olical/depot {:mvn/version "2.0.1"}} + :main-opts ["-m" "depot.outdated.main" "-a" "outdated"]} + :tag {:extra-deps {tolitius/tag {:mvn/version "0.1.7"}} + :main-opts ["-m" "tag.core" "tolitius/mount" "managing Clojure and ClojureScript app state since (reset)"]} + :jar {:extra-deps {seancorfield/depstar {:mvn/version "1.1.128"}} + :extra-paths ["target/about"] + :main-opts ["-m" "hf.depstar.jar" "target/mount.jar" "--exclude" "clojure/core/specs/alpha.*"]} + :deploy {:extra-deps {deps-deploy/deps-deploy {:mvn/version "RELEASE"}} + :main-opts ["-m" "deps-deploy.deps-deploy" "deploy" "target/mount.jar"]} + :install {:extra-deps {deps-deploy/deps-deploy {:mvn/version "RELEASE"}} + :main-opts ["-m" "deps-deploy.deps-deploy" "install" "target/mount.jar"]}}} diff --git a/dev/clj/dev.clj b/dev/clj/dev.clj index d40d96d..8a5f428 100644 --- a/dev/clj/dev.clj +++ b/dev/clj/dev.clj @@ -1,7 +1,6 @@ (ns dev (:require [clojure.pprint :refer [pprint]] [clojure.tools.namespace.repl :as tn] - [boot.core :refer [load-data-readers!]] [mount.core :as mount :refer [defstate]] [mount.tools.graph :refer [states-with-deps]] [app.utils.logging :refer [with-logging-status]] @@ -41,4 +40,11 @@ (tn/refresh :after 'dev/go)) (mount/in-clj-mode) + +(defn load-data-readers! + "Refresh *data-readers* with readers from newly acquired dependencies." + [] + (#'clojure.core/load-data-readers) + (set! *data-readers* (.getRawRoot #'*data-readers*))) + (load-data-readers!) diff --git a/dev/clj/proto_play.clj b/dev/clj/proto_play.clj index 580b8b9..ffbc5c8 100644 --- a/dev/clj/proto_play.clj +++ b/dev/clj/proto_play.clj @@ -1,5 +1,5 @@ (ns proto-play - (:require [mount.tools.graph :as mount] + (:require [mount.tools.graph :as mg] [proto-repl-charts.graph :as proto])) (defn mount->proto [graph] @@ -10,6 +10,6 @@ {} graph)) -(->> (mount/states-with-deps) +(->> (mg/states-with-deps) mount->proto (proto/graph "a proto graph of mount states")) diff --git a/package.json b/package.json index 20c6406..742aab4 100644 --- a/package.json +++ b/package.json @@ -8,14 +8,16 @@ "url": "https://github.com/tolitius/mount" }, "author": { - "name" : "tolitius", - "url" : "http://www.dotkam.com" - } - , + "name": "tolitius", + "url": "http://www.dotkam.com" + }, "files": [ "src/*" ], "directories": { "lib": "src" + }, + "dependencies": { + "ws": "^8.16.0" } } diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..5996f22 --- /dev/null +++ b/pom.xml @@ -0,0 +1,45 @@ + + + 4.0.0 + jar + mount + mount + 0.1.19-SNAPSHOT + mount + managing Clojure and ClojureScript app state since (reset) + https://github.com/tolitius/mount + + + Eclipse Public License + http://www.eclipse.org/legal/epl-v10.html + + + + + tolitius + + + + https://github.com/tolitius/mount + scm:git:git://github.com/tolitius/mount.git + scm:git:ssh://git@github.com/tolitius/mount.git + HEAD + + + + org.clojure + clojure + 1.11.1 + provided + + + + src + + + + clojars + https://repo.clojars.org/ + + + diff --git a/test/core/mount/test_self_host.cljs b/test/core/mount/test_self_host.cljs index 006c5fc..79635fd 100644 --- a/test/core/mount/test_self_host.cljs +++ b/test/core/mount/test_self_host.cljs @@ -5,12 +5,24 @@ mount.test.fun-with-values mount.test.private-fun mount.test.printing + mount.test.parts + mount.test.cleanup-dirty-states + mount.test.stop-except + mount.test.start-without + mount.test.start-with + mount.test.start-with-states )) (t/run-tests 'mount.test.fun-with-values 'mount.test.private-fun 'mount.test.printing + 'mount.test.parts + 'mount.test.cleanup-dirty-states + ;; 'mount.test.stop-except ;; TODO: can't run with deps.edn (due to "WebSocket is not defined") + ;; 'mount.test.start-with ;; boot, lein have no problems + ;; 'mount.test.start-with-states ;; most likely somm misconfigured in node.. + 'mount.test.start-without ) (defn run-tests []