Skip to content

Commit

Permalink
Sort versions correctly. (#50)
Browse files Browse the repository at this point in the history
* Sort versions correctly.

Signed-off-by: Carlos Agüero <[email protected]>
  • Loading branch information
caguero authored May 6, 2021
1 parent 1f14c73 commit 2cca470
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/ign.in
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,12 @@ end
# versions go first.
sorted_commands = {}
commands.each do |cmd, versions|
sorted_commands[cmd] = versions.sort.reverse
sorted_commands[cmd] = versions.sort_by do |k, _v|
# Prereleases include the "~" symbol. However Gem::Version doesn't support
# it, so we remove it.
k = k.tr('~', '')
Gem::Version.new(k)
end.reverse
end

# Commands is a hash where the key is the command and the value is a list.
Expand Down

0 comments on commit 2cca470

Please sign in to comment.