Skip to content

Commit

Permalink
aliases - ignore aliases with non-map data
Browse files Browse the repository at this point in the history
  • Loading branch information
puredanger committed May 1, 2024
1 parent 737a27c commit 1777f3c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Changelog
===========

* next
* aliases - ignore aliases with non-map data
* Update to latest tools.deps
* 0.10.61 on Apr 24, 2024
* Update to latest tools.deps and Clojure 1.11.3
* 0.10.55 on Mar 8, 2024
Expand Down
2 changes: 1 addition & 1 deletion deps.edn
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{:paths ["src/main/clojure" "src/main/resources"]
:deps {
org.clojure/clojure {:mvn/version "1.11.3"}
org.clojure/tools.deps {:mvn/version "0.19.1421"}
org.clojure/tools.deps {:mvn/version "0.19.1428"}
}
:aliases {
;; clj -M:lint
Expand Down
2 changes: 1 addition & 1 deletion src/main/clojure/clojure/tools/deps/cli/api.clj
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
(reduce-kv
(fn [a alias alias-defn]
(cond-> a
(pos? (count (set/intersection cli-alias-keys (set (keys alias-defn)))))
(pos? (count (set/intersection cli-alias-keys (when (map? alias-defn) (set (keys alias-defn))))))
(assoc alias alias-defn)))
{} aliases)))
{} src-aliases)
Expand Down
12 changes: 12 additions & 0 deletions src/test/clojure/clojure/tools/deps/cli/test_api.clj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@
(binding [*test-dir* dir#]
~@body)))

(deftest test-aliases-with-non-map-data
(with-test-dir
(let [p1deps (jio/file *test-dir* "p1/deps.edn")]
(jio/make-parents p1deps)
(spit p1deps
(pr-str {:aliases {:foo ["some" "data"]}}))

(dir/with-dir (jio/file *test-dir* "p1")
(let [output (with-out-str (api/aliases {:user nil}))]
(is (str/includes? output ":deps"))
(is (not (str/includes? output ":foo"))))))))

(deftest test-prep-with-aliases
(with-test-dir
(let [p1deps (jio/file *test-dir* "p1/deps.edn")
Expand Down

0 comments on commit 1777f3c

Please sign in to comment.