summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2012-08-22 08:30:40 +0200
committerMatthias Andreas Benkard <code@mail.matthias.benkard.de>2012-08-22 08:30:40 +0200
commite1a1f43acf513b79e1a2df61680c8ae635c61fbc (patch)
treeb645cdfc81942ba32f5165d123c4cf4d59f817b9 /src
parent0fbfe4359681645c3faeea4acd536f7a2ad49c05 (diff)
Add nREPL support when running on Immutant.
Diffstat (limited to 'src')
-rw-r--r--src/mulk/benki/main.clj17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/mulk/benki/main.clj b/src/mulk/benki/main.clj
index 47bca8d..0392902 100644
--- a/src/mulk/benki/main.clj
+++ b/src/mulk/benki/main.clj
@@ -159,6 +159,22 @@
(:bind swank-config) (:port swank-config))
true)))
+(defn run-immutant-nrepl!
+ "Call `immutant.repl/start-nrepl` with the Swank configuration
+ specified in `benki-config`. If loading the immutant.repl namespace
+ fails, ignore the error and return `nil` without doing anything. In
+ case of success, return true." []
+ (when-let [swank-config (get @benki-config :nrepl)]
+ (when (and (get swank-config :enabled true)
+ (try
+ (require 'immutant.repl)
+ true
+ (catch Exception e
+ false)))
+ ((ns-resolve 'immutant.repl 'start-nrepl)
+ (:bind swank-config) (:port swank-config))
+ true)))
+
(defn init! []
(init-config!)
(init-middleware!)
@@ -167,6 +183,7 @@
(doseq [ns '(mulk.benki.book_marx mulk.benki.lazychat)]
(require ns))
(future (run-immutant-swank!))
+ (future (run-immutant-nrepl!))
(future (require 'mulk.benki.xmpp)
((ns-resolve 'mulk.benki.xmpp 'init-xmpp!)))
(future (require 'mulk.benki.lazychat)