xcpretty / xcode-install

🔽 Install and update your Xcodes
https://fastlane.tools
MIT License
2.59k stars 239 forks source link

Support `xcversion install latest` or similar #344

Open lazerwalker opened 5 years ago

lazerwalker commented 5 years ago

Hey y'all!

A common feature of toolchain management software similar to xcode-install is letting you say "give me the latest stable version of the tools, whatever version number that might be". Examples include rvm install --latest and nvm install node, which fetch the latest stable versions of MRI Ruby and Node, respetively.

One thing I use xcode-install for is in scripting automation for setting up new Macs. To do that, while also managing my Xcode installations through xcode-install, I need to run xcversion list and manually select the latest non-beta version to install. Allowing for xcversion install latest (or xcversion install stable, etc) would be SUPER useful for this use case.

I understand the implementation of this might be a bit annoying (either needing to make a separate authenticated call to Apple's servers, or caching that version number somewhere else in a way that doesn't require manual updating).

I'm willing to help implement this, but wanted to read the room before investing any time. Is there interest and willingness to merge? Are there any nasty complexities I'm missing?

I didn't see anything similar to this show up in a cursory search of the Issues history, my apologies if I've missed something.

Thanks so much!

revolter commented 4 years ago

I'd want this too.

nancy-gomez commented 4 years ago

Hm, wouldn't you maybe be able to do this via xcversion update, xcversion list, then taking the final value displayed as "latest"?

revolter commented 4 years ago

They are guaranteed to be always ordered by version, and not alphabetically or random?

nancy-gomez commented 4 years ago

The output appears to be ordered via semantic versioning but I personally can not guarantee, we'd need someone else to confirm. But here's what I found: https://github.com/xcpretty/xcode-install/blob/09d26e89bff606e56d36049d516ed87c48161b06/lib/xcode/install.rb#L306

revolter commented 4 years ago

It looks like the list is exactly as it comes from Apple: https://github.com/xcpretty/xcode-install/blob/09d26e89bff606e56d36049d516ed87c48161b06/lib/xcode/install.rb#L378