Skip to content

Commit

Permalink
throw on missing dep
Browse files Browse the repository at this point in the history
  • Loading branch information
borkdude committed Mar 28, 2024
1 parent 1d47d97 commit 2badcf7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
8 changes: 5 additions & 3 deletions neil
Original file line number Diff line number Diff line change
Expand Up @@ -1236,10 +1236,12 @@ chmod +x bin/kaocha
[v :mvn])
(when-let [v (latest-mvn-version lib)]
[v :mvn])))
_ (when-not version
(throw (ex-info (str "Couldn't find version for lib: " lib) {:babashka/exit 0})))
missing? (nil? version)
mvn? (= coord-type? :mvn)
git-sha? (= coord-type? :git/sha)
git-tag? (= coord-type? :git/tag)
mvn? (= :mvn coord-type?)
git-sha? (= :git/sha coord-type?)
git-tag? (= :git/tag coord-type?)
git-url (when (or git-sha? git-tag?)
(or (:git/url opts)
(str "https://github.com/" (git/clean-github-lib lib))))
Expand Down
8 changes: 5 additions & 3 deletions src/babashka/neil.clj
Original file line number Diff line number Diff line change
Expand Up @@ -378,10 +378,12 @@ chmod +x bin/kaocha
[v :mvn])
(when-let [v (latest-mvn-version lib)]
[v :mvn])))
_ (when-not version
(throw (ex-info (str "Couldn't find version for lib: " lib) {:babashka/exit 0})))
missing? (nil? version)
mvn? (= coord-type? :mvn)
git-sha? (= coord-type? :git/sha)
git-tag? (= coord-type? :git/tag)
mvn? (= :mvn coord-type?)
git-sha? (= :git/sha coord-type?)
git-tag? (= :git/tag coord-type?)
git-url (when (or git-sha? git-tag?)
(or (:git/url opts)
(str "https://github.com/" (git/clean-github-lib lib))))
Expand Down
3 changes: 2 additions & 1 deletion tests.clj
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
(let [{:keys [edn]} (neil "add dep clj-kondo/clj-kondo")]
(is (-> edn :deps (get 'clj-kondo/clj-kondo))))
(let [{:keys [edn]} (neil "add dep clj-kondo")]
(is (-> edn :deps (get 'clj-kondo/clj-kondo)))))
(is (-> edn :deps (get 'clj-kondo/clj-kondo))))
(is (thrown? Exception (neil "add dep fake-dep"))))

(deftest add-dep-alias-test
(let [{:keys [edn]} (neil "add dep clj-kondo/clj-kondo" :alias :lint)]
Expand Down

0 comments on commit 2badcf7

Please sign in to comment.