Skip to content

Commit

Permalink
Merge pull request #416 from revolter/patch-1
Browse files Browse the repository at this point in the history
Add support for the new Release Candidate versions
  • Loading branch information
Josh Holtz authored Nov 30, 2020
2 parents 907414b + 0d03ed0 commit 271a30c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/xcode/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ def prereleases
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
Expand All @@ -481,9 +482,16 @@ 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
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity

def hdiutil(*args)
io = IO.popen(['hdiutil', *args])
Expand Down

0 comments on commit 271a30c

Please sign in to comment.