Don't return a version that equals the basename
Return nil instead
This commit is contained in:
parent
c532d11e7a
commit
f9d7b34945
@ -98,7 +98,7 @@ class Pathname
|
||||
# we only support numbered tagged downloads
|
||||
%r[github.com/.*/tarball/((\d\.)+\d)$].match to_s
|
||||
return $1 if $1
|
||||
|
||||
|
||||
# eg. boost_1_39_0
|
||||
/((\d+_)+\d+)$/.match stem
|
||||
return $1.gsub('_', '.') if $1
|
||||
@ -128,6 +128,8 @@ class Pathname
|
||||
stem.scan /_([^_]+)/ do |match|
|
||||
return match.first if /\d/.match $1
|
||||
end
|
||||
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -196,6 +196,11 @@ class BeerTasting <Test::Unit::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
def test_no_version
|
||||
assert_nil Pathname.new("http://example.com/blah.tar").version
|
||||
assert_nil Pathname.new("arse").version
|
||||
end
|
||||
|
||||
def test_bad_version
|
||||
assert_raises(RuntimeError) {f=TestBadVersion.new}
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user