adding nrepl; (stop) before tn/refresh(es)

This commit is contained in:
anatoly 2015-10-21 07:32:51 -04:00
parent 4748a7ff97
commit a5f2fa6cb3
4 changed files with 29 additions and 6 deletions

View file

@ -12,7 +12,7 @@
[clojure.string :as str] [clojure.string :as str]
[clojure.test :as test] [clojure.test :as test]
;; [clojure.core.async :refer [>!! <!! >! <! go-loop alt! timeout]] ;; [clojure.core.async :refer [>!! <!! >! <! go-loop alt! timeout]]
[clojure.tools.namespace.repl :refer [refresh refresh-all]] [clojure.tools.namespace.repl :as tn]
[mount :as app] [mount :as app]
[app :refer :all])) ;; <<<< replace this your "app" namespace(s) you want to be available at REPL time [app :refer :all])) ;; <<<< replace this your "app" namespace(s) you want to be available at REPL time
@ -22,6 +22,14 @@
(defn stop [] (defn stop []
(app/stop)) (app/stop))
(defn refresh []
(stop)
(tn/refresh))
(defn refresh-all []
(stop)
(tn/refresh-all))
(defn go (defn go
"Initializes and starts the system running." "Initializes and starts the system running."
[] []
@ -32,4 +40,4 @@
"Stops the system, reloads modified source files, and restarts it." "Stops the system, reloads modified source files, and restarts it."
[] []
(stop) (stop)
(refresh :after 'dev/go)) (tn/refresh :after 'dev/go))

View file

@ -7,11 +7,12 @@
:source-paths ["src" "src/mount"] :source-paths ["src" "src/mount"]
:dependencies [[org.clojure/clojure "1.7.0"] :dependencies [[org.clojure/clojure "1.7.0"]
[ch.qos.logback/logback-classic "1.1.3"]
[org.clojure/tools.logging "0.3.1"]
[org.clojure/tools.macro "0.1.2"] [org.clojure/tools.macro "0.1.2"]
[org.clojure/tools.namespace "0.2.11"]] [org.clojure/tools.namespace "0.2.11"]]
:profiles {:dev {:source-paths ["dev" "test/app"] :profiles {:dev {:source-paths ["dev" "test/app"]
:dependencies [[yesql "0.5.1"] :dependencies [[yesql "0.5.1"]
[com.datomic/datomic-free "0.9.5327" :exclusions [joda-time]] [org.clojure/tools.nrepl "0.2.11"]
[ch.qos.logback/logback-classic "1.1.3"] [com.datomic/datomic-free "0.9.5327" :exclusions [joda-time]]]}})
[org.clojure/tools.logging "0.3.1"]]}})

View file

@ -1,9 +1,20 @@
(ns app (ns app
(:require [datomic.api :as d] (:require [datomic.api :as d]
[clojure.tools.nrepl.server :refer [start-server stop-server]]
[mount :refer [defstate]]
[app.utils.datomic :refer [touch]] [app.utils.datomic :refer [touch]]
[app.config :refer [app-config]] [app.config :refer [app-config]]
[app.nyse :as nyse])) [app.nyse :as nyse]))
;; example on creating a network REPL
(defn- start-nrepl [{:keys [host port]}]
(start-server :bind host :port port))
;; nREPL is just another simple state
(defstate nrepl :start (start-nrepl (:nrepl app-config))
:stop (stop-server nrepl))
;; datomic schema
(defn create-schema [conn] (defn create-schema [conn]
(let [schema [{:db/id #db/id [:db.part/db] (let [schema [{:db/id #db/id [:db.part/db]
:db/ident :order/symbol :db/ident :order/symbol

View file

@ -20,4 +20,7 @@
:exchange-type "direct" :exchange-type "direct"
:vhost "/captoman" :vhost "/captoman"
:username "guest" :username "guest"
:password "guest"}} :password "guest"}
:nrepl {:host "0.0.0.0"
:port 7878}}