lib/xcode/install.rb in xcode-install-2.6.7 vs lib/xcode/install.rb in xcode-install-2.6.8

- old
+ new

@@ -462,10 +462,11 @@ end links end + # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity def compare_versions(first, second) # Sort by version number numeric_comparation = first.to_f <=> second.to_f return numeric_comparation if numeric_comparation != 0 @@ -479,12 +480,19 @@ is_first_gm = first.include?('GM') is_second_gm = second.include?('GM') return -1 if is_first_gm && !is_second_gm return 1 if !is_first_gm && is_second_gm + # Return Release Candidate versions before others + is_first_rc = first.include?('RC') || first.include?('Release Candidate') + is_second_rc = second.include?('RC') || second.include?('Release Candidate') + return -1 if is_first_rc && !is_second_rc + return 1 if !is_first_rc && is_second_rc + # Sort alphabetically first <=> second end + # rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity def hdiutil(*args) io = IO.popen(['hdiutil', *args]) result = io.read io.close