xcpretty / xcode-install

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

Adding Command Line Tools Installer (for all versions) #378

Closed BytesGuy closed 3 years ago

BytesGuy commented 4 years ago

Summary

This supersedes #350 from @marcomorain as I used it as a base to work from on this idea.

The idea here is that while we can currently install the latest version of the CLI tools, this only installs the latest version via softwareupdate - this will always be the latest stable version.

Where we are installing beta versions of Xcode, we may wish to install the beta CLI tools that go along with them. This is especially true in the beta images we create at CircleCI.

Usage

xcversion tools will list all version of CLI tools available to download and install:

Screenshot 2020-02-26 at 15 41 27

xcversion tools --install="Command Line Tools for Xcode x.x.x" will install the specified version (e.g., xcversion tools --install="Command Line Tools for Xcode 11.2 beta 2")

screenshot_2020-02-20_at_11 59 11

Implementation

This is piggybacking on the implementation for grabbing Xcode information and downloading it.

Listing the tools will ping the api and parse it, saving a copy of the response to the cache file.

The installation will use the info from the api to find and download the specified tools version. It will then proceed to install by mounting the dmg and installing the pkg. This has a simple check to compare the tools version number we have downloaded to that the version which is installed after the install is complete, just as an extra step of verification (this check will only work on macOS 10.9 and above for now due to the change in the way the CLI tools are packaged)

This will possibly need merging with the current cli.rb and I intend to look into that soon, but thought I would open this PR now to get any feedback!

martinm82 commented 4 years ago

@BytesGuy are there any plans to follow-up on this PR? Is anyone reviewing this?

BytesGuy commented 4 years ago

@martinm82 No idea to be honest, haven’t seen any activity on this from the repo maintainers. The changes probably need some polishing up (I am very new to Ruby and contributing to OSS) but generally it works - we have had it in production since I wrote the modification and it’s been reliable.