Skip to content

Conversation

@jazaval
Copy link
Contributor

@jazaval jazaval commented Jun 16, 2020

This PR:

Updates the appname_version method to catch cases in which the Xcode bundle has been renamed, in order to resolve #396.

Due to the updates in #386, xcversion commands will fail with the following error if the user renames the Xcode application bundle to remove the version number from the path, or if they've installed Xcode from another source, like the App Store.

version.rb:212:in `initialize': Malformed version number string Xcode (ArgumentError)

Example repro/stacktrace:

vagrant@xcode-from-apple-catalina-chef15 /Applications % ls
Safari.app	Utilities	Xcode-11.5.app
vagrant@xcode-from-apple-catalina-chef15 /Applications % /opt/chef/embedded/bin/xcversion update
vagrant@xcode-from-apple-catalina-chef15 /Applications % sudo mv ./Xcode-11.5.app ./Xcode.app
vagrant@xcode-from-apple-catalina-chef15 /Applications % /opt/chef/embedded/bin/xcversion update
Traceback (most recent call last):
	11: from /opt/chef/embedded/bin/xcversion:23:in `<main>'
	10: from /opt/chef/embedded/bin/xcversion:23:in `load'
	 9: from /opt/chef/embedded/lib/ruby/gems/2.6.0/gems/xcode-install-2.6.5/bin/xcversion:12:in `<top (required)>'
	 8: from /opt/chef/embedded/lib/ruby/gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
	 7: from /opt/chef/embedded/lib/ruby/gems/2.6.0/gems/xcode-install-2.6.5/lib/xcode/install/update.rb:10:in `run'
	 6: from /opt/chef/embedded/lib/ruby/gems/2.6.0/gems/xcode-install-2.6.5/lib/xcode/install.rb:317:in `list'
	 5: from /opt/chef/embedded/lib/ruby/gems/2.6.0/gems/xcode-install-2.6.5/lib/xcode/install.rb:303:in `list_annotated'
	 4: from /opt/chef/embedded/lib/ruby/gems/2.6.0/gems/xcode-install-2.6.5/lib/xcode/install.rb:303:in `map'
	 3: from /opt/chef/embedded/lib/ruby/gems/2.6.0/gems/xcode-install-2.6.5/lib/xcode/install.rb:611:in `appname_version'
	 2: from /opt/chef/embedded/lib/ruby/2.6.0/rubygems/version.rb:203:in `new'
	 1: from /opt/chef/embedded/lib/ruby/2.6.0/rubygems/version.rb:203:in `new'
/opt/chef/embedded/lib/ruby/2.6.0/rubygems/version.rb:212:in `initialize': Malformed version number string Xcode (ArgumentError)

This change can impact proper detection of beta Xcode installations in the xcversion installed list, but only if the user has performed a Xcode bundle path rename. Given that the CFBundleShortVersionString from Contents/version.plist of beta Xcodes does not identify beta seeds directly, this is the only compromise I could think of that would allow for users to rename the Xcode application bundles installed by xcode-install.

@jazaval
Copy link
Contributor Author

jazaval commented Jun 18, 2020

@joshdholtz do you mind taking a look at this? Looks like anyone who has an Xcode app bundle previously installed or moved/managed after running xcversion install is blocked from using the xcversion CLI.

@joshdholtz
Copy link
Member

Yeah yeah! Just out picking up some Thai for dinner and then I’ll check it out when I get home.

@jazaval
Copy link
Contributor Author

jazaval commented Jun 19, 2020

Thanks a bunch - really appreciate it. Can’t wait for Xcode 12 next week 🤪

Copy link
Member

@joshdholtz joshdholtz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me! I will pop a new release out tomorrow morning 💪Thanks for the contribution ❤️

@netzere
Copy link

netzere commented Jun 22, 2020

Hi @joshdholtz :)
Can we please release it?

@jazaval
Copy link
Contributor Author

jazaval commented Jun 24, 2020

@joshdholtz do you need me to bump it to 2.6.6?

@joshdholtz
Copy link
Member

Ah sorry! Releasing now 😱 I got so sidetracked but the API fixes 😔 I can bump! Will be released in about 10 minutes.

@joshdholtz joshdholtz merged commit 267d512 into xcpretty:master Jun 24, 2020
@joshdholtz
Copy link
Member

Should be up on rubygems for ya’ll!

https://github.com/xcpretty/xcode-install/releases/tag/v2.6.6

@jazaval
Copy link
Contributor Author

jazaval commented Jun 24, 2020

Thanks!

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.

Malformed version number string Xcode (ArgumentError)

3 participants