Merge pull request #1336 from jcrossley3/connect-via-nrepl-port-file
Fallback to .nrepl-port for 'repl :connect' subtask
This commit is contained in:
commit
9e04655af9
3 changed files with 10 additions and 2 deletions
|
@ -39,11 +39,17 @@
|
|||
(-> project :repl-options :host)
|
||||
"127.0.0.1"))
|
||||
|
||||
(defn client-repl-port [project]
|
||||
(let [port (repl-port project)]
|
||||
(if (= port 0)
|
||||
(slurp (io/file (:root project) ".nrepl-port"))
|
||||
port)))
|
||||
|
||||
(defn connect-string [project opts]
|
||||
(as-> (str (first opts)) x
|
||||
(s/split x #":")
|
||||
(remove s/blank? x)
|
||||
(-> (drop-last (count x) [(repl-host project) (repl-port project)])
|
||||
(-> (drop-last (count x) [(repl-host project) (client-repl-port project)])
|
||||
(concat x))
|
||||
(s/join ":" x)))
|
||||
|
||||
|
|
|
@ -73,7 +73,8 @@
|
|||
"" "repl-host:5"
|
||||
"7" "repl-host:7"
|
||||
"myhost:9" "myhost:9"
|
||||
"http://localhost:20" "http://localhost:20"))
|
||||
"http://localhost:20" "http://localhost:20")
|
||||
(is (= "127.0.0.1:4242" (connect-string lthelper/sample-project []))))
|
||||
|
||||
(deftest test-options-for-reply
|
||||
(is (= (lthelper/fix-path-delimiters "/home/user/.lein-repl-history")
|
||||
|
|
1
test_projects/sample/.nrepl-port
Normal file
1
test_projects/sample/.nrepl-port
Normal file
|
@ -0,0 +1 @@
|
|||
4242
|
Loading…
Reference in a new issue