Merge pull request #744 from ilovezfs/extensionless

version: fix parsing of URLs ending with version
This commit is contained in:
ilovezfs 2016-08-18 12:42:23 -07:00
commit ef2674b812
2 changed files with 7 additions and 1 deletions

View File

@ -438,8 +438,12 @@ class VersionParsingTests < Homebrew::TestCase
"https://opam.ocaml.org/archives/easy-format.1.0.2+opam.tar.gz"
end
def test_waf_version
def test_no_extension_version
assert_version_detected "1.8.12", "https://waf.io/waf-1.8.12"
assert_version_detected "0.7.1", "https://codeload.github.com/gsamokovarov/jump/tar.gz/v0.7.1"
assert_version_detected "0.9.1234", "https://my.datomic.com/downloads/free/0.9.1234"
assert_version_detected "0.9", "https://my.datomic.com/downloads/free/0.9.1t34"
assert_version_detected "1.2.3", "https://my.datomic.com/downloads/free/1.2.3"
end
def test_dash_separated_version

View File

@ -294,6 +294,8 @@ class Version
spec.basename.to_s
elsif %r{((?:sourceforge\.net|sf\.net)/.*)/download$}.match(spec_s)
Pathname.new(spec.dirname).stem
elsif %r{\.[^a-zA-Z]+$}.match(spec_s)
Pathname.new(spec_s).basename
else
spec.stem
end