From 66cc2eaa92aa0c9e5681c568b234b3afd7764a22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Ag=C3=BCero?= Date: Mon, 3 May 2021 16:53:19 +0200 Subject: [PATCH 1/3] Sort versions correctly. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Carlos Agüero --- src/ign.in | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ign.in b/src/ign.in index 4eb11fb..1b4ef1d 100755 --- a/src/ign.in +++ b/src/ign.in @@ -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 { |k, v| + # Prereleases include the "~" symbol. However Gem::Version doesn't support + # it, so we remove it. + k = k.tr('~', '') + Gem::Version.new(k) + }.reverse end # Commands is a hash where the key is the command and the value is a list. From fd2083c22d9d151e393d7a4b150af899214b5cf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Ag=C3=BCero?= Date: Mon, 3 May 2021 17:00:56 +0200 Subject: [PATCH 2/3] Style. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Carlos Agüero --- src/ign.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ign.in b/src/ign.in index 1b4ef1d..388e60a 100755 --- a/src/ign.in +++ b/src/ign.in @@ -142,7 +142,7 @@ end # versions go first. sorted_commands = {} commands.each do |cmd, versions| - sorted_commands[cmd] = versions.sort_by { |k, v| + sorted_commands[cmd] = versions.sort_by { |k, _v| # Prereleases include the "~" symbol. However Gem::Version doesn't support # it, so we remove it. k = k.tr('~', '') From c0b04fe67ac0591220b9345fb744e90c35a9f8fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Ag=C3=BCero?= Date: Mon, 3 May 2021 17:07:09 +0200 Subject: [PATCH 3/3] Style. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Carlos Agüero --- src/ign.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ign.in b/src/ign.in index 388e60a..0394fda 100755 --- a/src/ign.in +++ b/src/ign.in @@ -142,12 +142,12 @@ end # versions go first. sorted_commands = {} commands.each do |cmd, versions| - sorted_commands[cmd] = versions.sort_by { |k, _v| + 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) - }.reverse + end.reverse end # Commands is a hash where the key is the command and the value is a list.