version: detect versions with final/full suffix

This commit is contained in:
Seeker 2020-08-09 13:32:01 -07:00
parent 984e926d19
commit 8b55f8f9a4
2 changed files with 23 additions and 2 deletions

View File

@ -671,6 +671,27 @@ describe Version do
.to be_detected_from("https://ftpmirror.gnu.org/libidn/libidn-1.29-win64.zip") .to be_detected_from("https://ftpmirror.gnu.org/libidn/libidn-1.29-win64.zip")
end end
specify "breseq version style" do
expect(described_class.create("0.35.1"))
.to be_detected_from(
"https://github.com/barricklab/breseq" \
"/releases/download/v0.35.1/breseq-0.35.1.Source.tar.gz",
)
end
specify "wildfly version style" do
expect(described_class.create("20.0.1"))
.to be_detected_from("https://download.jboss.org/wildfly/20.0.1.Final/wildfly-20.0.1.Final.tar.gz")
end
specify "trinity version style" do
expect(described_class.create("2.10.0"))
.to be_detected_from(
"https://github.com/trinityrnaseq/trinityrnaseq" \
"/releases/download/v2.10.0/trinityrnaseq-v2.10.0.FULL.tar.gz",
)
end
specify "with arch" do specify "with arch" do
expect(described_class.create("4.0.18-1")) expect(described_class.create("4.0.18-1"))
.to be_detected_from("https://ftpmirror.gnu.org/mtools/mtools-4.0.18-1.i686.rpm") .to be_detected_from("https://ftpmirror.gnu.org/mtools/mtools-4.0.18-1.i686.rpm")

View File

@ -301,7 +301,7 @@ class Version
# e.g. foobar-4.5.1-1 # e.g. foobar-4.5.1-1
# e.g. unrtf_0.20.4-1 # e.g. unrtf_0.20.4-1
# e.g. ruby-1.9.1-p243 # e.g. ruby-1.9.1-p243
m = /[-_]((?:\d+\.)*\d+\.\d+-(?:p|rc|RC)?\d+)(?:[-._](?:bin|dist|stable|src|sources))?$/.match(stem) m = /[-_]((?:\d+\.)*\d+\.\d+-(?:p|rc|RC)?\d+)(?:[-._](?i:bin|dist|stable|src|sources?|final|full))?$/.match(stem)
return m.captures.first unless m.nil? return m.captures.first unless m.nil?
# URL with no extension # URL with no extension
@ -359,7 +359,7 @@ class Version
return m.captures.first unless m.nil? return m.captures.first unless m.nil?
# e.g. foobar-4.5.0-bin # e.g. foobar-4.5.0-bin
m = /-((?:\d+\.)+\d+[abc]?)[-._](?:bin|dist|stable|src|sources?)$/.match(stem) m = /[-vV]((?:\d+\.)+\d+[abc]?)[-._](?i:bin|dist|stable|src|sources?|final|full)$/.match(stem)
return m.captures.first unless m.nil? return m.captures.first unless m.nil?
# dash version style # dash version style