From e1a1f43acf513b79e1a2df61680c8ae635c61fbc Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Wed, 22 Aug 2012 08:30:40 +0200 Subject: Add nREPL support when running on Immutant. --- src/mulk/benki/main.clj | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src') 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) -- cgit v1.2.3