Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

neil dep add: add latest unstable version if no stable versions are found #178

Conversation

teodorlu
Copy link
Contributor

@teodorlu teodorlu commented Mar 22, 2023

Please answer the following questions and leave the below in as part of your PR.


Semantics

  • Without this PR, we fail silently when neil dep add LIB is called, and there are no stable versions available for LIB.
  • With this PR, we first check for stable versions, then fall back to the first unstable version.
$ ls
$ neil-dev dep search ham-fisted
:lib com.cnuernber/ham-fisted :version "1.000-beta-90" :description nil
$ neil-dev dep add com.cnuernber/ham-fisted
$ cat deps.edn
{:deps {com.cnuernber/ham-fisted {:mvn/version "1.000-beta-90"}}
 :aliases {}}

Considerations

I renamed the old neil/latest-clojars-version to neil/latest-stable-clojars-version, and added a new neil/latest-clojars-version that accepts both stable and unstable versions.

The fallback logic as implemented increases the time a neil dep add call takes, by introducing two extra network requests:

:else
(or
 (when-let [v (:version opts)]
   [v :mvn])
 (when-let [v (latest-stable-clojars-version lib)]
   [v :mvn])
 (when-let [v (latest-stable-mvn-version lib)]
   [v :mvn])
 (when-let [v (git/latest-github-sha lib)]
   [v :git/sha])
 (when-let [v (latest-clojars-version lib)]
   [v :mvn])
 (when-let [v (latest-mvn-version lib)]
   [v :mvn]))

@teodorlu teodorlu marked this pull request as ready for review March 22, 2023 20:13
@borkdude borkdude merged commit 104bae7 into babashka:main Mar 22, 2023
@teodorlu teodorlu deleted the neil-dep-install-lastest-unstable-when-no-stable branch March 22, 2023 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants