diff --git a/README.md b/README.md index 06a691f..ddb5c04 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ mount is an alternative to the [component](https://github.com/stuartsierra/compo ## How ```clojure -(require '[mount :refer [defstate]]) +(require '[mount.core :refer [defstate]]) ``` ### Creating State @@ -126,7 +126,7 @@ There are of course direct dependecies that `mount` respects: ```clojure (ns app.config - (:require [mount :refer [defstate]])) + (:require [mount.core :refer [defstate]])) (defstate app-config :start (load-config "test/resources/config.edn")) @@ -136,7 +136,7 @@ this `app-config`, being top level, can be used in other namespaces, including t ```clojure (ns app.database - (:require [mount :refer [defstate]] + (:require [mount.core :refer [defstate]] [app.config :refer [app-config]])) (defstate conn :start (create-connection app-config)) @@ -151,6 +151,8 @@ is an example of a Datomic connection that "depends" on a similar `app-config`. accordingly: i.e. will call their `:start` and `:stop` defined functions. Hence the whole applicatoin state can be reloaded in REPL e.g.: ``` +dev=> (require '[mount.core :as mount]) + dev=> (mount/stop) dev=> (mount/start) ``` diff --git a/dev/dev.clj b/dev/dev.clj index 7988ca9..74ca616 100644 --- a/dev/dev.clj +++ b/dev/dev.clj @@ -15,7 +15,7 @@ [clojure.tools.namespace.repl :as tn] [check.parts-test] [check.start-with-test] - [mount] + [mount.core :as mount] [app :refer [create-nyse-schema find-orders add-order]])) ;; <<<< replace this your "app" namespace(s) you want to be available at REPL time (defn start [] diff --git a/project.clj b/project.clj index beac838..45df449 100644 --- a/project.clj +++ b/project.clj @@ -4,7 +4,7 @@ :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} - :source-paths ["src" "src/mount"] + :source-paths ["src"] :dependencies [[org.clojure/clojure "1.7.0"] [ch.qos.logback/logback-classic "1.1.3"] diff --git a/src/mount/mount.clj b/src/mount/core.clj similarity index 99% rename from src/mount/mount.clj rename to src/mount/core.clj index 1ab46f5..f974a15 100644 --- a/src/mount/mount.clj +++ b/src/mount/core.clj @@ -1,4 +1,4 @@ -(ns mount +(ns mount.core (:require [clojure.tools.macro :as macro] [clojure.tools.namespace.repl :refer [disable-reload!]] [clojure.tools.logging :refer [info warn debug error]])) diff --git a/test/app/app.clj b/test/app/app.clj index 20c9eac..f529c95 100644 --- a/test/app/app.clj +++ b/test/app/app.clj @@ -1,7 +1,7 @@ (ns app (:require [datomic.api :as d] [clojure.tools.nrepl.server :refer [start-server stop-server]] - [mount :refer [defstate]] + [mount.core :as mount :refer [defstate]] [app.utils.datomic :refer [touch]] [app.config :refer [app-config]] [app.nyse :as nyse])) diff --git a/test/app/config.clj b/test/app/config.clj index e387049..1e18a59 100644 --- a/test/app/config.clj +++ b/test/app/config.clj @@ -1,5 +1,5 @@ (ns app.config - (:require [mount :refer [defstate]] + (:require [mount.core :as mount :refer [defstate]] [clojure.edn :as edn] [clojure.tools.logging :refer [info]])) diff --git a/test/app/nyse.clj b/test/app/nyse.clj index 0a08019..649dfad 100644 --- a/test/app/nyse.clj +++ b/test/app/nyse.clj @@ -1,5 +1,5 @@ (ns app.nyse - (:require [mount :refer [defstate]] + (:require [mount.core :as mount :refer [defstate]] [datomic.api :as d] [clojure.tools.logging :refer [info]] [app.config :refer [app-config]])) diff --git a/test/check/parts_test.clj b/test/check/parts_test.clj index 43a8617..a8c506f 100644 --- a/test/check/parts_test.clj +++ b/test/check/parts_test.clj @@ -1,5 +1,5 @@ (ns check.parts-test - (:require [mount :refer [defstate] :as m] + (:require [mount.core :as mount :refer [defstate] :as m] [app.nyse :refer [conn]] [clojure.test :refer :all])) @@ -14,4 +14,4 @@ (deftest start-only-parts (is (instance? datomic.peer.LocalConnection conn)) - (is (instance? mount.NotStartedState should-not-start))) + (is (instance? mount.core.NotStartedState should-not-start))) diff --git a/test/check/start_with_test.clj b/test/check/start_with_test.clj index a62846d..c9bf2f9 100644 --- a/test/check/start_with_test.clj +++ b/test/check/start_with_test.clj @@ -1,5 +1,5 @@ (ns check.start-with-test - (:require [mount :refer [defstate] :as m] + (:require [mount.core :as mount :refer [defstate]] [app.config :refer [app-config]] [app.nyse :refer [conn]] [app :refer [nrepl]] @@ -13,15 +13,15 @@ (deftest start-with (testing "should start with substitutes" - (let [_ (m/start-with {#'app.nyse/conn #'check.start-with-test/test-conn - #'app/nrepl #'check.start-with-test/test-nrepl})] + (let [_ (mount/start-with {#'app.nyse/conn #'check.start-with-test/test-conn + #'app/nrepl #'check.start-with-test/test-nrepl})] (is (map? app-config)) (is (vector? nrepl)) (is (= conn 42)) (mount/stop))) (testing "should start normally after start-with" - (let [_ (m/start)] + (let [_ (mount/start)] (is (map? app-config)) (is (instance? clojure.tools.nrepl.server.Server nrepl)) (is (instance? datomic.peer.LocalConnection conn)) @@ -30,11 +30,11 @@ (mount/stop))) (testing "should start-without normally after start-with" - (let [_ (m/start-without #'check.start-with-test/test-conn - #'check.start-with-test/test-nrepl)] + (let [_ (mount/start-without #'check.start-with-test/test-conn + #'check.start-with-test/test-nrepl)] (is (map? app-config)) (is (instance? clojure.tools.nrepl.server.Server nrepl)) (is (instance? datomic.peer.LocalConnection conn)) - (is (instance? mount.NotStartedState test-conn)) - (is (instance? mount.NotStartedState test-nrepl)) + (is (instance? mount.core.NotStartedState test-conn)) + (is (instance? mount.core.NotStartedState test-nrepl)) (mount/stop)))) diff --git a/test/check/start_without_test.clj b/test/check/start_without_test.clj index f99264c..1459dae 100644 --- a/test/check/start_without_test.clj +++ b/test/check/start_without_test.clj @@ -1,5 +1,5 @@ (ns check.start-without-test - (:require [mount :as m] + (:require [mount.core :as m] [app.config :refer [app-config]] [app.nyse :refer [conn]] [app :refer [nrepl]] @@ -14,5 +14,5 @@ (deftest start-without-states (is (map? app-config)) - (is (instance? mount.NotStartedState nrepl)) - (is (instance? mount.NotStartedState conn))) + (is (instance? mount.core.NotStartedState nrepl)) + (is (instance? mount.core.NotStartedState conn)))