Closed worrel closed 9 years ago
Also, addresses #87
Added a few comments. Mostly superficial stuff.
Fixed up the formatting, the indentation change was LightTable's doing on smart re-indent - perhaps I have non-standard config? Version is back to 0.8.13.
Also fixed long commit message with rebase/amend/force push.
That should be the last change needed. Then I can merge this PR.
This all looks solid to me and @weavejester's last concern seems to be addressed.
Git version do not work for me:
java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to clojure.lang.Named
at clojure.core$namespace.invoke (core.clj:1526)
leiningen.ring.server$load_namespaces$iter__3165__3169$fn__3170.invoke (server.clj:21)
...
Seems like It's because of 4b1b10b3545d2362383db5075c92f284b90cb943 from this PR -- I revert it back and lein-ring
works again.
ugh, that'll teach me to not test a change :-(. @MichaelBlume @weavejester the issue with https://github.com/weavejester/lein-ring/commit/4b1b10b3545d2362383db5075c92f284b90cb943 is that (nrepl-middleware project) (correctly) returns a vector not an individual symbol. I don't see a really clean way to construct the input to load-namespaces while factoring in the fact that the nREPL namespaces are conditionally loaded. We can either go with the prior let/apply call (@zarkone 's fix does that), or drop the let and do
(apply load-namespaces
(conj (into
['ring.server.leiningen
(if (nrepl? project) 'clojure.tools.nrepl.server)]
(if (nrepl? project) (nrepl-middleware project)))
(-> project :ring :handler)
(-> project :ring :init)
(-> project :ring :destroy))))))
Utilize :nrepl-middleware for Ring's nREPL
Makes 'lein ring server' honor :nrepl-middleware specified in :repl-options, optionally overriden directly in the :ring option map.
Possibly conflicts with #118 or might supercede it - I don't use Cider.
Example usage (with LightTable nREPL middleware):