[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/cider 99c90fc5d8 3/3: Make new jack-in-dependencies COMMAN
|
From: |
ELPA Syncer |
|
Subject: |
[nongnu] elpa/cider 99c90fc5d8 3/3: Make new jack-in-dependencies COMMAND arg &optional |
|
Date: |
Thu, 18 May 2023 02:00:12 -0400 (EDT) |
branch: elpa/cider
commit 99c90fc5d8158e116d5d6abce78da02c3aed5f5e
Author: ikappaki <ikappaki@users.noreply.github.com>
Commit: Bozhidar Batsov <bozhidar@batsov.dev>
Make new jack-in-dependencies COMMAND arg &optional
so that it does not break API compatibility
---
cider.el | 14 +++++++-------
test/cider-tests.el | 44 ++++++++++++++++++++++++++------------------
2 files changed, 33 insertions(+), 25 deletions(-)
diff --git a/cider.el b/cider.el
index a3e24cfc72..04a7789178 100644
--- a/cider.el
+++ b/cider.el
@@ -767,12 +767,12 @@ rules to quote it."
(utf-16le-command (encode-coding-string command 'utf-16le)))
(format "-encodedCommand %s" (base64-encode-string utf-16le-command t))))
-(defun cider-clojure-cli-jack-in-dependencies (global-options params
dependencies command)
+(defun cider-clojure-cli-jack-in-dependencies (global-options params
dependencies &optional command)
"Create Clojure tools.deps jack-in dependencies.
Does so by concatenating DEPENDENCIES, PARAMS and GLOBAL-OPTIONS into a
-suitable `clojure` invocation and quoting suitable for COMMAND invocation.
-The main is placed in an inline alias :cider/nrepl so that if your aliases
-contain any mains, the cider/nrepl one will be the one used."
+suitable `clojure` invocation and quoting, also accounting for COMMAND if
+provided. The main is placed in an inline alias :cider/nrepl so that if
+your aliases contain any mains, the cider/nrepl one will be the one used."
(let* ((all-deps (thread-last
dependencies
(append (cider--jack-in-required-dependencies))
@@ -838,12 +838,12 @@ See also `cider-jack-in-auto-inject-clojure'."
dependencies))
dependencies))
-(defun cider-inject-jack-in-dependencies (global-opts params project-type
command)
+(defun cider-inject-jack-in-dependencies (global-opts params project-type
&optional command)
"Return GLOBAL-OPTS and PARAMS with injected REPL dependencies.
These are set in `cider-jack-in-dependencies', `cider-jack-in-lein-plugins'
and `cider-jack-in-nrepl-middlewares' are injected from the CLI according
-to the used PROJECT-TYPE and COMMAND. Eliminates the need for hacking
-profiles.clj or the boot script for supporting CIDER with its nREPL
+to the used PROJECT-TYPE, and COMMAND if provided. Eliminates the need for
+hacking profiles.clj or the boot script for supporting CIDER with its nREPL
middleware and dependencies."
(pcase project-type
('lein (cider-lein-jack-in-dependencies
diff --git a/test/cider-tests.el b/test/cider-tests.el
index dabe9e488e..e023d27634 100644
--- a/test/cider-tests.el
+++ b/test/cider-tests.el
@@ -148,7 +148,7 @@
(setq-local cider-enrich-classpath t))
(it "can inject dependencies in a lein project"
- (expect (cider-inject-jack-in-dependencies "" "repl :headless" 'lein
"lein")
+ (expect (cider-inject-jack-in-dependencies "" "repl :headless" 'lein)
:to-equal (concat "update-in :dependencies conj "
(shell-quote-argument "[nrepl/nrepl
\"0.9.0\"]")
" -- update-in :plugins conj "
@@ -160,7 +160,7 @@
(it "can inject dependencies in a lein project with an exclusion"
(setq-local cider-jack-in-dependencies-exclusions '(("nrepl/nrepl"
("org.clojure/clojure"))))
- (expect (cider-inject-jack-in-dependencies "" "repl :headless" 'lein
"lein")
+ (expect (cider-inject-jack-in-dependencies "" "repl :headless" 'lein)
:to-equal (concat
"update-in :dependencies conj "
(shell-quote-argument "[nrepl/nrepl \"0.9.0\"
:exclusions [org.clojure/clojure]]")
@@ -173,7 +173,7 @@
(it "can inject dependencies in a lein project with multiple exclusions"
(setq-local cider-jack-in-dependencies-exclusions '(("nrepl/nrepl"
("org.clojure/clojure" "foo.bar/baz"))))
- (expect (cider-inject-jack-in-dependencies "" "repl :headless" 'lein
"lein")
+ (expect (cider-inject-jack-in-dependencies "" "repl :headless" 'lein)
:to-equal (concat "update-in :dependencies conj "
(shell-quote-argument "[nrepl/nrepl \"0.9.0\"
:exclusions [org.clojure/clojure foo.bar/baz]]")
" -- update-in :plugins conj "
@@ -184,7 +184,7 @@
" -- repl :headless")))
(it "can inject dependencies in a boot project"
- (expect (cider-inject-jack-in-dependencies "" "repl -s wait" 'boot
"boot")
+ (expect (cider-inject-jack-in-dependencies "" "repl -s wait" 'boot)
:to-equal (concat
"-i \"(require 'cider.tasks)\""
" -d "
@@ -197,7 +197,7 @@
" repl -s wait")))
(it "can inject dependencies in a gradle project"
- (expect (cider-inject-jack-in-dependencies "--no-daemon" ":clojureRepl"
'gradle "grandle")
+ (expect (cider-inject-jack-in-dependencies "--no-daemon" ":clojureRepl"
'gradle)
:to-equal (concat "--no-daemon "
(shell-quote-argument
"-Pdev.clojurephant.jack-in.nrepl=nrepl:nrepl:0.9.0,cider:cider-nrepl:0.28.5")
" :clojureRepl "
@@ -210,7 +210,7 @@
(setq-local cider-jack-in-nrepl-middlewares
'("refactor-nrepl.middleware/wrap-refactor" "cider.nrepl/cider-middleware"))
(setq-local cider-jack-in-dependencies-exclusions '()))
(it "can inject dependencies in a lein project"
- (expect (cider-inject-jack-in-dependencies "" "repl :headless" 'lein
"lein")
+ (expect (cider-inject-jack-in-dependencies "" "repl :headless" 'lein)
:to-equal (concat "update-in :dependencies conj "
(shell-quote-argument "[nrepl/nrepl
\"0.9.0\"]")
" -- update-in :plugins conj "
@@ -224,7 +224,7 @@
(it "can inject dependencies in a boot project"
(setq-local cider-jack-in-dependencies '(("refactor-nrepl" "2.0.0")))
- (expect (cider-inject-jack-in-dependencies "" "repl -s wait" 'boot
"boot")
+ (expect (cider-inject-jack-in-dependencies "" "repl -s wait" 'boot)
:to-equal (concat "-i \"(require 'cider.tasks)\""
" -d "
(shell-quote-argument "nrepl/nrepl:0.9.0")
@@ -247,7 +247,7 @@
(setq-local cider-jack-in-nrepl-middlewares
'("cider.nrepl/cider-middleware"))
(setq-local cider-jack-in-dependencies-exclusions '()))
(it "can concat in a lein project"
- (expect (cider-inject-jack-in-dependencies "-o -U" "repl :headless"
'lein "lein")
+ (expect (cider-inject-jack-in-dependencies "-o -U" "repl :headless"
'lein)
:to-equal (concat "-o -U update-in :dependencies conj "
(shell-quote-argument "[nrepl/nrepl
\"0.9.0\"]")
" -- update-in :plugins conj "
@@ -257,7 +257,7 @@
" -- update-in :middleware conj
cider.enrich-classpath/middleware"
" -- repl :headless")))
(it "can concat in a boot project"
- (expect (cider-inject-jack-in-dependencies "-C -o" "repl -s wait" 'boot
"boot")
+ (expect (cider-inject-jack-in-dependencies "-C -o" "repl -s wait" 'boot)
:to-equal (concat "-C -o -i \"(require 'cider.tasks)\""
" -d "
(shell-quote-argument "nrepl/nrepl:0.9.0")
@@ -268,7 +268,7 @@
(shell-quote-argument
"cider.nrepl/cider-middleware")
" repl -s wait")))
(it "can concat in a gradle project"
- (expect (cider-inject-jack-in-dependencies "--no-daemon" ":clojureRepl"
'gradle "grandle")
+ (expect (cider-inject-jack-in-dependencies "--no-daemon" ":clojureRepl"
'gradle)
:to-equal (concat "--no-daemon "
(shell-quote-argument
"-Pdev.clojurephant.jack-in.nrepl=nrepl:nrepl:0.9.0,cider:cider-nrepl:0.28.5")
" :clojureRepl "
@@ -326,7 +326,7 @@
(setq-local cider-jack-in-dependencies-exclusions '())
(setq-local cider-enrich-classpath t))
(it "uses them in a lein project"
- (expect (cider-inject-jack-in-dependencies "" "repl :headless" 'lein
"lein")
+ (expect (cider-inject-jack-in-dependencies "" "repl :headless" 'lein)
:to-equal (concat "update-in :dependencies conj "
(shell-quote-argument "[nrepl/nrepl
\"0.9.0\"]")
" -- update-in :plugins conj "
@@ -345,7 +345,7 @@
(setq-local cider-jack-in-dependencies '(("refactor-nrepl" "2.0.0")))
(setq-local cider-jack-in-dependencies-exclusions '()))
(it "uses them in a boot project"
- (expect (cider-inject-jack-in-dependencies "" "repl -s wait" 'boot
"boot")
+ (expect (cider-inject-jack-in-dependencies "" "repl -s wait" 'boot)
:to-equal (concat "-i \"(require 'cider.tasks)\""
" -d "
(shell-quote-argument "nrepl/nrepl:0.9.0")
@@ -405,6 +405,14 @@
(expect (cider--shadow-parse-builds (parseedn-read-str "[oops]"))
:to-equal '(browser-repl node-repl))))
+(describe "cider--shell-quote-argument"
+ (it "can quote powershell argument"
+ (expect (cider--shell-quote-argument "one \"two\" three" "powershell")
+ :to-equal "'one \"\"two\"\" three'"))
+ (it "can quote any other argument"
+ (expect (cider--shell-quote-argument "one \"two\" three")
+ :to-equal (shell-quote-argument "one \"two\" three"))))
+
(describe "cider--powershell-encode-command"
(it "base64 encodes command and parameters"
(expect (cider--powershell-encode-command "cmd-params")
@@ -483,20 +491,20 @@
""))
(deps '(("nrepl/nrepl" "0.9.0"))))
(let ((cider-clojure-cli-aliases ":test"))
- (expect (cider-clojure-cli-jack-in-dependencies nil nil deps
"clojure")
+ (expect (cider-clojure-cli-jack-in-dependencies nil nil deps)
:to-equal expected))
(describe "should strip out leading exec opts -A -M -T -X"
(let ((cider-clojure-cli-aliases "-A:test"))
- (expect (cider-clojure-cli-jack-in-dependencies nil nil deps
"clojure")
+ (expect (cider-clojure-cli-jack-in-dependencies nil nil deps)
:to-equal expected))
(let ((cider-clojure-cli-aliases "-M:test"))
- (expect (cider-clojure-cli-jack-in-dependencies nil nil deps
"clojure")
+ (expect (cider-clojure-cli-jack-in-dependencies nil nil deps)
:to-equal expected))
(let ((cider-clojure-cli-aliases "-T:test"))
- (expect (cider-clojure-cli-jack-in-dependencies nil nil deps
"clojure")
+ (expect (cider-clojure-cli-jack-in-dependencies nil nil deps)
:to-equal expected))
(let ((cider-clojure-cli-aliases "-T:test"))
- (expect (cider-clojure-cli-jack-in-dependencies nil nil deps
"clojure")
+ (expect (cider-clojure-cli-jack-in-dependencies nil nil deps)
:to-equal expected)))))
(it "allows for global options"
(let ((expected (string-join `("-J-Djdk.attach.allowAttachSelf -Sdeps "
@@ -505,7 +513,7 @@
""))
(deps '(("nrepl/nrepl" "0.9.0"))))
(let ((cider-clojure-cli-aliases ":test"))
- (expect (cider-clojure-cli-jack-in-dependencies
"-J-Djdk.attach.allowAttachSelf" nil deps "clojure")
+ (expect (cider-clojure-cli-jack-in-dependencies
"-J-Djdk.attach.allowAttachSelf" nil deps)
:to-equal expected))))
(it "allows to specify git coordinate as cider-jack-in-dependency"
(setq-local cider-jack-in-dependencies '(("org.clojure/tools.deps"
(("git/sha" . "6ae2b6f71773de7549d7f22759e8b09fec27f0d9")