diff options
-rw-r--r-- | resources/config.sexp.sample | 3 | ||||
-rw-r--r-- | src/mulk/benki/main.clj | 17 |
2 files changed, 20 insertions, 0 deletions
diff --git a/resources/config.sexp.sample b/resources/config.sexp.sample index a1e3a36..3f4e06f 100644 --- a/resources/config.sexp.sample +++ b/resources/config.sexp.sample @@ -15,6 +15,9 @@ :swank {:enabled true ;will be assumed true if absent :port 4005 :bind "127.0.0.1"} + :nrepl {:enabled true ;will be assumed true if absent + :port 4111 + :bind "127.0.0.1"} :xmpp {:enabled true ;will be assumed true if absent :user "benki" :service-name "example.com" 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) |