From b22fa0278edb8b79d9255fede6dafd144a1bd1f0 Mon Sep 17 00:00:00 2001 From: Iulian Onofrei Date: Thu, 12 Nov 2020 16:01:09 +0200 Subject: [PATCH 1/4] Add support for the new Release Candidate versions --- lib/xcode/install.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/xcode/install.rb b/lib/xcode/install.rb index c1c11b9..834962e 100644 --- a/lib/xcode/install.rb +++ b/lib/xcode/install.rb @@ -481,6 +481,12 @@ def compare_versions(first, second) 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 From 9381066296d5edaa03a92ff365277e34809710b3 Mon Sep 17 00:00:00 2001 From: Iulian Onofrei Date: Thu, 12 Nov 2020 16:06:32 +0200 Subject: [PATCH 2/4] Fix RuboCop issue --- lib/xcode/install.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/xcode/install.rb b/lib/xcode/install.rb index 834962e..6c1bce8 100644 --- a/lib/xcode/install.rb +++ b/lib/xcode/install.rb @@ -464,7 +464,7 @@ def prereleases links end - def compare_versions(first, second) + def compare_versions(first, second) # rubocop:disable Metrics/CyclomaticComplexity # Sort by version number numeric_comparation = first.to_f <=> second.to_f return numeric_comparation if numeric_comparation != 0 From e61a059b9cb9e9414e08cf3a4ee180ea5035483d Mon Sep 17 00:00:00 2001 From: Iulian Onofrei Date: Thu, 12 Nov 2020 16:09:53 +0200 Subject: [PATCH 3/4] Fix RuboCop issue --- lib/xcode/install.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/xcode/install.rb b/lib/xcode/install.rb index 6c1bce8..16e8f16 100644 --- a/lib/xcode/install.rb +++ b/lib/xcode/install.rb @@ -464,7 +464,7 @@ def prereleases links end - def compare_versions(first, second) # rubocop:disable Metrics/CyclomaticComplexity + def compare_versions(first, second) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity # Sort by version number numeric_comparation = first.to_f <=> second.to_f return numeric_comparation if numeric_comparation != 0 From 0d03ed0cf878e85612bc617a5758845ad8543ab0 Mon Sep 17 00:00:00 2001 From: Josh Holtz Date: Mon, 30 Nov 2020 12:05:21 -0600 Subject: [PATCH 4/4] Move rubocop disable above method and reenabled below --- lib/xcode/install.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/xcode/install.rb b/lib/xcode/install.rb index 16e8f16..c54dbb8 100644 --- a/lib/xcode/install.rb +++ b/lib/xcode/install.rb @@ -464,7 +464,8 @@ def prereleases links end - def compare_versions(first, second) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity + # 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 @@ -490,6 +491,7 @@ def compare_versions(first, second) # rubocop:disable Metrics/CyclomaticComplexi # Sort alphabetically first <=> second end + # rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity def hdiutil(*args) io = IO.popen(['hdiutil', *args])