xcpretty / xcode-install

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

Fix regexp in get_dmg method #402

Open makesource opened 3 years ago

makesource commented 3 years ago

Thank you for great library 😀 I found two issues in get_dmg regexp.

Issue

1. This does not matches upper case name.

Default downloaded xcode file name was Xcode_${version}.xip, but this expression does not match this so the cache doesn't work properly. Currently the cache seems to work because of right below issue, but not really

(maybe related to this PR https://github.com/xcpretty/xcode-install/pull/388.. But it has not been merged yet, so I included this change as well.)

2. without parentheses, the expression matches any xip extensions.

/^xcode_#{version}\.dmg|xip$/ -> /^xcode_#{version}\.dmg$/ or /^xip$/ -> :x: (Any xip extension will matches this) /^xcode_#{version}\.(dmg|xip)$/ -> /^xcode_#{version}\.dmg$/ or /^xcode_#{version}\.xip$/ -> :o: What we are expected!