Olical / depot

Find newer versions of your dependencies in your deps.edn file
https://clojars.org/olical/depot
The Unlicense
256 stars 14 forks source link

Add automatic updating of deps.edn #6

Closed plexus closed 5 years ago

plexus commented 5 years ago

Use rewrite-clj to parse deps.edn and update dependencies without messing up people's formatting.

Most of the functionality of depot.outdated.main has been pulled out to prevent circular namespace dependencies. Main now only does the handling of command line arguments.

Olical commented 5 years ago

Nice! This is really cool and something that I thought would be requested at some point. Thank you very much, I'll take a good look through the code soon :smiley:

arichiardi commented 5 years ago

Funny I was about to open an issue with this feature request :smile:

I really like the yarn approach here:

https://asciinema.org/a/119515

plexus commented 5 years ago

That is fancy indeed, but maybe something for another iteration.

@Olical let me know what you think, there are some things that could probably be better. Instead of --update-all I think it might be better to have separate --update-user and --update-system to deal with ~/.clojure/deps.edn and /usr/local/lib/clojure/deps.edn

Olical commented 5 years ago

Thanks for the comments, promise I'll get around to giving this a proper look over this week but I'm sure I'll be pretty much fine with it. No worries about the tables changing, just use Vim in future, thanks (:stuck_out_tongue_closed_eyes:)

If anyone seeing this is excited about this feature, please do point your olical/depot dependency at this repository and sha and let me know if it worked fine for your projects or not. It'll be a massive help!

arichiardi commented 5 years ago

@Olical I am doing exactly that :dagger:

plexus commented 5 years ago

I added docstrings and removed some dead code.

If anyone wants to try this at home, then run this inside a directory containing a deps.edn

clojure -Sdeps '{:deps {olical/depot {:git/url "https://github.com/plexus/depot.git" :sha "6f6ec2d08de787b772ee5dc8270e582cb5e73627"}}}' -m depot.outdated.main --update 
Olical commented 5 years ago

That is fancy indeed, but maybe something for another iteration.

@Olical let me know what you think, there are some things that could probably be better. Instead of --update-all I think it might be better to have separate --update-user and --update-system to deal with ~/.clojure/deps.edn and /usr/local/lib/clojure/deps.edn

I personally don't really touch my system and user level deps.edn files, I prefer to always keep things at the project level, I essentially pretend they don't exist. I worry I'll forget something is in a higher level file and it'll cause a repository to act weirdly for others. That's just me though! I'm happy having one flag for now, maybe split it if someone actually mentions it. Until then, YAGNI. Thanks for checking though!

plexus commented 5 years ago

I removed --update-all again, I think it makes more sense to just have --update. People can do --update ~/.clojure/deps.edn explicitly if they want to update their user config, same for the system config.

Better to drop it for now then to drop it after people started using it.

Olical commented 5 years ago

I gave it a test and it seems fine, worth noting that it requires Clojure 1.9+ because of *print-namespace-maps* (I mean, I think so, it failed for me on 1.8.0). Time to merge and deploy, thank you very much for your work!